From d2b26375eaf5f1fd8b8cb4aa4b4bdacd2d7b0d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Draho=C5=A1?= Date: Fri, 1 Oct 2010 03:55:05 +0200 Subject: [PATCH] Import to git --- AUTHORS | 5 + CHANGELOG | 106 ++++++++ CMakeLists.txt | 17 ++ INSTALL | 10 + LGPL.txt | 504 +++++++++++++++++++++++++++++++++++++++ LICENSE | 9 + README | 93 ++++++++ THANKS | 18 ++ TODO | 13 + dist.cmake | 130 ++++++++++ dist.info | 15 ++ doc/README | 28 +++ doc/actor.txt | 49 ++++ doc/api.txt | 58 +++++ doc/capi_helpers.txt | 53 ++++ doc/objects.txt | 95 ++++++++ doc/objl_c_interface.txt | 47 ++++ doc/slicing.txt | 9 + examples/robinhood.lua | 31 +++ install.sh | 38 +++ lib/ObjL.lua | 30 +++ lib/objl_base.lua | 98 ++++++++ lib/objl_comm.lua | 118 +++++++++ lib/objl_obj.lua | 107 +++++++++ src/ObjL | Bin 0 -> 9957 bytes src/ObjL.cpp | 13 + src/build.sh | 4 + src/clean.sh | 6 + src/objl_misc.h | 23 ++ test/arraytest.lua | 20 ++ test/objecttest.lua | 67 ++++++ tools/autogen_docs.lua | 27 +++ tools/autogen_loader.lua | 53 ++++ tools/makedist.sh | 11 + 34 files changed, 1905 insertions(+) create mode 100644 AUTHORS create mode 100644 CHANGELOG create mode 100644 CMakeLists.txt create mode 100644 INSTALL create mode 100644 LGPL.txt create mode 100644 LICENSE create mode 100644 README create mode 100644 THANKS create mode 100644 TODO create mode 100644 dist.cmake create mode 100644 dist.info create mode 100644 doc/README create mode 100644 doc/actor.txt create mode 100644 doc/api.txt create mode 100644 doc/capi_helpers.txt create mode 100644 doc/objects.txt create mode 100644 doc/objl_c_interface.txt create mode 100644 doc/slicing.txt create mode 100755 examples/robinhood.lua create mode 100755 install.sh create mode 100644 lib/ObjL.lua create mode 100644 lib/objl_base.lua create mode 100644 lib/objl_comm.lua create mode 100644 lib/objl_obj.lua create mode 100755 src/ObjL create mode 100644 src/ObjL.cpp create mode 100755 src/build.sh create mode 100755 src/clean.sh create mode 100644 src/objl_misc.h create mode 100755 test/arraytest.lua create mode 100755 test/objecttest.lua create mode 100755 tools/autogen_docs.lua create mode 100755 tools/autogen_loader.lua create mode 100755 tools/makedist.sh diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..b07337c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ +ObjL AUTHORS + +John Ohno -- main author + + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..8e9726f --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,106 @@ +14 August, 2006: +- Added examples +- Changed ObjL_Object:recieve() to ObjL_Object:receive() in comm.lua +- Fixed calls to said method +- Fixed gsub patterns in line 78 of comm.lua +- Made those values that should be local into local variables in comm.lua, et al +- Cleaned up conveluted ~= statements to use ~= in comm.lua, et al +- Added 5.1 package compatibility (creates module ObjLua) +- Fixed ObjL.serialize(), ObjL.unserialize(), and ObjL_Object.receive() in + doc/api.txt +- Added installer for POSIX systems +- Added README, LICENSE, and INSTALL files +- Added a copy of the LGPL (LGPL.txt) +- Released version 0.01beta +- Added doc/objects.txt (tutorial and cheatsheat on objects) +- Added ObjL.makethread() +- Added ObjL.help() +- Fixed extra arg passing in the function generated by ObjL_Object:forward() +- Added metamethods to ObjL_Object -- __newindex(), __add(), __sub(), __mul(), +__unm(), __concat() +- Made ObjL.serialize() serialize all types (though somewhat unreliably) +- Made metamethod __newindex() save dumpables of all functions +- Added src/ directory with experimental standalone interpreter +15 August, 2006 +- Fixed saving of lightuserdata in ObjL.serialize() +- Added object-based serialize method: ObjL_Object:serialize() +- Fixed functionsave-based memory leak possibility in object's __newindex() +metamethod +- Added capacity for differentiating between local message and remote message in +ObjL_Object:forward() +- Added __tostring() metamethod to object, making it call ObjL.serialize() +- Added AUTHORS file +- Added THANKS file +- Released version 0.02alpha +19 August, 2006 +- Removed src/* -- too big for something that doesn't work. +- Commented out the src/ bit of install.sh +- Created tools/ +- Created tools/autogen_docs.lua and tools/autogen_loader.lua +- Created TODO +- Created doc/objl_c_interface.txt +- Created doc/README +- Created src/objl_misc.h +- Created doc/capi_helpers.txt +- Edited doc/objl_c_interface.txt to reference capi_helpers.txt +- Edited doc/README to reference to doc/capi_helpers.txt +- Edited README to list directories and their content. +- Made install.sh install the headers in src/ to /usr/include/ObjL/ +- Released version 0.03alpha +20 August, 2006 +- Added src/ObjL.c (standalone wrapper) +- Added src/build.sh and src/clean.sh +- Set install.sh to build and install standalone wrapper +- Fixed require statements in lib/ObjL.lua +- Commented out require in lib/obj.lua +- Renamed lib/obj.lua to lib/objl_obj.lua and lib/comm.lua to lib/objl_comm.lua +- Fixed __newindex() metamethod in objl_obj.lua to not call itself +- Released version 0.03beta +- Added test/ +- Added test/objtest.lua +- Prepended "return " to the string /o/ passed to loadstring() in +ObjL.unserialize() +21 August, 2006 +- Fixed error in test/objtest.lua +- Changed src/ObjL.c to src/ObjL.cpp , set it to concatenate std::string +objects instead of c strings, and changed the gcc in build.sh to g++ +- Added the test routines to install.sh +- Made examples/robinhood.lua use the ObjL standalone wrapper as an interpreter +- Made lib/objl_obj.lua initialise ObjL_Object.forwards +- Made examples/robinhood.lua run ObjL.makethread() on the initializing +function instead of just running it. +- Changed examples/robinhood.lua from network-based forwarding to local +forwarding +- Prepended all calls to member functions from inside said member with "self:" +in examples/robinhood.lua +- Added nil arguments to forward() calls in examples/robinhood.lua +- Released 0.03beta2 +22 August, 2006 +- Fixed local forwarding code in lib/objl_comm.lua to wrap the function +instead of setting it. +- Made ObjL_Object.forward() receive asynchronously to better support the Actor +model +- Added doc/actor.txt +- Added reference to doc/actor.txt to doc/README +- Added slicing to ObjL_Object metamethods __index() and __newindex() +- Added __call() metamethod to ObjL_Object for slicing purposes +- Added doc/slicing.txt +- Added test/arraytest.lua +- Referred to test/ in README +- Released 0.04alpha +23 August, 2006 +- Fixed ObjL_Object.recieve() to work on non-function variables and to do +assignments +- Created ObjL_Object.forwardvar() for virtual shared memory via forwarding +- Made default values for ObjL_Object.forward() params /port/ and /address/ +- Added forwardvar() to doc/api.txt and to ObjL.help() +- Added mention of forwardvar() to doc/actor.txt +- Fixed calling method in ObjL_Object metamethod __call() +- Added transparent support for forwarded variables in ObjL_Object metamethods +__index() and __newindex() +- Fixed obiwan indexing error in slice code +- Made code in test/arraytest.lua compatible with above fix +- Made install.sh run all tests +- Made tools/makedist.sh for making distributions of ObjL +- Released 0.05alpha + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..94507b1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (C) 2007-2009 LuaDist. +# Created by Peter Kapec +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Please note that the package source code is licensed under its own license. + +PROJECT(objl NONE) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +INCLUDE(dist.cmake) + +# Install all files and documentation +INSTALL (DIRECTORY lib/ DESTINATION ${INSTALL_LMOD}) +INSTALL (FILES AUTHORS CHANGELOG INSTALL LICENSE README THANKS TODO LGPL.txt DESTINATION ${INSTALL_DATA}) +INSTALL (DIRECTORY doc/ DESTINATION ${INSTALL_DOC}) +INSTALL (DIRECTORY examples/ DESTINATION ${INSTALL_EXAMPLE}) +INSTALL (DIRECTORY test/ DESTINATION ${INSTALL_TEST}) +INSTALL (DIRECTORY tools/ DESTINATION ${INSTALL_FOO}) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..9f5f753 --- /dev/null +++ b/INSTALL @@ -0,0 +1,10 @@ +INSTALL + +TO INSTALL ON UNIX: +As root, run "./install.sh" . + +TO INSTALL ON OTHER SYSTEMS: +Copy the files from lib/ manually to wherever you want to load them +from. doc/api.txt contains the API reference. + + diff --git a/LGPL.txt b/LGPL.txt new file mode 100644 index 0000000..b1e3f5a --- /dev/null +++ b/LGPL.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b6acac9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +LICENSE + +ObjL (Objective Lua) is licensed under the GNU LGPL. +This program is FREE SOFTWARE. There is NO GARUNTEE express or implied for its +safety, completeness, usability, or fitness for a particular purpose. USE AT +YOUR OWN RISK. + +The full LGPL is available from http://gnu.org/licenses +A copy has been put into this distribution under the file LGPL.txt diff --git a/README b/README new file mode 100644 index 0000000..3a11baa --- /dev/null +++ b/README @@ -0,0 +1,93 @@ + ########## ####### ######### ## ____ o + ## ## ## ## ## ## / o\ + ## ## ## ### ## ## ## Objective Lua | O O | + ## ## ## ## ## ## ## \____/ +########## ####### ##### ######### (c) 2006 John Ohno + Licensed under the GNU LGPL + ##################################################################### +##################################################################### + +So you've downloaded ObjL. You're probably wondering what the hell it is, and +why the hell you downloaded it. Or, alternately, you could be wondering how +the hell someone came up with something so Insanely Great and how the hell +to install it (hey, it could happen ^.~ ). Well, this document will (hopefully) +answer all such questions, or at least point you to someone who can. + + +WHAT IS OBJL? +ObjL is Objective Lua, an attempt at making Lua object oriented. "Why," you may +say, "when so many people have already done so -- and when most people simply +implement a new one for each project!" Well, ObjL isn't just ANY oo system -- +it is based upon the design goals of Objective C, and therefore aims to meet +the following criteria: +- It provides a full Object Orientation system, including multiple inheritence, +classes, constructors, and even some less common features like inheritence on +object creation. +- It is very small and light -- simply a tiny upper layer to the language. +- It provides Objective C's concept of method forwarding -- allowing objects to +field method calls to other objects, possibly across processes or a network, +while making it seem as if the call was completely local to said object. +- It retains support for manual modification of objects and their contents, +via any method used in pure lua. +- It provides all this without modifying the underlying language at all -- only +extending it. + +WHY USE OBJL? +- ObjL is small, light, and fast. The overhead is epsilon when compared to the +flexibility and functionality it brings to the programmer. +- ObjL is pure lua -- no recompiling or messing with dynamic libraries. +- ObjL provides the functionality of an object orientation framework and an +object brokering system to lua, in a small package. + +WHAT ARE SOME GOOD APPLICATIONS FOR OBJL? +- Clustering +- Inter-process communication +- Behavior-based AI +- Games +- Desktop integration +- Network apps +- Home automation +- Anything that requires functional object orientation + +INSTALLATION +See INSTALL file for details. + +WHAT'S IN THE PACKAGE? +The package has a number of directories. They are: + - doc/ Documentation and tutorials (ASCII text; see doc/README + for details on contents) + - examples/ Various code examples for applying ObjL + - lib/ The ObjL library itself + - src/ Various C/C++ code useful for C API developers + - tools/ A few utility scripts useful to users of this package + - test/ A few ObjL testing scripts + + +WHERE TO GET OBJL +For more details, new releases, help, and community interaction, check out: + http://luaforge.net/projects/objl + +If you can't find anything to help you, and nobody knows the answer, as a last +resort you can email me at: + john.ohno@gmail.com +Put "ObjL" in the subject line. + + +~John Ohno +President/Accela Labs +Lead Developer/ObjL + + +Note: +If you like ObjL and want to drop me a line in a fun way, send me a postcard: + + John Ohno + Accela Labs + 81 Pond Hill Rd + North Haven, CT + 06473 + USA + +By the way, I don't want you dropping by my house -- trespassers are shot ;-) + + diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..d4fb144 --- /dev/null +++ b/THANKS @@ -0,0 +1,18 @@ +ObjL THANKS + +Thanks goes out to: +- Roberto Ierusalimschy, for writing PIL +- Roberto Ierusalimschy, LHF, and Waldemar Celes, for creating Lua +- Rici, who helped me understand the beauty of string.gsub() +- Keffo, for angering me enough with his detrimental comments that I actually +stuck to it +- The creators of Objective C and the Objective C wikipedia article, for +inspiring me to create something like this +- The creators of LuaSocket, and of LuaCheia (who packaged it nicely) +- The creators of the RedBull, RockStar, Monster, AMP, and MDX energy drinks +- The creators of Lunar Linux, without which I would still be using crappy +distros ;-) +- IBM, for creating the Thinkpad, the only laptop I'll ever truly enjoy using +(John Ohno) + + diff --git a/TODO b/TODO new file mode 100644 index 0000000..afc872c --- /dev/null +++ b/TODO @@ -0,0 +1,13 @@ +TODO + +- tools/autogen_docs.lua should include comments for functions (pairing them +with said functions), and should check for actual functions, not just the word +"function" followed by a space. +- tools/autogen_loader.lua should somehow insert the name of the library into +the comments up top. I could maybe rewrite this cleaner with gsub. +- The tools/autogen_*.lua programs could use better command line parsing, and +some good documentation (thus preferably not generated by autogen_docs ;-)). +- There should be full documentation on how to build ObjL libraries via C or +C++. +- Some C library helper headers would be nice ;-) + diff --git a/dist.cmake b/dist.cmake new file mode 100644 index 0000000..95928b2 --- /dev/null +++ b/dist.cmake @@ -0,0 +1,130 @@ +# LuaDist CMake utility library. +# Provides variables and utility functions common to LuaDist CMake builds. +# +# Copyright (C) 2007-2010 LuaDist. +# by David Manura, Peter Drahos +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Please note that the package source code is licensed under its own license. + +# Few convinence settings +SET (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) +SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH}) + +# Where to install module parts: +set(INSTALL_BIN bin CACHE PATH "Where to install binaries to.") +set(INSTALL_LIB lib CACHE PATH "Where to install libraries to.") +set(INSTALL_INC include CACHE PATH "Where to install headers to.") +set(INSTALL_ETC etc CACHE PATH "Where to store configuration files") +set(INSTALL_LMOD share/lua/lmod CACHE PATH "Directory to install Lua modules.") +set(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.") +set(INSTALL_DATA share/${PROJECT_NAME} CACHE PATH "Directory the package can store documentation, tests or other data in.") +set(INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.") +set(INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.") +set(INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.") +set(INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH "Where to install additional files") + + +# In MSVC, prevent warnings that can occur when using standard libraries. +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif(MSVC) + +# Adds Lua shared library module target `_target`. +# Additional sources to build the module are listed after `_target`. +macro(add_lua_module _target) + find_package(Lua51 REQUIRED) + include_directories(${LUA_INCLUDE_DIR}) #2DO: somehow apply only to _target? + + add_library(${_target} MODULE ${ARGN}) + set_target_properties(${_target} PROPERTIES PREFIX "") + target_link_libraries(${_target} ${LUA_LIBRARY}) + + IF(WIN32) + set_target_properties(${_target} PROPERTIES LINK_FLAGS "-Wl,--enable-auto-import") + ENDIF() + +endmacro(add_lua_module) + +# Runs Lua script `_testfile` under CTest tester. +# Optional argument `_testcurrentdir` is current working directory to run test under +# (defaults to ${CMAKE_CURRENT_BINARY_DIR}). +# Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}. +# Under LuaDist, set test=true in config.lua to enable testing. +macro(add_lua_test _testfile) + include(CTest) + if(BUILD_TESTING) + find_program(LUA NAMES lua lua.bat) + get_filename_component(TESTFILEABS ${_testfile} ABSOLUTE) + get_filename_component(TESTFILENAME ${_testfile} NAME) + get_filename_component(TESTFILEBASE ${_testfile} NAME_WE) + + # Write wrapper script. + set(TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME}) + set(TESTWRAPPERSOURCE +"package.path = '${CMAKE_CURRENT_BINARY_DIR}/?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;' .. package.path +package.cpath = '${CMAKE_CURRENT_BINARY_DIR}/?.so\;${CMAKE_CURRENT_BINARY_DIR}/?.dll\;' .. package.cpath +return dofile '${TESTFILEABS}' +" ) + if(${ARGC} GREATER 1) + set(_testcurrentdir ${ARGV1}) + get_filename_component(TESTCURRENTDIRABS ${_testcurrentdir} ABSOLUTE) + set(TESTWRAPPERSOURCE +"require 'lfs' +lfs.chdir('${TESTCURRENTDIRABS}') +${TESTWRAPPERSOURCE}") + endif() + FILE(WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE}) + + add_test(${TESTFILEBASE} ${LUA} ${TESTWRAPPER}) + endif(BUILD_TESTING) + + # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake +endmacro(add_lua_test) + +# Converts Lua source file `_source` to binary string embedded in C source +# file `_target`. Optionally compiles Lua source to byte code (not available +# under LuaJIT2, which doesn't have a bytecode loader). Additionally, Lua +# versions of bin2c [1] and luac [2] may be passed respectively as additional +# arguments. +# +# [1] http://lua-users.org/wiki/BinToCee +# [2] http://lua-users.org/wiki/LuaCompilerInLua +function(add_lua_bin2c _target _source) + find_program(LUA NAMES lua lua.bat) + execute_process(COMMAND ${LUA} -e "string.dump(function()end)" RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET) + if (NOT ${_LUA_DUMP_RESULT}) + SET(HAVE_LUA_DUMP true) + endif() + message("-- string.dump=${HAVE_LUA_DUMP}") + + if (ARGV2) + get_filename_component(BIN2C ${ARGV2} ABSOLUTE) + set(BIN2C ${LUA} ${BIN2C}) + else() + find_program(BIN2C NAMES bin2c bin2c.bat) + endif() + if (HAVE_LUA_DUMP) + if (ARGV3) + get_filename_component(LUAC ${ARGV3} ABSOLUTE) + set(LUAC ${LUA} ${LUAC}) + else() + find_program(LUAC NAMES luac luac.bat) + endif() + endif (HAVE_LUA_DUMP) + message("-- bin2c=${BIN2C}") + message("-- luac=${LUAC}") + + get_filename_component(SOURCEABS ${_source} ABSOLUTE) + if (HAVE_LUA_DUMP) + get_filename_component(SOURCEBASE ${_source} NAME_WE) + add_custom_command( + OUTPUT ${_target} DEPENDS ${_source} + COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ${SOURCEABS} + COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ">${_target}" ) + else() + add_custom_command( + OUTPUT ${_target} DEPENDS ${SOURCEABS} + COMMAND ${BIN2C} ${_source} ">${_target}" ) + endif() +endfunction(add_lua_bin2c) diff --git a/dist.info b/dist.info new file mode 100644 index 0000000..a4bc199 --- /dev/null +++ b/dist.info @@ -0,0 +1,15 @@ +--- This file is part of LuaDist project + +name = "objl" +version = "0.05aplpha" + +desc = "An OO framework for Lua similar to that of Objective C, containing objects with multiple inheritence and forwarding to other objects, possibly between processes and machines." +author = "John Ohno" +license = "GNU LGPL" +url = "http://luaforge.net/projects/objl" +maintainer = "Peter Kapec" + +depends = { + "lua ~> 5.1", + "luasocket >=2.0.2", +} diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..24a29be --- /dev/null +++ b/doc/README @@ -0,0 +1,28 @@ +DOCS README + +This directory contains ObjL documentation in ASCII text format. +Files: + - api.txt The ObjL API, complete with functions, objects, + variables, and descriptions + - objects.txt An ObjL object model tutorial + - objl_c_interface.txt + A tutorial on creating ObjL libraries in C + - capi_helpers.txt + The specs on a few functions included in this package + that may help you make your Lua C extensions more + readable and easier to code and maintain. + - actor.txt Information on how to do concurrent programming using + ObjL and a modified form of the Actor Model + + +Read api.txt and objects.txt if you wish to code in ObjL. + +Read objl_c_interface.txt if you wish to code interfaces between C libraries +and ObjL, instead of just pure Lua. + +Read capi_helpers.txt if you wish to code interface between C libraries and +either ObjL or pure Lua. + +Read actor.txt if you wish to do concurrent programming with ObjL. + + diff --git a/doc/actor.txt b/doc/actor.txt new file mode 100644 index 0000000..c6bc62e --- /dev/null +++ b/doc/actor.txt @@ -0,0 +1,49 @@ +ACTORS + +ObjL can be used as the basis for a somewhat limited form of Concurrent +Programming using the Actor Model. + +Concurrent programming generally refers to the programming of code that is +spread between many, simultaneously running program instances, such as threads +or code running on separate processors. + +The main problems that each form of concurrent programming must solve are: +- Running in parallel - Each piece of code must come in the requisite order, but +said code must run in parallel. +- Coordinating access to resources - Code may not interfere with the working of +other code, or with the validity of shared data. + +The actor model traditionally solves these problems by having each process be +an encapsulated, independent piece of code that communicates to other actors +via message passing. However, that still leaves issues of coordinating access +to resources, as multiple requests to the same actor may interfere with one +another. + +The ObjL actor model is a simplified, semi-concurrent form of the actor model. +It solves the problem of resource access coordination by making each group of +processes run in non-preemptive threads (the cooperative multitasking method +known in Lua as 'coroutines'), and each of these groups of coroutines an +independent process. Each process has shared data, which cannot be corrupted by +parallel processing of the coroutines, and each coroutine accepts messages in +serial, however each of these processes may interoperate in parallel, and each +thread acts as if it is working in parallel. All groups of statements that are +between calls of coroutine.yield() are considered atomic, and therefore the +data set in them cannot be corrupted due to the parallelization. + +The act of forwarding turns message passing into a simulation of shared +dataspace for methods, even though it still works as message passing. +Additionally, responses are semi-asynchronous, because the thread only pauses +if the returned result is to be used in a later computation, otherwise the +result is recieved and discarded while the other thread runs normally. This +solves the problem of asynchronous operations when results are necessary, as +well as the problem of synchronous operations holding up processing when +results are not. If the result is not immediately necessary and should not hold +up computation, but is necessary for a later computation, one may create +another coroutine for the reception and assignment of the result, and then +check to see if the coroutine finished or if the result variable is assigned +before execution of the later computation. + +Virtual shared memory is provided via variable forwarding, which provides the +same functionality as method forwarding via mostly the same functionalities, +except for non-function variables. + diff --git a/doc/api.txt b/doc/api.txt new file mode 100644 index 0000000..1e5964b --- /dev/null +++ b/doc/api.txt @@ -0,0 +1,58 @@ +ObjL API reference +(c) 2006 John Ohno +Licensed under the GNU FDL + +ObjL.lua: + (nothing defined) + +objl_base.lua: + ObjL -- A table storing general purpose functions and data + for ObjL backend use. + ObjL.threads -- A table containing coroutine objects for running + threads + ObjL.makethread(f) + -- A function that creates a thread for function f and + adds it to ObjL.threads, returning it + ObjL.mainloop() -- A function that runs all the threads in ObjL.threads + ObjL.serialize(o) + -- A function that serializes tables for sending over + sockets. DOES NOT ACCEPT CYCLES! + ObjL.unserialize(o) + -- A function that unserializes data from socket + communication. Currently just does a loadstring(). + ObjL.help() -- Prints help info + +objl_obj.lua: + ObjL_Object -- A table containing the prototype for an object in + ObjL + ObjL_Object:serialize() + -- Serializes the current object + class(...) -- A function that creates a new class. It is passed + any number of parent classes to inherit from, and + returns a conglomeration of all parent classes, with + a new() method. + new(o) -- A function that optionally takes one argument, + an object to conglomerate with, and returns a new + object of that class type. + +objl_comm.lua: + ObjL_Object: + receive(msg, args) + -- A method that calls a function with the + given name (msg) with the given args (args). + forward(msg, func, address, port, msg2) + -- A method that initiates a forward to another + object, possibly served from another process or + machine (via sockets). Links msg to the function + func if address and port are nil, otherwise links + it to a new function that sends the request to the + server on address and port to run msg2 on that func, + unless msg2 is nil, in which case it runs msg instead. + forwardvar(msg, var, address, port, msg2) + -- The same as forward(), except for variables + ObjL: + serve(address, port, backlog) + -- A function that creates a coroutine server to allow + other processes or machines to forward to objects on + this process. + diff --git a/doc/capi_helpers.txt b/doc/capi_helpers.txt new file mode 100644 index 0000000..5c82a83 --- /dev/null +++ b/doc/capi_helpers.txt @@ -0,0 +1,53 @@ +C API HELPERS + +We have put in a few functions to simplify your life in regards to ObjL C API +interfacing. These are located in src/objl_misc.h . + +The functions are as follows: + void setuserdata(lua_State *L, void x) + void loadlibs(lua_State *L, static struct luaL_reg** libs, const char** names, int count) + +The function setuserdata() takes a lua_State and a userdata (void x), and makes +the userdata point to the object. This may seem trivial, but it saves a lot of +code in large projects, as normally you need to define a separate instance of +the userdata that you wish to push, and then create the pointer later, and then +assign it, all manually. +To see the effect, here's an example of code not using setuserdata(): + static int newWidget(lua_State *L) { + Widget w=Widget->new(); + Widget *w2=lua_newuserdata(L, sizeof(w)); + w=w2; + return 1; + } +Now here's the same function, except using setuserdata(): + static int newWidget(lua_State *L) { + setuserdata(L, Widget->new()); + return 1; + } + +The function loadlibs() is a way of automating all that annoying class +generation and fieldsetting required in packing ObjL classes into a lua +package. Here's some code without it: + static int luaopen_foo(lua_State *L) { + luaL_openlib(L, "foo", foo); // main package + luaL_openlib(L, "bar", bar); // class + lua_setfield(L, -2, "bar"); // packing it in + luaL_openlib(L, "baz", baz); // class + lua_setfield(L, -2, "baz"); // packing it in + luaL_openlib(L, "septa", septa); // class + lua_setfield(L, -2, "septa") // packing it in + return 1; + } +Now, here's the same code with it: + static int luaopen_foo(lua_State *L) { + static struct luaL_reg** libs={bar, baz, septa}; + const char ** names={"bar", "baz", "septa"}; + luaL_openlib(L, "foo", "foo"); + loadlibs(L, libs, names, 3); + return 1; + } +Much easier to write and maintain. + +By the way, these functions may actually be useful for pure Lua C API code, not +just ObjL C API code. + diff --git a/doc/objects.txt b/doc/objects.txt new file mode 100644 index 0000000..151c810 --- /dev/null +++ b/doc/objects.txt @@ -0,0 +1,95 @@ +OBJL OBJECTS + +Objects in ObjL have the following functionalities: +- new(o) -- create a new copy of the current object, inheriting from /o/ + if given +- receive(msg, args) + -- receive the message /msg/ and execute it with the arguments + /args/. This usually means running the function /msg/ and + passing it /args/. +- forward(msg, function, address, port) + -- if address and port are non-nil, forward /msg/ in the current + object to /msg/ in the object /func/ on the server at /address/ + and /port/, otherwise forward /msg/ to the function /func/. +Metatable functions: +- __newindex(t, k, v) + -- normal index setting function, but saves string + representations of each function in the table element of + the function name preceded by three underscores. +- __add(a, b) -- does a union of the elements in each table +- __sub(a, b) -- does an intersection of the elements in each table +- __mul(a, b) -- returns a table with /b/ copies of /a/. In other words, + for an object /foo/, doing: + bar=foo*100 + creates a table bar, with 100 copies of foo +- __concat(a, b) + -- link to __add() +- __unm(a) -- reverses the table. In other words: + foo={ "a", "b", "c"} + print(-foo) + should print: + c b a + + + +All objects in ObjL are capable of multiple inheritence, both in the creation of +classes, as classes, in the instantiation procedure, and as objects. + +To create a class, do: + foo=class() +To inherit from other classes, put the class names as arguments to class(): + foo=class(bar, baz) +To create a class from a table framework, put the table as an argument: + foo=class({bar="hello", baz="NAVI"}) +To create an object from a class, use class:new(o) syntax: + x=foo:new() +To inherit from another class or object during this instantiation, pass it to +new(): + x=foo:new(bar) +This works with table frameworks as well: + x=foo:new({bar="guten", baz="tag"}) +To make a class or object inherit the rest of the time, use the __add() or +__concat() metamethods: + foo=foo+bar + -- OR + foo=foo..bar +Once again, this also works with table frameworks: + foo=foo+{zork="OMFGROFLWTF"} +Members are accessed as you would a table: + print(foo.bar) +Functions are declared outside: + function foo:add(x, y) + return x+y + end + + +FORWARDING + +Functions are forwarded using object.forward() : + bottle=class({message="Hello, UNIX!\n"}) + opener=class({message="Opening bottle to read secret message...\n"}) + function bottle:open() print(self.message) end + function opener:read() print(self.message) open() end + opener.forward("open", bottle.open) + opener:read() -- Run the whole shebang +Functions may be forwarded across processes or machines: + -- section of code running on localhost port 1997 + server=class({message="Now on the remote machine."}) + function server:domsg(args) + print(self.msg) + print(args) + return self.msg + end + ObjL.serve("127.0.0.1", 1997, 10) -- start server process + ObjL.mainloop() -- start main loop + -- section of code running in another process on localhost + client=class({message="A message from the client machine"}) + function client:run() + print (self.message) + print (self.domsg({self.message})) + end + client.forward("domsg", "server", "127.0.0.1", 1997) + client:run() + ObjL.mainloop() -- start main loop + + diff --git a/doc/objl_c_interface.txt b/doc/objl_c_interface.txt new file mode 100644 index 0000000..d4bc037 --- /dev/null +++ b/doc/objl_c_interface.txt @@ -0,0 +1,47 @@ +Creating ObjL libraries in C: + +First, take all the functions you want to write, and make groups based upon the +object each is in. Take some form of data to represent this object -- usually +userdata, but it just needs to be something that provides the object's +functionalities or identifies it. Write your c functions, making one of them +create the object and return it, and the others take it as a first argument. +Note that these are not your Lua API functions just yet. When you are done, +create wrappers to these functions using the Lua API. For example, for a +function like: + Widget newWidget(int x, int y) { + return Widget(x, y, "Hello"); + } +we would create code like this: + static int LNewWidget(lua_State *L) { + Widget w=newWidget(lua_tonumber(L, 1), lua_tonumber(L, 2)); + Widget *w2=lua_newuserdata(L, sizeof(w)); + w2=w; + return 1; + } +If this is going over your head, you should read the section of the Lua manual +or PIL that shows how to create normal C API functions for Lua. +Next, create the luaL_reg structs for each object, a separate one for each. +Name the lua function for creating an object "init". Then create a luaL_reg +struct for the package as a whole. This may be empty. If it is, you're probably +better off making a table manually in the next step. +Your luaopen_packagename() should look something like this: + static int luaopen_foo(lua_State *L) { + luaL_openlib(L, "foo", foo) // this is your main package + luaL_openlib(L, "child1", child1) // your first class + lua_setfield(L, -2, "child1") // set it as an element in foo + // may continue with repeats of last two lines for any classes + return 1; // you have one value to return -- foo + } +And finally, we generate the lua package loader. This is done quite easily with +the script tools/autogen_loader.lua in this package. Simply do + tools/autogen_loader.lua packagename > packagename.lua +where packagename is the name of your package. Now once you have your installer +script or makefile copy the created library and the package loader to a +directory in the Lua path, you'll be golden. + +A tip: Look in the file doc/capi_helpers.txt for info on functions that may +make coding ObjL/Lua C extensions easier. + + +Good luck, and good tidings! + diff --git a/doc/slicing.txt b/doc/slicing.txt new file mode 100644 index 0000000..cab0dc0 --- /dev/null +++ b/doc/slicing.txt @@ -0,0 +1,9 @@ +SLICING + +Slicing of an ObjL object can be done in a few different ways: +- x[{1,10}] -- Returns elements 1 to 10 of x +- x{1,10} -- Same as above +- x[{1,10}]=z -- Sets z as element 1 of x, and deletes 2-10 +- x{1,10}=z -- Same as above + + diff --git a/examples/robinhood.lua b/examples/robinhood.lua new file mode 100755 index 0000000..006d14a --- /dev/null +++ b/examples/robinhood.lua @@ -0,0 +1,31 @@ +#!/usr/bin/env ObjL + +--[[ Simulates the classic RobinHood/FriarTuck hack +(c) 2006 John Ohno +Licensed under the GNU LGPL +--]] + +character={} +character.message="Hello, world!" +function character:say() print (self.message) end + +repeater={} +function repeater:rep() self:say() self:othersay() end + +Character=class(character, repeater) + +robinhood=Character:new({message="Hold on my dear friar, I'll save you!"}) +friartuck=Character:new({message="Help me Robin Hood, I'm in peril!"}) + +function friartuck:othersay() self:say () self:rep() end + +robinhood:forward("othersay", friartuck.othersay, nil, nil, nil) +--function friartuck:othersay() coroutine.yield() say() coroutine.yield() rep() end +friartuck:forward("rep", robinhood.rep, nil, nil, nil) + +--ObjL.serve("127.0.0.1", 1337, 10) + +ObjL.makethread(robinhood:othersay({})) + +ObjL.mainloop() + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..456d3d5 --- /dev/null +++ b/install.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +INSTDIR="/usr/local/ObjL/" +DOCSDIR="/usr/share/doc/ObjL" +INCDIR="/usr/include/ObjL" +BINDIR="/usr/bin" + +echo "Installing ObjL..." +echo -e "\tCreating library directory... \c" +mkdir $INSTDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tCopying library files.. \c" +cp ./lib/* $INSTDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tCreating docs directory... \c" +mkdir $DOCSDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tCopying docs... \c" +cp ./doc/* $DOCSDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +#echo "Installing experimental ObjL standalone interpreter..." +#cd src +#./build.sh +#./install.sh +#cd .. +echo -e "\tCreating ObjL C include directory... \c" +mkdir $INCDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tCopying ObjL C headers over... \c" +cp ./src/*.h $INCDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tBuilding ObjL standalone wrapper... \c" +cd src +./build.sh && echo -e "\t[OK]" || echo -e "\t[FAILED]" +cd .. +echo -e "\tCopying ObjL standalone wrapper... \c" +cp ./src/ObjL $BINDIR && echo -e "\t[OK]" || echo -e "\t[FAILED]" +echo -e "\tTesting ObjL..." +for item in ./test/*.lua ; do +ObjL $item && echo -e "\t[OK]" || echo -e "\t[FAILED]" +done +echo -e "Done installing ObjL." +echo -e "Docs are in $DOCSDIR and library files are in $INSTDIR.\n\n" + diff --git a/lib/ObjL.lua b/lib/ObjL.lua new file mode 100644 index 0000000..3ab6201 --- /dev/null +++ b/lib/ObjL.lua @@ -0,0 +1,30 @@ +#!/usr/bin/env lua + +--[[ Objective-Lua (ObjL) +(c) 2006 John Ohno +Licensed under the GNU LGPL + +A simple OO layer to Lua, based loosely on +that of Objective C. + +This system provides classes with multiple +inheritence and forwarding (in-program, +interprocess, and over network). +--]] + +if cheia then -- if we're using LuaCheia + cheia.load("socket") +else + require("socket") +end + +package.path=package.path..";/usr/local/ObjL/?.lua" + +require("objl_base") +require("objl_obj") +require("objl_comm") + +if package then + module("ObjLua") +end + diff --git a/lib/objl_base.lua b/lib/objl_base.lua new file mode 100644 index 0000000..b54f980 --- /dev/null +++ b/lib/objl_base.lua @@ -0,0 +1,98 @@ +#!/usr/bin/env lua + +--[[ ObjL-Base: Base backend for Objective-Lua +(c) 2006 John Ohno +Licensed under the GNU LGPL + +Should provide basic structures for ObjL +backend. +--]] + +ObjL={} +ObjL.threads={} + +function ObjL.makethread(f) + if type(f) == "string" then + f=loadstring(f) + end + if type(f) ~= "function" then + return nil, "Argument was not a function or valid source string." + end + table.insert(ObjL.threads, coroutine.create(f)) + return ObjL.threads[table.getn(ObjL.threads)] +end + +function ObjL.mainloop() + local th={} + for i=1,table.getn(ObjL.threads) do + local c, status=coroutine.resume(ObjL.threads[i]) + if status=="dead" or not c then + table.remove(ObjL.threads, i) + else + table.insert(th, ObjL.threads[i]) + end + end + socket.select(th) +end + +function ObjL.serialize(o) + local s="" + if type(o) == "number" then + return o + elseif type(o) == "string" then + return string.format("%q", o) + elseif type(o) == "table" then + s=s.."{ " + for k, v in pairs(o) do + s=s.." "..k.."="..serialize(v)..", " + end + s=s.." }" + return s + elseif type(o) == "function" then + return "loadstring([[" .. string.dump(o) .. "]])" + elseif type(o) == "lightuserdata" then + return "nil" + else + return "loadstring([["..string.dump(function () return o end).."]])" + end +end + +function ObjL.unserialize(o) + return loadstring("return "..o) +end + +function ObjL.help() + print([[ +ObjL - Objective Lua +(c) 2006 John Ohno +Licensed under the GNU LGPL + +ObjL.serialize(o) return a string representation of table /o/ +ObjL.unserialize(o) return a table loaded from the string /o/ +ObjL.serve(a, p, b) create a server coroutine at port /p/ on address /a/, + with backlog /b/, to serve up Objective Lua functions + from forwarded objects +ObjL.makethread(f) make a thread out of function f, add it to + ObjL.threads, and return it +ObjL.mainloop() run all the threads in ObjL.threads, i.e. the server + and all other socket routines, plus whatever else + one has added +class(...) return a class based upon the objects/classes passed + and the ObjL_Object superclass +Class/object functions: +class.new(o) return a new object of type /class/, with the optional + inheriting class /o/ +object.recieve(msg, args) + call the function /msg/ in the current object, with + the arguments /args/ +object.forward(msg, func, a, p, msg2) + forward the function /msg/ in the current object to + the function /func/ if /a/ and /p/ are nil, otherwise + forward it to the function /msg/ in the object /func/ + on the server at address /a/ and port /p/ +object.forwardvar(msg, var, a, p, msg2) + same as /forward/ except for variables +]]) +end + + diff --git a/lib/objl_comm.lua b/lib/objl_comm.lua new file mode 100644 index 0000000..09145d1 --- /dev/null +++ b/lib/objl_comm.lua @@ -0,0 +1,118 @@ +#!/usr/bin/env lua + +--[[ ObjL-Comm: ObjectiveLua inter-object communication +(c) 2006 John Ohno +Licensed under the GNU LGPL + +This file should provide a simple model for communication +of messages between objects. May call via sockets. + +--]] +--[[ +if cheia!=nil then + cheia.load("socket") +else + require("luasocket") +end +--]] +function ObjL_Object:receive(msg, args) + args=args or nil + if type(self[msg]) == "function" then + return self[msg](args) + elseif type(self.forwards[msg])=="function" then + return self.forwards[msg](args) + else + if args then + self[msg]=args + end + return self[msg] + end +end + +function ObjL_Object:forward(msg, func, address, port, msg2) + msg2=msg2 or msg + address=address or nil + port = port or nil + if address then + if port then + if type(func) ~= "string" then + return nil, "Argument 'func' was not a string and type was socket. For non-socket, do not specify address and port." + end + func2= function (args) + local c, err=socket.connect(address, port) + if c==nil then + return nil, err + end + c:send("OBJL FWD:\nOBJ:"..func.."\nMSG:"..msg2.."\nARGS:".. ObjL.serialize(args).."\nOBJL EOF\n\n") + ObjL.makethread(function () local s="" status="" while status~="closed" do status, res= c:receive(2^16) if status=="timeout" then coroutine.yield(c) else s=s..res end end return s end) + end + self.forwards[msg]=func2 +-- return true + self[msg]=func2 + end + end + if type(func) ~= "function" then return nil, "Argument 'func' was not a function, and type was not socket (make sure both address and port are not nil for a socket type)." end + self[msg]=function (args) return func(args) end + return true +end + +function ObjL_Object:forwardvar(msg, var, address, port, msg2) + msg2=msg2 or msg + address=address or nil + port=port or nil + if address and port then + self.forwards[msg]=function(args) + local c, err=socket.connect(address, port) + if c==nil then + return nill, err + end + c:send("OBJL FWD\nOBJ:"..var.."\nMSG:"..msg2.."\nARGS:"..ObjL.serialize(args).."\nOBJL EOF\n\n") + ObjL.makethread(function () local s="" status="" while status~="closed" do status,res=c:recieve(2^16) if status=="timeout" then coroutine.yield(c) else s=s..res end end return s end) + end + end + self.forwards[msg]=function(args) + args=args or nil + if args then + var=args + end + return var + end +end + +function ObjL.serve(address, port, backlog) + local co=coroutine.create(function () + local tcp=socket.tcp() + tcp:bind(address, port) + tcp:listen(backlog) + tcp:settimeout(0) + while true do + local x, status=tcp.accept() + if status=="timeout" then + coroutine.yield(tcp) + else + table.insert(ObjL.threads, coroutine.create( + function () + x:settimeout(0) + local s="" + while status~="closed" + do + local s2="" + local status="" + while s2 and status~="closed" do + s2, status=x.receive() + if status=="timeout" then + coroutine.yield(x) + end + s=s..s2 + end + local _, _, func, msg, args=string.find(s, "OBJL FWD:\nOBJ:(.+)\nMSG:(.+)\nARGS:(.+)\nOBJL EOF\n\n") + x:send(_G[func].receive(msg, ObjL.unserialize(args))) + end + end)) + end + end + end) + table.insert(ObjL.threads, co) +end + + diff --git a/lib/objl_obj.lua b/lib/objl_obj.lua new file mode 100644 index 0000000..bf5bb25 --- /dev/null +++ b/lib/objl_obj.lua @@ -0,0 +1,107 @@ +#!/usr/bin/env lua + +--[[ ObjL-Object: The Objective-Lua object model +(c) 2006 John Ohno +Licensed under the GNU LGPL + +Should represent the base superclass table for an +ObjL object +--]] + +if ObjL_Object == nil then ObjL_Object = {forwards={}} end + +--require("comm.lua") + +function ObjL_Object:serialize() + return ObjL.serialize(self) +end + +function class(...) + local c={} + local arg=arg or {} + c.forwards=ObjL_Object.forwards + table.insert(arg, 1, ObjL_Object) + setmetatable(c, { + __call=function(t, k, v) + v=v or nil + if type(k) == "table" then + local res={} + for i=k[1],k[2] do + res[(i-k[1])+1]=t[i] + end + return res + end + return rawget(t, k)(unpack(v)) + end, + __index=function(t, k) + if type(k) == "table" then + local res={} + for i=k[1],k[2] do + res[(i-k[1])+1]=t[i] + end + return res + end + for i=1,table.getn(arg) do + if type(arg[i])=="table" and arg[i][k] then return arg[i][k] end + end + if t.forwards[k] then return t.forwards[k]() end + end, + __add=function(a, b) + res={} + a=a or {} + b=b or {} + for k, i in pairs(a) do res[k]=i end + for k, i in pairs(b) do res[k]=i end + return res + end, + __newindex=function(t, k, v) + if type(k) == "table" then + for i=k[1]+1,k[2] do + table.remove(t, i) + end + k=k[1] + end + if t.forwards[k] then t.forwards[k](v) end + if type(v) == "function" then + rawset(t,"___"..tostring(k),string.dump(v)) + else + rawset(t,"___"..tostring(k),nil) + end + rawset(t, k, v) + end, + __sub=function(a, b) + res={} + for k, i in pairs(a) do if not b[k] then res[k]=i end end + for k, i in pairs(b) do if not a[k] then res[k]=i end end + return res + end, + __mul=function(a, b) + res={} + for i=1,b do + table.insert(res, a) + end + return res + end, + __concat=__add, + __unm=function(a) + res={} + for i=table.getn(a),1 do + table.insert(res, a[i]) + end + return res + end, + __tostring=function(o) + return ObjL.serialize(o) + end + }) + c.__index = c + function c:new(o) + o=o or {} + o.super=c + setmetatable(o, c) + return o + end + return c +end + + diff --git a/src/ObjL b/src/ObjL new file mode 100755 index 0000000000000000000000000000000000000000..a1a3b85cc121d8424a153cff534e557af706d189 GIT binary patch literal 9957 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 AssI20 literal 0 HcmV?d00001 diff --git a/src/ObjL.cpp b/src/ObjL.cpp new file mode 100644 index 0000000..aa02694 --- /dev/null +++ b/src/ObjL.cpp @@ -0,0 +1,13 @@ +#include +#include +using namespace ::std; + +int main(int argc, char** argv) { + string command="lua -l ObjL"; + int i; + for (i=1; i ${1}.tgz +cd objective-lua/tools +