https://swig.svn.sourceforge.net/svnroot/swig/trunk ................ r10487 | wsfulton | 2008-05-21 23:15:52 +0100 (Wed, 21 May 2008) | 1 line Apply patch from Petr Viktorin to fix some recent regressions in CFFI/CLOS ................ r10498 | talby | 2008-05-26 21:09:56 +0100 (Mon, 26 May 2008) | 2 lines run test cases in the Perl set by the --with-perl5 configure option. ................ r10499 | talby | 2008-05-26 22:04:06 +0100 (Mon, 26 May 2008) | 3 lines The perl5 minherit runtime test will work better if the classes are actually built under SWIGPERL. ................ r10503 | wsfulton | 2008-05-28 10:44:37 +0100 (Wed, 28 May 2008) | 1 line Fix variable wrappers when using -proxy. Patch from Jan Jezabek ................ r10504 | bhy | 2008-05-28 18:27:48 +0100 (Wed, 28 May 2008) | 2 lines Fixed SF #1971977: typo in pycontainer.swg (related to -extranative option) ................ r10506 | wsfulton | 2008-05-29 01:45:28 +0100 (Thu, 29 May 2008) | 1 line Fix variable wrappers when using -noproxy ................ r10508 | bhy | 2008-05-30 14:53:33 +0100 (Fri, 30 May 2008) | 1 line Fixed SF #1976978, apply the macros for primitive types to std::wstring ................ r10511 | olly | 2008-05-30 17:11:27 +0100 (Fri, 30 May 2008) | 4 lines Fix typo in handling of /*@SWIG[...]*/ comments in the scanner. This just meant we were only actually looking for /*@SWI at the start of the comment, so was pretty harmless in practice. ................ r10515 | wsfulton | 2008-06-02 21:10:40 +0100 (Mon, 02 Jun 2008) | 1 line Fix samename testcase for c# and java ................ r10516 | wsfulton | 2008-06-02 21:15:39 +0100 (Mon, 02 Jun 2008) | 1 line Fix enums when using -noproxy ................ r10518 | bhy | 2008-06-07 12:20:07 +0100 (Sat, 07 Jun 2008) | 4 lines Added a test case for keyword renaming. Now it works for Python in SWIG's -c++ mode, but in C mode it doesn't work! (you can try with make keyword_rename.ctest) ................ r10519 | bhy | 2008-06-07 14:40:51 +0100 (Sat, 07 Jun 2008) | 1 line fixed keyword_rename.ctest tese case, caused by a mistake in Swig/naming.c ................ r10527 | mgossage | 2008-06-17 03:57:15 +0100 (Tue, 17 Jun 2008) | 1 line [lua] bugfix 1938142 (bool& and bool* support) ................ r10530 | wsfulton | 2008-06-19 21:02:13 +0100 (Thu, 19 Jun 2008) | 1 line Add R keyword support. Rename keywords for successful compilation of Java and C# code. More consistent keyword warnings across the different languages. ................ r10531 | wsfulton | 2008-06-19 22:15:48 +0100 (Thu, 19 Jun 2008) | 1 line add complete list of R reserved words ................ r10536 | wsfulton | 2008-06-21 12:35:33 +0100 (Sat, 21 Jun 2008) | 1 line better terminology for static types ................ r10537 | wsfulton | 2008-06-21 12:42:48 +0100 (Sat, 21 Jun 2008) | 1 line remove raise as keyword test- it conflicts with _raise in LIBCMT on windows ................ r10539 | wsfulton | 2008-06-21 16:21:29 +0100 (Sat, 21 Jun 2008) | 1 line Lua example warning removal fixes for vc++ ................ r10540 | wsfulton | 2008-06-21 16:23:02 +0100 (Sat, 21 Jun 2008) | 1 line Remove some vc++ /W4 warnings ................ r10541 | wsfulton | 2008-06-21 17:04:55 +0100 (Sat, 21 Jun 2008) | 1 line minor vc++ /W4 warning fixes ................ r10542 | wsfulton | 2008-06-21 20:07:51 +0100 (Sat, 21 Jun 2008) | 1 line 'byte' is already used in Ruby on windows, so use another keyword ................ r10543 | wsfulton | 2008-06-21 21:45:32 +0100 (Sat, 21 Jun 2008) | 1 line Fix crashing in the Ruby reject method in the STL wrappers ................ r10544 | wsfulton | 2008-06-21 21:48:28 +0100 (Sat, 21 Jun 2008) | 1 line Fix crashing in the Ruby reject method in the STL wrappers ................ r10545 | wsfulton | 2008-06-21 21:49:10 +0100 (Sat, 21 Jun 2008) | 1 line remove unnecessary variable int the char **STRING_ARRAY out typemap ................ r10546 | wsfulton | 2008-06-21 22:07:49 +0100 (Sat, 21 Jun 2008) | 1 line Fix Ruby C++ example dependencies in dsp files ................ r10547 | wsfulton | 2008-06-21 23:25:36 +0100 (Sat, 21 Jun 2008) | 1 line Fix unused parameter warnings in python when using gcc's -W -Wall options ................ r10548 | wsfulton | 2008-06-21 23:26:35 +0100 (Sat, 21 Jun 2008) | 1 line Fix virtual destructor ................ r10549 | wsfulton | 2008-06-22 00:25:20 +0100 (Sun, 22 Jun 2008) | 1 line various warning fixes ................ r10550 | wsfulton | 2008-06-22 01:09:11 +0100 (Sun, 22 Jun 2008) | 1 line Another fix for the JVM hanging on exit problem when using directors ................ r10551 | wsfulton | 2008-06-22 01:09:51 +0100 (Sun, 22 Jun 2008) | 1 line documentation sections update ................ r10552 | wsfulton | 2008-06-22 01:18:10 +0100 (Sun, 22 Jun 2008) | 1 line more docs on defining macros for the thread hanging problem ................ r10558 | wsfulton | 2008-06-22 22:30:20 +0100 (Sun, 22 Jun 2008) | 1 line fix unused parms in last commit for C code ................ r10559 | wsfulton | 2008-06-22 23:12:43 +0100 (Sun, 22 Jun 2008) | 1 line Suppress unused methods warning for VC++ ................ r10560 | wsfulton | 2008-06-23 21:26:07 +0100 (Mon, 23 Jun 2008) | 1 line fix partialcheck-test-suite and parallel make for r, chicken, tcl and php ................ r10561 | wsfulton | 2008-06-23 21:39:41 +0100 (Mon, 23 Jun 2008) | 1 line correct message display when running the partialcheck-test-suite make target ................ r10562 | wsfulton | 2008-06-23 22:14:53 +0100 (Mon, 23 Jun 2008) | 1 line fix typo ................ r10563 | olly | 2008-06-23 22:23:54 +0100 (Mon, 23 Jun 2008) | 3 lines Fix bad use of Python API (untested, since I can't even compile this code on x86-64!) ................ r10564 | olly | 2008-06-23 23:58:03 +0100 (Mon, 23 Jun 2008) | 3 lines [PHP] Fix segfault when wrapping a non-class function marked with %newobject (testcase char_strings). ................ r10565 | olly | 2008-06-24 01:27:34 +0100 (Tue, 24 Jun 2008) | 3 lines [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) (testcase ignore_parameter). ................ r10566 | olly | 2008-06-24 01:33:08 +0100 (Tue, 24 Jun 2008) | 2 lines [PHP] Fix typemap_namespace.i to not try to copy a non-existent typemap. ................ r10567 | olly | 2008-06-24 01:41:07 +0100 (Tue, 24 Jun 2008) | 3 lines Clean up dead and unused code in SwigToPhpType(), and rename to GetShadowReturnType(). ................ r10568 | olly | 2008-06-24 01:42:29 +0100 (Tue, 24 Jun 2008) | 2 lines Fix cosmetic typo in string constant. ................ r10574 | wsfulton | 2008-06-24 21:10:28 +0100 (Tue, 24 Jun 2008) | 1 line zap last entry ................ r10575 | wsfulton | 2008-06-24 21:11:46 +0100 (Tue, 24 Jun 2008) | 1 line variable name changes to remove php keywords ................ r10576 | wsfulton | 2008-06-24 21:12:08 +0100 (Tue, 24 Jun 2008) | 1 line variable name hiding fix ................ r10577 | wsfulton | 2008-06-24 21:12:43 +0100 (Tue, 24 Jun 2008) | 1 line More info about numobjects added ................ r10578 | wsfulton | 2008-06-24 21:13:41 +0100 (Tue, 24 Jun 2008) | 1 line update for 1.3.36 release ................ r10579 | wsfulton | 2008-06-24 22:48:46 +0100 (Tue, 24 Jun 2008) | 1 line remove deprecated -c commandline option (runtime library generation) ................ r10580 | wsfulton | 2008-06-24 22:53:12 +0100 (Tue, 24 Jun 2008) | 1 line correct comment about deprecated option ................ r10582 | wsfulton | 2008-06-25 00:00:27 +0100 (Wed, 25 Jun 2008) | 1 line use rsync and ssh to upload releases to SourceForge as ftp no longer works ................ r10584 | wsfulton | 2008-06-25 00:24:48 +0100 (Wed, 25 Jun 2008) | 1 line correction for 1.3.36 ................ r10588 | wsfulton | 2008-06-25 01:16:04 +0100 (Wed, 25 Jun 2008) | 1 line section update ................ r10589 | wsfulton | 2008-06-25 01:16:40 +0100 (Wed, 25 Jun 2008) | 1 line bump version to 1.3.37 ................ r10594 | wsfulton | 2008-06-26 19:33:06 +0100 (Thu, 26 Jun 2008) | 1 line correct typo in first entry about %fragment ................ r10607 | wsfulton | 2008-06-29 01:19:05 +0100 (Sun, 29 Jun 2008) | 1 line fix some potential null pointer usage as reported by CoveriCoverity Prevent ................ r10608 | wsfulton | 2008-06-29 01:50:27 +0100 (Sun, 29 Jun 2008) | 1 line fix potential null pointer usage as reported by Coverity Prevent ................ r10609 | wsfulton | 2008-06-29 10:57:41 +0100 (Sun, 29 Jun 2008) | 1 line make life easier for svn status updates as everyone has different autotool versions installed - use svn:ignore on config.sub and config.guess ................ r10610 | wsfulton | 2008-06-29 11:08:14 +0100 (Sun, 29 Jun 2008) | 1 line make life easier for svn status updates as everyone has different autotool versions installed - use svn:ignore on config.sub and config.guess ................ r10616 | talby | 2008-07-01 00:41:27 +0100 (Tue, 01 Jul 2008) | 2 lines Hopefully this provides more portable values for Infinity and NaN in Perl. ................ r10621 | wsfulton | 2008-07-01 23:02:14 +0100 (Tue, 01 Jul 2008) | 1 line update old commandline option ................ r10624 | olly | 2008-07-02 04:17:46 +0100 (Wed, 02 Jul 2008) | 5 lines [Python] Import the C extension differently for Python 2.6 and later so that an implicit relative import doesn't produce a deprecation warning for 2.6 and a failure for 2.7 and later. Patch from Richard Boulton in SF#2008229. ................ r10625 | bhy | 2008-07-02 05:56:11 +0100 (Wed, 02 Jul 2008) | 1 line fix the relative import patch by try both relative and absolute import ................ r10626 | olly | 2008-07-02 06:55:18 +0100 (Wed, 02 Jul 2008) | 4 lines [PHP4] Support for PHP4 has been removed. The PHP developers are no longer making new PHP4 releases, and won't even be patching critical security issues after 2008-08-08. ................ r10627 | bhy | 2008-07-02 07:06:56 +0100 (Wed, 02 Jul 2008) | 1 line fix the previous commit -- new approach using imp module ................ r10628 | bhy | 2008-07-02 07:29:15 +0100 (Wed, 02 Jul 2008) | 1 line minor fix on relative import: close fp if exception occured during imp.find_module ................ r10629 | bhy | 2008-07-02 08:08:00 +0100 (Wed, 02 Jul 2008) | 1 line reconstruct the relative import, now the generated code looks better ................ r10633 | olly | 2008-07-03 01:09:56 +0100 (Thu, 03 Jul 2008) | 9 lines WARN_* constants are user visible, so keep existing WARN_PHP4_* for backward compatibility, but add preferred forms WARN_PHP_* and use these ourselves. Rename Lib/php4 to Lib/php, Source/Modules/php4.cxx to Source/Modules/php.cxx. Add typemaps for const reference so Examples/test-suite/apply_signed_char.i works. ................ r10634 | olly | 2008-07-03 01:12:58 +0100 (Thu, 03 Jul 2008) | 2 lines Remove file added in error. ................ r10635 | olly | 2008-07-03 01:37:38 +0100 (Thu, 03 Jul 2008) | 2 lines Rename php4*.swg to php*.swg. ................ r10636 | olly | 2008-07-03 02:13:51 +0100 (Thu, 03 Jul 2008) | 2 lines Update wrt PHP4. ................ r10637 | olly | 2008-07-03 03:32:11 +0100 (Thu, 03 Jul 2008) | 4 lines [PHP] The deprecated command line option "-phpfull" has been removed. We recommend building your extension as a dynamically loadable module. ................ r10638 | olly | 2008-07-03 03:32:41 +0100 (Thu, 03 Jul 2008) | 2 lines Fix version number ................ r10639 | olly | 2008-07-03 07:04:24 +0100 (Thu, 03 Jul 2008) | 2 lines Make t_output_helper() static. ................ r10640 | olly | 2008-07-03 07:05:34 +0100 (Thu, 03 Jul 2008) | 2 lines Make testcase li_typemaps work for PHP. ................ r10641 | olly | 2008-07-03 10:12:16 +0100 (Thu, 03 Jul 2008) | 2 lines Fix check::classname() to compare case-insensitively and not try to interpolate objects into strings. ................ r10643 | olly | 2008-07-03 23:00:01 +0100 (Thu, 03 Jul 2008) | 4 lines The operator& trick in allowexcept.i doesn't work for SWIG/PHP because the generated code takes the address of the variable in the code in the "vinit" section. So comment out the private operator& for PHP. ................ r10647 | olly | 2008-07-04 00:55:33 +0100 (Fri, 04 Jul 2008) | 2 lines [PHP] The SWIG cdata.i library module is now supported. ................ r10649 | olly | 2008-07-04 02:02:22 +0100 (Fri, 04 Jul 2008) | 4 lines [PHP] The deprecated command line option "-make" has been removed. Searches on Google codesearch suggest that nobody is using it now anyway. ................ r10650 | olly | 2008-07-04 02:22:11 +0100 (Fri, 04 Jul 2008) | 4 lines [PHP] For std_vector.i and std_map.i, rename empty() to is_empty() since "empty" is a PHP reserved word. Based of patch from Mark Klein in SF#1943417. ................ r10662 | wsfulton | 2008-07-14 22:09:23 +0100 (Mon, 14 Jul 2008) | 1 line Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods ................ r10672 | olly | 2008-07-17 02:17:08 +0100 (Thu, 17 Jul 2008) | 2 lines Fix a typo; improve wording. ................ r10676 | wsfulton | 2008-07-17 22:05:49 +0100 (Thu, 17 Jul 2008) | 1 line SF #2019156 Configuring with --without-octave or --without-alllang did not disable octave. ................ r10677 | wsfulton | 2008-07-17 22:08:22 +0100 (Thu, 17 Jul 2008) | 1 line tidy output after detecting X11 headers ................ r10682 | wsfulton | 2008-07-19 19:08:06 +0100 (Sat, 19 Jul 2008) | 1 line a bit more on pgcpp ................ r10683 | wsfulton | 2008-07-19 23:45:54 +0100 (Sat, 19 Jul 2008) | 1 line Fix building of Tcl examples/test-suite on Mac OSX ................ r10714 | olly | 2008-07-27 13:51:16 +0100 (Sun, 27 Jul 2008) | 2 lines Fix "can can" typo in docs (SF#2026756) ................ r10726 | wuzzeb | 2008-08-02 09:28:02 +0100 (Sat, 02 Aug 2008) | 1 line Commit patch 2019314 ................ r10727 | wuzzeb | 2008-08-02 09:49:43 +0100 (Sat, 02 Aug 2008) | 1 line add assert.h to fix chicken build of external runtime (ext_test testsuite) ................ r10738 | talby | 2008-08-07 07:28:13 +0100 (Thu, 07 Aug 2008) | 2 lines hoist globals to local scope where trival. ................ r10743 | talby | 2008-08-08 04:10:55 +0100 (Fri, 08 Aug 2008) | 2 lines initial steps to clean up perl5 class methods (primarily constructors). ................ r10747 | talby | 2008-08-09 05:08:26 +0100 (Sat, 09 Aug 2008) | 2 lines moves perl space constructor fixups into wrapper code. ................ r10749 | talby | 2008-08-10 00:57:55 +0100 (Sun, 10 Aug 2008) | 2 lines usage_func() fix + CHANGES.current entry to explain my past few commits. ................ r10794 | talby | 2008-08-19 08:09:29 +0100 (Tue, 19 Aug 2008) | 3 lines rollback 10737:10749, this work is better left on a branch until it is in support a significant feature enhancement. ................ r10801 | drjoe | 2008-08-31 17:07:43 +0100 (Sun, 31 Aug 2008) | 2 lines change Rf_warning to warning. Looks like a typo ................ r10802 | wsfulton | 2008-09-01 20:59:23 +0100 (Mon, 01 Sep 2008) | 1 line Fix ruby detection problem breaking configure ................ r10803 | wsfulton | 2008-09-01 21:00:28 +0100 (Mon, 01 Sep 2008) | 1 line Fix another perl global namespace pollution ................ r10804 | wsfulton | 2008-09-01 21:32:53 +0100 (Mon, 01 Sep 2008) | 1 line Fix array bounds checking in C# std::vector wrappers ................ r10805 | wsfulton | 2008-09-01 21:34:49 +0100 (Mon, 01 Sep 2008) | 1 line fix runtime problem in Ruby std_vector example ................ r10806 | wsfulton | 2008-09-01 21:42:40 +0100 (Mon, 01 Sep 2008) | 1 line Fix portability problem using /dev/null ................ r10807 | wsfulton | 2008-09-01 22:46:41 +0100 (Mon, 01 Sep 2008) | 1 line patch #2079381 submitted by Boris Smilga - constant exprs put into no-eval context in DEFCENUM ................ r10808 | wsfulton | 2008-09-02 21:56:52 +0100 (Tue, 02 Sep 2008) | 1 line Add new terminator attribute for the csin typemap for C# ................ r10809 | wsfulton | 2008-09-03 00:01:37 +0100 (Wed, 03 Sep 2008) | 1 line Fix #1988296 - Multiple module director linking issue ................ r10827 | richardb | 2008-09-10 11:08:21 +0100 (Wed, 10 Sep 2008) | 6 lines [Python] Commit patch #2089149: Director exception handling mangles returned exception. Exceptions raised by Python code in directors are now passed through to the caller without change. Also, remove the ": " prefix which used to be added to other director exceptions (eg, those due to incorrect return types). ................ r10828 | bhy | 2008-09-10 11:45:33 +0100 (Wed, 10 Sep 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-10827" from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ r10829 | bhy | 2008-09-10 12:04:09 +0100 (Wed, 10 Sep 2008) | 4 lines Removed merge tracking for "svnmerge" for https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy (Undo the init due to user error) ................ r10830 | bhy | 2008-09-10 12:08:16 +0100 (Wed, 10 Sep 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-10403" from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ r10831 | bhy | 2008-09-10 12:51:12 +0100 (Wed, 10 Sep 2008) | 11 lines (Still trying to set right properity to get svnmerge work...) Recorded merge of revisions 10404 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ........ r10404 | bhy | 2008-05-01 08:35:49 +0800 (Thu, 01 May 2008) | 5 lines Start of gsoc2008-bhy branch. This is a branch for Haoyu Bai's Python 3.0 backend project. Some file already modified since a little of work already done when starting the branch. ........ ................ r10834 | bhy | 2008-09-11 18:18:07 +0100 (Thu, 11 Sep 2008) | 8 lines Merged the Python 3.0 support branch. The merging progress is not so smooth, so hope this commit won't make anything broken. This is the (incomplemete) log produced by svnmerge.py: Merged revisions 10405-10409,10420-10422,10426,10438,10445,10451,10454-10465,10467,10473-10475,10485,10488-10489,10493-10495,10497,10509-10510,10513-10514,10517,10520,10525,10528-10529,10533-10535,10554-10557,10570,10573,10593,10614,10666-10669,10673,10678,10687,10690,10704-10706,10731,10744,10750-10752,10755,10759,10770,10775-10776,10813,10819 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10837 626c5289-ae23-0410-ae9c-e8d60b6d4f22
1214 lines
44 KiB
C++
1214 lines
44 KiB
C++
/* -----------------------------------------------------------------------------
|
|
* See the LICENSE file for information on copyright, usage and redistribution
|
|
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
|
*
|
|
* lua.cxx
|
|
*
|
|
* Lua language module for SWIG.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
/* NEW LANGUAGE NOTE:
|
|
* ver001
|
|
this is simply a copy of tcl8.cxx, which has been renamed
|
|
* ver002
|
|
all non essential code commented out, program now does virtually nothing
|
|
it prints to stderr the list of functions to wrap, but does not create
|
|
the XXX_wrap.c file
|
|
* ver003
|
|
added back top(), still prints the list of fns to stderr
|
|
but now creates a rather empty XXX_wrap.c with some basic boilerplate code
|
|
* ver004
|
|
very basic version of functionWrapper()
|
|
also uncommented usage_string() to keep compiler happy
|
|
this will start producing proper looking code soon (I hope)
|
|
produced the wrapper code, but without any type conversion (in or out)
|
|
generates a few warning because of no wrappering
|
|
does not generate SWIG_init()
|
|
reason for this is that lua.swg is empty
|
|
we will need to add code into this to make it work
|
|
* ver005/6
|
|
massive rework, basing work on the pike module instead of tcl
|
|
(pike module it only 1/3 of the size)(though not as complete)
|
|
* ver007
|
|
added simple type checking
|
|
* ver008
|
|
INPUT, OUTPUT, INOUT typemaps handled (though not all types yet)
|
|
* ver009
|
|
class support: ok for basic types, but methods still TDB
|
|
(code is VERY messed up & needs to be cleaned)
|
|
|
|
|
|
*/
|
|
|
|
char cvsroot_lua_cxx[] = "$Id$";
|
|
|
|
#include "swigmod.h"
|
|
|
|
/**** Diagnostics:
|
|
With the #define REPORT(), you can change the amount of diagnostics given
|
|
This helps me search the parse tree & figure out what is going on inside SWIG
|
|
(because its not clear or documented)
|
|
*/
|
|
#define REPORT(T,D) // no info:
|
|
//#define REPORT(T,D) {Printf(stdout,T"\n");} // only title
|
|
//#define REPORT(T,D) {Printf(stdout,T" %p\n",n);} // title & pointer
|
|
//#define REPORT(T,D) {Printf(stdout,T"\n");display_mapping(D);} // the works
|
|
//#define REPORT(T,D) {Printf(stdout,T"\n");if(D)Swig_print_node(D);} // the works
|
|
|
|
void display_mapping(DOH *d) {
|
|
if (d == 0 || !DohIsMapping(d))
|
|
return;
|
|
for (DohIterator it = DohFirst(d); it.item; it = DohNext(it)) {
|
|
if (DohIsString(it.item))
|
|
Printf(stdout, " %s = %s\n", it.key, it.item);
|
|
else if (DohIsMapping(it.item))
|
|
Printf(stdout, " %s = <mapping>\n", it.key);
|
|
else if (DohIsSequence(it.item))
|
|
Printf(stdout, " %s = <sequence>\n", it.key);
|
|
else
|
|
Printf(stdout, " %s = <unknown>\n", it.key);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
most of the default options are handled by SWIG
|
|
you can add new ones here
|
|
(though for now I have not bothered)
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
static const char *usage = (char *) "\
|
|
Lua Options (available with -lua)\n\
|
|
(coming soon.)\n\n";
|
|
|
|
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
To add a new language, you need to derive your class from
|
|
Language and the overload various virtual functions
|
|
(more on this as I figure it out)
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
|
|
class LUA:public Language {
|
|
private:
|
|
|
|
File *f_runtime;
|
|
File *f_header;
|
|
File *f_wrappers;
|
|
File *f_init;
|
|
File *f_initbeforefunc;
|
|
String *PrefixPlusUnderscore;
|
|
String *s_cmd_tab; // table of command names
|
|
String *s_var_tab; // table of global variables
|
|
String *s_const_tab; // table of global constants
|
|
String *s_methods_tab; // table of class methods
|
|
String *s_attr_tab; // table of class atributes
|
|
String *s_luacode; // luacode to be called during init
|
|
|
|
int have_constructor;
|
|
int have_destructor;
|
|
String *destructor_action;
|
|
String *class_name;
|
|
String *constructor_name;
|
|
|
|
enum {
|
|
NO_CPP,
|
|
VARIABLE,
|
|
MEMBER_FUNC,
|
|
CONSTRUCTOR,
|
|
DESTRUCTOR,
|
|
MEMBER_VAR,
|
|
CLASS_CONST,
|
|
STATIC_FUNC,
|
|
STATIC_VAR
|
|
}current;
|
|
|
|
public:
|
|
|
|
/* ---------------------------------------------------------------------
|
|
* LUA()
|
|
*
|
|
* Initialize member data
|
|
* --------------------------------------------------------------------- */
|
|
|
|
LUA() {
|
|
f_runtime = 0;
|
|
f_header = 0;
|
|
f_wrappers = 0;
|
|
f_init = 0;
|
|
f_initbeforefunc = 0;
|
|
PrefixPlusUnderscore = 0;
|
|
|
|
s_cmd_tab = s_var_tab = s_const_tab = s_luacode = 0;
|
|
current=NO_CPP;
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
This is called to initalise the system & read any command line args
|
|
most of this is boilerplate code, except the command line args
|
|
which depends upon what args your code supports
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
|
|
/* ---------------------------------------------------------------------
|
|
* main()
|
|
*
|
|
* Parse command line options and initializes variables.
|
|
* --------------------------------------------------------------------- */
|
|
|
|
virtual void main(int argc, char *argv[]) {
|
|
|
|
/* Set location of SWIG library */
|
|
SWIG_library_directory("lua");
|
|
|
|
/* Look for certain command line options */
|
|
for (int i = 1; i < argc; i++) {
|
|
if (argv[i]) {
|
|
if (strcmp(argv[i], "-help") == 0) { // usage flags
|
|
fputs(usage, stderr);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
This is the boilerplate code, setting a few #defines
|
|
and which lib directory to use
|
|
the SWIG_library_directory() is also boilerplate code
|
|
but it always seems to be the first line of code
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* Add a symbol to the parser for conditional compilation */
|
|
Preprocessor_define("SWIGLUA 1", 0);
|
|
|
|
/* Set language-specific configuration file */
|
|
SWIG_config_file("lua.swg");
|
|
|
|
/* Set typemap language */
|
|
SWIG_typemap_lang("lua");
|
|
|
|
/* Enable overloaded methods support */
|
|
allow_overloading();
|
|
}
|
|
|
|
|
|
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
After calling main, SWIG parses the code to wrap (I believe)
|
|
then calls top()
|
|
in this is more boilerplate code to set everything up
|
|
and a call to Language::top()
|
|
which begins the code generations by calling the member fns
|
|
after all that is more boilerplate code to close all down
|
|
(overall there is virtually nothing here that needs to be edited
|
|
just use as is)
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* ---------------------------------------------------------------------
|
|
* top()
|
|
* --------------------------------------------------------------------- */
|
|
|
|
virtual int top(Node *n) {
|
|
/* Get the module name */
|
|
String *module = Getattr(n, "name");
|
|
|
|
/* Get the output file name */
|
|
String *outfile = Getattr(n, "outfile");
|
|
|
|
/* Open the output file */
|
|
f_runtime = NewFile(outfile, "w");
|
|
if (!f_runtime) {
|
|
FileErrorDisplay(outfile);
|
|
SWIG_exit(EXIT_FAILURE);
|
|
}
|
|
f_init = NewString("");
|
|
f_header = NewString("");
|
|
f_wrappers = NewString("");
|
|
f_initbeforefunc = NewString("");
|
|
|
|
/* Register file targets with the SWIG file handler */
|
|
Swig_register_filebyname("header", f_header);
|
|
Swig_register_filebyname("wrapper", f_wrappers);
|
|
Swig_register_filebyname("runtime", f_runtime);
|
|
Swig_register_filebyname("init", f_init);
|
|
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
s_cmd_tab,s_var_tab & s_const_tab hold the names of the fns for
|
|
registering with SWIG.
|
|
These will be filled in when the functions/variables are wrapped &
|
|
then added to the end of the wrappering code
|
|
just before it is written to file
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
// Initialize some variables for the object interface
|
|
s_cmd_tab = NewString("");
|
|
s_var_tab = NewString("");
|
|
// s_methods_tab = NewString("");
|
|
s_const_tab = NewString("");
|
|
|
|
s_luacode = NewString("");
|
|
Swig_register_filebyname("luacode", s_luacode);
|
|
|
|
current=NO_CPP;
|
|
|
|
/* Standard stuff for the SWIG runtime section */
|
|
Swig_banner(f_runtime);
|
|
// if (NoInclude) {
|
|
// Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
|
|
// }
|
|
|
|
//String *init_name = NewStringf("%(title)s_Init", module);
|
|
//Printf(f_header, "#define SWIG_init %s\n", init_name);
|
|
//Printf(f_header, "#define SWIG_name \"%s\"\n", module);
|
|
/* SWIG_import is a special function name for importing within Lua5.1 */
|
|
//Printf(f_header, "#define SWIG_import luaopen_%s\n\n", module);
|
|
Printf(f_header, "#define SWIG_name \"%s\"\n", module);
|
|
Printf(f_header, "#define SWIG_init luaopen_%s\n", module);
|
|
Printf(f_header, "#define SWIG_init_user luaopen_%s_user\n\n", module);
|
|
Printf(f_header, "#define SWIG_LUACODE luaopen_%s_luacode\n\n", module);
|
|
|
|
Printf(s_cmd_tab, "\nstatic const struct luaL_reg swig_commands[] = {\n");
|
|
Printf(s_var_tab, "\nstatic swig_lua_var_info swig_variables[] = {\n");
|
|
Printf(s_const_tab, "\nstatic swig_lua_const_info swig_constants[] = {\n");
|
|
Printf(f_wrappers, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
|
|
|
|
/* %init code inclusion, effectively in the SWIG_init function */
|
|
Printf(f_init, "void SWIG_init_user(lua_State* L)\n{\n");
|
|
Language::top(n);
|
|
Printf(f_init,"/* exec Lua code if applicable */\nSWIG_Lua_dostring(L,SWIG_LUACODE);\n");
|
|
Printf(f_init, "}\n");
|
|
|
|
Printf(f_wrappers, "#ifdef __cplusplus\n}\n#endif\n");
|
|
|
|
// Done. Close up the module & write to the wrappers
|
|
Printv(s_cmd_tab, tab4, "{0,0}\n", "};\n", NIL);
|
|
Printv(s_var_tab, tab4, "{0,0,0}\n", "};\n", NIL);
|
|
Printv(s_const_tab, tab4, "{0,0,0,0,0,0}\n", "};\n", NIL);
|
|
Printv(f_wrappers, s_cmd_tab, s_var_tab, s_const_tab, NIL);
|
|
SwigType_emit_type_table(f_runtime, f_wrappers);
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
this basically combines several of the strings together
|
|
and then writes it all to a file
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
Dump(f_header, f_runtime);
|
|
Dump(f_wrappers, f_runtime);
|
|
Dump(f_initbeforefunc, f_runtime);
|
|
/* for the Lua code it needs to be properly excaped to be added into the C/C++ code */
|
|
EscapeCode(s_luacode);
|
|
Printf(f_runtime, "const char* SWIG_LUACODE=\n \"%s\";\n\n",s_luacode);
|
|
Wrapper_pretty_print(f_init, f_runtime);
|
|
/* Close all of the files */
|
|
Delete(s_luacode);
|
|
Delete(s_cmd_tab);
|
|
Delete(s_var_tab);
|
|
Delete(s_const_tab);
|
|
Delete(f_header);
|
|
Delete(f_wrappers);
|
|
Delete(f_init);
|
|
Delete(f_initbeforefunc);
|
|
Close(f_runtime);
|
|
Delete(f_runtime);
|
|
|
|
/* Done */
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* importDirective()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int importDirective(Node *n) {
|
|
return Language::importDirective(n);
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
This is it!
|
|
you get this one right, and most of your work is done
|
|
but its going to take soem file to get it working right
|
|
quite a bit of this is generally boilerplate code
|
|
(or stuff I dont understand)
|
|
that which matters will have extra added comments
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* ---------------------------------------------------------------------
|
|
* functionWrapper()
|
|
*
|
|
* Create a function declaration and register it with the interpreter.
|
|
* --------------------------------------------------------------------- */
|
|
|
|
virtual int functionWrapper(Node *n) {
|
|
REPORT("functionWrapper",n);
|
|
|
|
String *name = Getattr(n, "name");
|
|
String *iname = Getattr(n, "sym:name");
|
|
SwigType *d = Getattr(n, "type");
|
|
ParmList *l = Getattr(n, "parms");
|
|
//Printf(stdout,"functionWrapper %s %s\n",name,iname);
|
|
Parm *p;
|
|
String *tm;
|
|
int i;
|
|
//Printf(stdout,"functionWrapper %s %s %d\n",name,iname,current);
|
|
// int returnval=0; // number of arguments returned
|
|
|
|
String *overname = 0;
|
|
if (Getattr(n, "sym:overloaded")) {
|
|
overname = Getattr(n, "sym:overname");
|
|
} else {
|
|
if (!addSymbol(iname, n)) {
|
|
Printf(stderr,"addSymbol(%s) failed\n",iname);
|
|
return SWIG_ERROR;
|
|
}
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
the wrapper object holds all the wrappering code
|
|
we need to add a couple of local variables
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
Wrapper *f = NewWrapper();
|
|
Wrapper_add_local(f, "SWIG_arg", "int SWIG_arg = 0");
|
|
|
|
|
|
String *wname = Swig_name_wrapper(iname);
|
|
if (overname) {
|
|
Append(wname, overname);
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
the format of a lua fn is:
|
|
static int wrap_XXX(lua_State* L){...}
|
|
this line adds this into the wrappering code
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
Printv(f->def, "static int ", wname, "(lua_State* L) {", NIL);
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
this prints the list of args, eg for a C fn
|
|
int gcd(int x,int y);
|
|
it will print
|
|
int arg1;
|
|
int arg2;
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* Write code to extract function parameters. */
|
|
emit_parameter_variables(l, f);
|
|
|
|
/* Attach the standard typemaps */
|
|
emit_attach_parmmaps(l, f);
|
|
Setattr(n, "wrap:parms", l);
|
|
|
|
/* Get number of required and total arguments */
|
|
int num_arguments = emit_num_arguments(l);
|
|
int num_required = emit_num_required(l);
|
|
int varargs = emit_isvarargs(l);
|
|
|
|
// Check if we have to ignore arguments that are passed by LUA.
|
|
// Needed for unary minus, where lua passes two arguments and
|
|
// we have to ignore the second.
|
|
|
|
int args_to_ignore = 0;
|
|
if (Getattr(n, "lua:ignore_args")) {
|
|
args_to_ignore = GetInt(n, "lua:ignore_args");
|
|
}
|
|
|
|
|
|
/* Which input argument to start with? */
|
|
// int start = (current == MEMBER_FUNC || current == MEMBER_VAR || current == DESTRUCTOR) ? 1 : 0;
|
|
|
|
/* Offset to skip over the attribute name */
|
|
// int offset = (current == MEMBER_VAR) ? 1 : 0;
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
from here on in, it gets rather hairy
|
|
this is the code to convert from the scripting language to C/C++
|
|
some of the stuff will refer to the typemaps code written in your swig file
|
|
(lua.swg), and some is done in the code here
|
|
I suppose you could do all the conversion on C, but it would be a nightmare to do
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* Generate code for argument marshalling */
|
|
// String *description = NewString("");
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
argument_check is a new feature I added to check types of arguments:
|
|
eg for int gcd(int,int)
|
|
I want to check that arg1 & arg2 really are integers
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
String *argument_check = NewString("");
|
|
String *argument_parse = NewString("");
|
|
String *checkfn = NULL;
|
|
// String *numoutputs=NULL;
|
|
char source[64];
|
|
//Printf(argument_check, "SWIG_check_num_args(\"%s\",%d,%d)\n",name,num_required,num_arguments);
|
|
Printf(argument_check, "SWIG_check_num_args(\"%s\",%d,%d)\n",name,num_required+args_to_ignore,num_arguments+args_to_ignore);
|
|
|
|
for (i = 0, p = l; i < num_arguments; i++) {
|
|
|
|
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
|
|
p = Getattr(p, "tmap:in:next");
|
|
}
|
|
|
|
SwigType *pt = Getattr(p, "type");
|
|
String *ln = Getattr(p, "lname");
|
|
|
|
/* Look for an input typemap */
|
|
sprintf(source, "%d", i + 1);
|
|
if ((tm = Getattr(p, "tmap:in"))) {
|
|
Replaceall(tm, "$source", source);
|
|
Replaceall(tm, "$target", ln);
|
|
Replaceall(tm, "$input", source);
|
|
Setattr(p, "emit:input", source);
|
|
if (Getattr(p, "wrap:disown") || (Getattr(p, "tmap:in:disown"))) {
|
|
Replaceall(tm, "$disown", "SWIG_POINTER_DISOWN");
|
|
} else {
|
|
Replaceall(tm, "$disown", "0");
|
|
}
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
look for a 'checkfn' typemap
|
|
this an additional parameter added to the in typemap
|
|
if found the type will be tested for
|
|
this will result in code either in the
|
|
argument_check or argument_parse string
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
if ((checkfn = Getattr(p, "tmap:in:checkfn"))) {
|
|
if (i < num_required) {
|
|
Printf(argument_check, "if(!%s(L,%s))", checkfn, source);
|
|
} else {
|
|
Printf(argument_check, "if(lua_gettop(L)>=%s && !%s(L,%s))", source, checkfn, source);
|
|
}
|
|
Printf(argument_check, " SWIG_fail_arg(\"%s\",%s,\"%s\");\n", name, source, SwigType_str(pt, 0));
|
|
}
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
lua states the number of arguments passed to a function using the fn
|
|
lua_gettop()
|
|
we can use this to deal with default arguments
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
if (i < num_required) {
|
|
Printf(argument_parse, "%s\n", tm);
|
|
} else {
|
|
Printf(argument_parse, "if(lua_gettop(L)>=%s){%s}\n", source, tm);
|
|
}
|
|
p = Getattr(p, "tmap:in:next");
|
|
continue;
|
|
} else {
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
// why is this code not called when I dont have a typemap?
|
|
// instead of giving a warning, no code is generated
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
|
|
break;
|
|
}
|
|
}
|
|
|
|
// add all argcheck code
|
|
Printv(f->code, argument_check, argument_parse, NIL);
|
|
|
|
/* Check for trailing varargs */
|
|
if (varargs) {
|
|
if (p && (tm = Getattr(p, "tmap:in"))) {
|
|
Replaceall(tm, "$input", "varargs");
|
|
Printv(f->code, tm, "\n", NIL);
|
|
}
|
|
}
|
|
|
|
/* Insert constraint checking code */
|
|
for (p = l; p;) {
|
|
if ((tm = Getattr(p, "tmap:check"))) {
|
|
Replaceall(tm, "$target", Getattr(p, "lname"));
|
|
Printv(f->code, tm, "\n", NIL);
|
|
p = Getattr(p, "tmap:check:next");
|
|
} else {
|
|
p = nextSibling(p);
|
|
}
|
|
}
|
|
|
|
/* Insert cleanup code */
|
|
String *cleanup = NewString("");
|
|
for (p = l; p;) {
|
|
if ((tm = Getattr(p, "tmap:freearg"))) {
|
|
Replaceall(tm, "$source", Getattr(p, "lname"));
|
|
Printv(cleanup, tm, "\n", NIL);
|
|
p = Getattr(p, "tmap:freearg:next");
|
|
} else {
|
|
p = nextSibling(p);
|
|
}
|
|
}
|
|
|
|
/* Insert argument output code */
|
|
String *outarg = NewString("");
|
|
for (p = l; p;) {
|
|
if ((tm = Getattr(p, "tmap:argout"))) {
|
|
// // managing the number of returning variables
|
|
// if (numoutputs=Getattr(p,"tmap:argout:numoutputs")){
|
|
// int i=GetInt(p,"tmap:argout:numoutputs");
|
|
// printf("got argout:numoutputs of %d\n",i);
|
|
// returnval+=GetInt(p,"tmap:argout:numoutputs");
|
|
// }
|
|
// else returnval++;
|
|
Replaceall(tm, "$source", Getattr(p, "lname"));
|
|
Replaceall(tm, "$target", "result");
|
|
Replaceall(tm, "$arg", Getattr(p, "emit:input"));
|
|
Replaceall(tm, "$input", Getattr(p, "emit:input"));
|
|
Printv(outarg, tm, "\n", NIL);
|
|
p = Getattr(p, "tmap:argout:next");
|
|
} else {
|
|
p = nextSibling(p);
|
|
}
|
|
}
|
|
|
|
Setattr(n, "wrap:name", wname);
|
|
|
|
/* Emit the function call */
|
|
String *actioncode = emit_action(n);
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
FIXME:
|
|
returns 1 if there is a void return type
|
|
this is because there is a typemap for void
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
// Return value if necessary
|
|
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
|
// managing the number of returning variables
|
|
// if (numoutputs=Getattr(tm,"numoutputs")){
|
|
// int i=GetInt(tm,"numoutputs");
|
|
// printf("return numoutputs %d\n",i);
|
|
// returnval+=GetInt(tm,"numoutputs");
|
|
// }
|
|
// else returnval++;
|
|
Replaceall(tm, "$source", "result");
|
|
if (GetFlag(n, "feature:new")) {
|
|
Replaceall(tm, "$owner", "1");
|
|
} else {
|
|
Replaceall(tm, "$owner", "0");
|
|
}
|
|
Printf(f->code, "%s\n", tm);
|
|
// returnval++;
|
|
} else {
|
|
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), name);
|
|
}
|
|
emit_return_variable(n, d, f);
|
|
|
|
/* Output argument output code */
|
|
Printv(f->code, outarg, NIL);
|
|
|
|
/* Output cleanup code */
|
|
Printv(f->code, cleanup, NIL);
|
|
|
|
/* Look to see if there is any newfree cleanup code */
|
|
if (GetFlag(n, "feature:new")) {
|
|
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
|
Replaceall(tm, "$source", "result");
|
|
Printf(f->code, "%s\n", tm);
|
|
}
|
|
}
|
|
|
|
/* See if there is any return cleanup code */
|
|
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
|
Replaceall(tm, "$source", "result");
|
|
Printf(f->code, "%s\n", tm);
|
|
}
|
|
|
|
|
|
/* Close the function */
|
|
Printv(f->code, "return SWIG_arg;\n", NIL);
|
|
// add the failure cleanup code:
|
|
Printv(f->code, "\nif(0) SWIG_fail;\n", NIL);
|
|
Printv(f->code, "\nfail:\n", NIL);
|
|
Printv(f->code, "$cleanup", "lua_error(L);\n", NIL);
|
|
Printv(f->code, "return SWIG_arg;\n", NIL);
|
|
Printf(f->code, "}\n");
|
|
|
|
/* Substitute the cleanup code */
|
|
Replaceall(f->code, "$cleanup", cleanup);
|
|
|
|
/* Substitute the function name */
|
|
Replaceall(f->code, "$symname", iname);
|
|
Replaceall(f->code, "$result", "result");
|
|
|
|
/* Dump the function out */
|
|
/* in Lua we will not emit the destructor as a wrappered function,
|
|
Lua will automatically call the destructor when the object is free'd
|
|
However: you cannot just skip this function as it will not emit
|
|
any custom destructor (using %extend), as you need to call emit_action()
|
|
Therefore we go though the whole function,
|
|
but do not write the code into the wrapper
|
|
*/
|
|
if(current!=DESTRUCTOR) {
|
|
Wrapper_print(f, f_wrappers);
|
|
}
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
register the function in SWIG
|
|
different language mappings seem to use different ideas
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
/* Now register the function with the interpreter. */
|
|
if (!Getattr(n, "sym:overloaded")) {
|
|
// add_method(n, iname, wname, description);
|
|
if (current==NO_CPP || current==STATIC_FUNC) // emit normal fns & static fns
|
|
Printv(s_cmd_tab, tab4, "{ \"", iname, "\", ", Swig_name_wrapper(iname), "},\n", NIL);
|
|
// Printv(s_cmd_tab, tab4, "{ SWIG_prefix \"", iname, "\", (swig_wrapper_func) ", Swig_name_wrapper(iname), "},\n", NIL);
|
|
} else {
|
|
if (!Getattr(n, "sym:nextSibling")) {
|
|
dispatchFunction(n);
|
|
}
|
|
}
|
|
|
|
Delete(argument_check);
|
|
Delete(argument_parse);
|
|
|
|
Delete(cleanup);
|
|
Delete(outarg);
|
|
// Delete(description);
|
|
Delete(wname);
|
|
DelWrapper(f);
|
|
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* dispatchFunction()
|
|
*
|
|
* Emit overloading dispatch function
|
|
* ------------------------------------------------------------ */
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
This is an extra function used for overloading of functions
|
|
it checks the args & then calls the relevant fn
|
|
nost of the real work in again typemaps:
|
|
look for %typecheck(SWIG_TYPECHECK_*) in the .swg file
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
void dispatchFunction(Node *n) {
|
|
/* Last node in overloaded chain */
|
|
|
|
int maxargs;
|
|
String *tmp = NewString("");
|
|
String *dispatch = Swig_overload_dispatch(n, "return %s(L);", &maxargs);
|
|
|
|
/* Generate a dispatch wrapper for all overloaded functions */
|
|
|
|
Wrapper *f = NewWrapper();
|
|
String *symname = Getattr(n, "sym:name");
|
|
String *wname = Swig_name_wrapper(symname);
|
|
|
|
//Printf(stdout,"Swig_overload_dispatch %s %s '%s' %d\n",symname,wname,dispatch,maxargs);
|
|
|
|
Printv(f->def, "static int ", wname, "(lua_State* L) {", NIL);
|
|
Wrapper_add_local(f, "argc", "int argc");
|
|
Printf(tmp, "int argv[%d]={1", maxargs + 1);
|
|
for (int i = 1; i <= maxargs; i++) {
|
|
Printf(tmp, ",%d", i + 1);
|
|
}
|
|
Printf(tmp, "}");
|
|
Wrapper_add_local(f, "argv", tmp);
|
|
Printf(f->code, "argc = lua_gettop(L);\n");
|
|
|
|
Replaceall(dispatch, "$args", "self,args");
|
|
Printv(f->code, dispatch, "\n", NIL);
|
|
|
|
Node *sibl = n;
|
|
while (Getattr(sibl, "sym:previousSibling"))
|
|
sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
|
|
String *protoTypes = NewString("");
|
|
do {
|
|
Printf(protoTypes, "\n\" %s(%s)\\n\"", SwigType_str(Getattr(sibl, "name"), 0), ParmList_protostr(Getattr(sibl, "wrap:parms")));
|
|
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
|
|
Printf(f->code, "lua_pushstring(L,\"Wrong arguments for overloaded function '%s'\\n\"\n"
|
|
"\" Possible C/C++ prototypes are:\\n\"%s);\n",symname,protoTypes);
|
|
Delete(protoTypes);
|
|
|
|
Printf(f->code, "lua_error(L);return 0;\n");
|
|
Printv(f->code, "}\n", NIL);
|
|
Wrapper_print(f, f_wrappers);
|
|
//add_method(symname,wname,0);
|
|
if (current==NO_CPP || current==STATIC_FUNC) // emit normal fns & static fns
|
|
Printv(s_cmd_tab, tab4, "{ \"", symname, "\",", wname, "},\n", NIL);
|
|
|
|
DelWrapper(f);
|
|
Delete(dispatch);
|
|
Delete(tmp);
|
|
Delete(wname);
|
|
}
|
|
|
|
|
|
/* ------------------------------------------------------------
|
|
* variableWrapper()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int variableWrapper(Node *n) {
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
Language::variableWrapper(n) will generate two wrapper fns
|
|
Foo_get & Foo_set by calling functionWrapper()
|
|
so we will just add these into the variable lists
|
|
ideally we should not have registered these as functions,
|
|
only WRT this variable will look into this later.
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
// REPORT("variableWrapper", n);
|
|
String *iname = Getattr(n, "sym:name");
|
|
current=VARIABLE;
|
|
// let SWIG generate the wrappers
|
|
int result = Language::variableWrapper(n);
|
|
current=NO_CPP;
|
|
// normally SWIG will generate 2 wrappers, a get and a set
|
|
// but in certain scenarios (immutable, or if its arrays), it will not
|
|
String *getName = Swig_name_wrapper(Swig_name_get(iname));
|
|
String *setName = 0;
|
|
// checking whether it can be set to or not appears to be a very error prone issue
|
|
// I refered to the Language::variableWrapper() to find this out
|
|
bool assignable=is_assignable(n) ? true : false;
|
|
SwigType *type = Getattr(n, "type");
|
|
String *tm = Swig_typemap_lookup("globalin", n, iname, 0);
|
|
if (!tm && SwigType_isarray(type))
|
|
assignable=false;
|
|
Delete(tm);
|
|
|
|
if (assignable) {
|
|
setName = Swig_name_wrapper(Swig_name_set(iname));
|
|
} else {
|
|
// how about calling a 'this is not settable' error message?
|
|
setName = NewString("SWIG_Lua_set_immutable"); // error message
|
|
//setName = NewString("0");
|
|
}
|
|
// register the variable
|
|
Printf(s_var_tab, "%s{ \"%s\", %s, %s },\n", tab4, iname, getName, setName);
|
|
Delete(getName);
|
|
Delete(setName);
|
|
return result;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* constantWrapper()
|
|
* ------------------------------------------------------------ */
|
|
virtual int constantWrapper(Node *n) {
|
|
// REPORT("constantWrapper", n);
|
|
String *name = Getattr(n, "name");
|
|
String *iname = Getattr(n, "sym:name");
|
|
//String *nsname = !nspace ? Copy(iname) : NewStringf("%s::%s",ns_name,iname);
|
|
String *nsname = Copy(iname);
|
|
SwigType *type = Getattr(n, "type");
|
|
String *rawval = Getattr(n, "rawval");
|
|
String *value = rawval ? rawval : Getattr(n, "value");
|
|
String *tm;
|
|
|
|
if (!addSymbol(iname, n))
|
|
return SWIG_ERROR;
|
|
//if (nspace) Setattr(n,"sym:name",nsname);
|
|
|
|
/* Special hook for member pointer */
|
|
if (SwigType_type(type) == T_MPOINTER) {
|
|
String *wname = Swig_name_wrapper(iname);
|
|
Printf(f_wrappers, "static %s = %s;\n", SwigType_str(type, wname), value);
|
|
value = Char(wname);
|
|
}
|
|
|
|
if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) {
|
|
Replaceall(tm, "$source", value);
|
|
Replaceall(tm, "$target", name);
|
|
Replaceall(tm, "$value", value);
|
|
Replaceall(tm, "$nsname", nsname);
|
|
Printf(s_const_tab, "%s,\n", tm);
|
|
} else if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) {
|
|
Replaceall(tm, "$source", value);
|
|
Replaceall(tm, "$target", name);
|
|
Replaceall(tm, "$value", value);
|
|
Replaceall(tm, "$nsname", nsname);
|
|
Printf(f_init, "%s\n", tm);
|
|
} else {
|
|
Delete(nsname);
|
|
Swig_warning(WARN_TYPEMAP_CONST_UNDEF, input_file, line_number, "Unsupported constant value.\n");
|
|
return SWIG_NOWRAP;
|
|
}
|
|
Delete(nsname);
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* nativeWrapper()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int nativeWrapper(Node *n) {
|
|
// REPORT("nativeWrapper", n);
|
|
String *symname = Getattr(n, "sym:name");
|
|
String *wrapname = Getattr(n, "wrap:name");
|
|
if (!addSymbol(wrapname, n))
|
|
return SWIG_ERROR;
|
|
|
|
Printv(s_cmd_tab, tab4, "{ \"", symname, "\",", wrapname, "},\n", NIL);
|
|
// return Language::nativeWrapper(n); // this does nothing...
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* enumDeclaration()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int enumDeclaration(Node *n) {
|
|
return Language::enumDeclaration(n);
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* enumvalueDeclaration()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int enumvalueDeclaration(Node *n) {
|
|
return Language::enumvalueDeclaration(n);
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* classDeclaration()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int classDeclaration(Node *n) {
|
|
return Language::classDeclaration(n);
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* classHandler()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int classHandler(Node *n) {
|
|
//REPORT("classHandler", n);
|
|
|
|
String *mangled_classname = 0;
|
|
String *real_classname = 0;
|
|
|
|
constructor_name = 0;
|
|
have_constructor = 0;
|
|
have_destructor = 0;
|
|
destructor_action = 0;
|
|
|
|
class_name = Getattr(n, "sym:name");
|
|
if (!addSymbol(class_name, n))
|
|
return SWIG_ERROR;
|
|
|
|
real_classname = Getattr(n, "name");
|
|
mangled_classname = Swig_name_mangle(real_classname);
|
|
|
|
// not sure exactly how this workswhat this works,
|
|
// but tcl has a static hashtable of all classes emitted and then only emits code for them once.
|
|
// this fixes issues in test suites: template_default2 & template_specialization
|
|
|
|
// * if i understand correctly, this is a bug.
|
|
// * consider effect on template_specialization_defarg
|
|
|
|
static Hash *emitted = NewHash();
|
|
if (Getattr(emitted, mangled_classname))
|
|
return SWIG_NOWRAP;
|
|
Setattr(emitted, mangled_classname, "1");
|
|
|
|
s_attr_tab = NewString("");
|
|
Printf(s_attr_tab, "static swig_lua_attribute swig_");
|
|
Printv(s_attr_tab, mangled_classname, "_attributes[] = {\n", NIL);
|
|
|
|
s_methods_tab = NewString("");
|
|
Printf(s_methods_tab, "static swig_lua_method swig_");
|
|
Printv(s_methods_tab, mangled_classname, "_methods[] = {\n", NIL);
|
|
|
|
// Generate normal wrappers
|
|
Language::classHandler(n);
|
|
|
|
SwigType *t = Copy(Getattr(n, "name"));
|
|
SwigType_add_pointer(t);
|
|
|
|
// Catch all: eg. a class with only static functions and/or variables will not have 'remembered'
|
|
String *wrap_class = NewStringf("&_wrap_class_%s", mangled_classname);
|
|
SwigType_remember_clientdata(t, wrap_class);
|
|
|
|
String *rt = Copy(Getattr(n, "classtype"));
|
|
SwigType_add_pointer(rt);
|
|
|
|
// Register the class structure with the type checker
|
|
// Printf(f_init,"SWIG_TypeClientData(SWIGTYPE%s, (void *) &_wrap_class_%s);\n", SwigType_manglestr(t), mangled_classname);
|
|
|
|
// emit a function to be called to delete the object
|
|
if (have_destructor) {
|
|
Printv(f_wrappers, "static void swig_delete_", class_name, "(void *obj) {\n", NIL);
|
|
if (destructor_action) {
|
|
Printv(f_wrappers, SwigType_str(rt, "arg1"), " = (", SwigType_str(rt, 0), ") obj;\n", NIL);
|
|
Printv(f_wrappers, destructor_action, "\n", NIL);
|
|
} else {
|
|
if (CPlusPlus) {
|
|
Printv(f_wrappers, " delete (", SwigType_str(rt, 0), ") obj;\n", NIL);
|
|
} else {
|
|
Printv(f_wrappers, " free((char *) obj);\n", NIL);
|
|
}
|
|
}
|
|
Printf(f_wrappers, "}\n");
|
|
}
|
|
|
|
Printf(s_methods_tab, " {0,0}\n};\n");
|
|
Printv(f_wrappers, s_methods_tab, NIL);
|
|
|
|
Printf(s_attr_tab, " {0,0,0}\n};\n");
|
|
Printv(f_wrappers, s_attr_tab, NIL);
|
|
|
|
Delete(s_methods_tab);
|
|
Delete(s_attr_tab);
|
|
|
|
// Handle inheritance
|
|
// note: with the idea of class hireachied spread over multiple modules
|
|
// cf test-suite: imports.i
|
|
// it is not possible to just add the pointers to the base classes to the code
|
|
// (as sometimes these classes are not present)
|
|
// therefore we instead hold the name of the base class and a null pointer
|
|
// at runtime: we can query the swig type manager & see if the class exists
|
|
// if so, we can get the pointer to the base class & replace the null pointer
|
|
// if the type does not exist, then we cannot...
|
|
String *base_class = NewString("");
|
|
String *base_class_names = NewString("");
|
|
|
|
List *baselist = Getattr(n, "bases");
|
|
if (baselist && Len(baselist)) {
|
|
Iterator b;
|
|
int index = 0;
|
|
b = First(baselist);
|
|
while (b.item) {
|
|
String *bname = Getattr(b.item, "name");
|
|
if ((!bname) || GetFlag(b.item, "feature:ignore") || (!Getattr(b.item, "module"))) {
|
|
b = Next(b);
|
|
continue;
|
|
}
|
|
// old code: (used the pointer to the base class)
|
|
//String *bmangle = Swig_name_mangle(bname);
|
|
//Printf(base_class, "&_wrap_class_%s", bmangle);
|
|
//Putc(',', base_class);
|
|
//Delete(bmangle);
|
|
// new code: stores a null pointer & the name
|
|
Printf(base_class, "0,");
|
|
Printf(base_class_names, "\"%s *\",", SwigType_namestr(bname));
|
|
|
|
b = Next(b);
|
|
index++;
|
|
}
|
|
}
|
|
|
|
Printv(f_wrappers, "static swig_lua_class *swig_", mangled_classname, "_bases[] = {", base_class, "0};\n", NIL);
|
|
Delete(base_class);
|
|
Printv(f_wrappers, "static const char *swig_", mangled_classname, "_base_names[] = {", base_class_names, "0};\n", NIL);
|
|
Delete(base_class_names);
|
|
|
|
Printv(f_wrappers, "static swig_lua_class _wrap_class_", mangled_classname, " = { \"", class_name, "\", &SWIGTYPE", SwigType_manglestr(t), ",", NIL);
|
|
|
|
if (have_constructor) {
|
|
Printf(f_wrappers, "%s", Swig_name_wrapper(Swig_name_construct(constructor_name)));
|
|
Delete(constructor_name);
|
|
constructor_name = 0;
|
|
} else {
|
|
Printf(f_wrappers, "0");
|
|
}
|
|
|
|
if (have_destructor) {
|
|
Printv(f_wrappers, ", swig_delete_", class_name, NIL);
|
|
} else {
|
|
Printf(f_wrappers, ",0");
|
|
}
|
|
Printf(f_wrappers, ", swig_%s_methods, swig_%s_attributes, swig_%s_bases, swig_%s_base_names };\n\n", mangled_classname, mangled_classname, mangled_classname, mangled_classname);
|
|
|
|
// Printv(f_wrappers, ", swig_", mangled_classname, "_methods, swig_", mangled_classname, "_attributes, swig_", mangled_classname, "_bases };\n\n", NIL);
|
|
// Printv(s_cmd_tab, tab4, "{ SWIG_prefix \"", class_name, "\", (swig_wrapper_func) SWIG_ObjectConstructor, &_wrap_class_", mangled_classname, "},\n", NIL);
|
|
Delete(t);
|
|
Delete(mangled_classname);
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* memberfunctionHandler()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int memberfunctionHandler(Node *n) {
|
|
String *name = Getattr(n, "name");
|
|
String *iname = GetChar(n, "sym:name");
|
|
//Printf(stdout,"memberfunctionHandler %s %s\n",name,iname);
|
|
|
|
// Special case unary minus: LUA passes two parameters for the
|
|
// wrapper function while we want only one. Tell our
|
|
// functionWrapper to ignore a parameter.
|
|
|
|
if (Cmp(Getattr(n, "sym:name"), "__unm") == 0) {
|
|
//Printf(stdout, "unary minus: ignore one argument\n");
|
|
SetInt(n, "lua:ignore_args", 1);
|
|
}
|
|
|
|
String *realname, *rname;
|
|
|
|
current = MEMBER_FUNC;
|
|
Language::memberfunctionHandler(n);
|
|
current = NO_CPP;
|
|
|
|
realname = iname ? iname : name;
|
|
rname = Swig_name_wrapper(Swig_name_member(class_name, realname));
|
|
if (!Getattr(n, "sym:nextSibling")) {
|
|
Printv(s_methods_tab, tab4, "{\"", realname, "\", ", rname, "}, \n", NIL);
|
|
}
|
|
Delete(rname);
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* membervariableHandler()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int membervariableHandler(Node *n) {
|
|
// REPORT("membervariableHandler",n);
|
|
String *symname = Getattr(n, "sym:name");
|
|
String *gname, *sname;
|
|
|
|
current = MEMBER_VAR;
|
|
Language::membervariableHandler(n);
|
|
current = NO_CPP;
|
|
gname = Swig_name_wrapper(Swig_name_get(Swig_name_member(class_name, symname)));
|
|
if (!GetFlag(n, "feature:immutable")) {
|
|
sname = Swig_name_wrapper(Swig_name_set(Swig_name_member(class_name, symname)));
|
|
} else {
|
|
//sname = NewString("0");
|
|
sname = NewString("SWIG_Lua_set_immutable"); // error message
|
|
}
|
|
Printf(s_attr_tab,"%s{ \"%s\", %s, %s},\n",tab4,symname,gname,sname);
|
|
Delete(gname);
|
|
Delete(sname);
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* constructorHandler()
|
|
*
|
|
* Method for adding C++ member constructor
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int constructorHandler(Node *n) {
|
|
// REPORT("constructorHandler", n);
|
|
current = CONSTRUCTOR;
|
|
Language::constructorHandler(n);
|
|
current = NO_CPP;
|
|
constructor_name = NewString(Getattr(n, "sym:name"));
|
|
have_constructor = 1;
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* destructorHandler()
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int destructorHandler(Node *n) {
|
|
REPORT("destructorHandler", n);
|
|
current = DESTRUCTOR;
|
|
Language::destructorHandler(n);
|
|
current = NO_CPP;
|
|
have_destructor = 1;
|
|
destructor_action = Getattr(n, "wrap:action");
|
|
return SWIG_OK;
|
|
}
|
|
|
|
/* -----------------------------------------------------------------------
|
|
* staticmemberfunctionHandler()
|
|
*
|
|
* Wrap a static C++ function
|
|
* ---------------------------------------------------------------------- */
|
|
|
|
virtual int staticmemberfunctionHandler(Node *n) {
|
|
current = STATIC_FUNC;
|
|
return Language::staticmemberfunctionHandler(n);
|
|
}
|
|
|
|
/* ------------------------------------------------------------
|
|
* memberconstantHandler()
|
|
*
|
|
* Create a C++ constant
|
|
* ------------------------------------------------------------ */
|
|
|
|
virtual int memberconstantHandler(Node *n) {
|
|
// REPORT("memberconstantHandler",n);
|
|
return Language::memberconstantHandler(n);
|
|
}
|
|
|
|
/* ---------------------------------------------------------------------
|
|
* staticmembervariableHandler()
|
|
* --------------------------------------------------------------------- */
|
|
|
|
virtual int staticmembervariableHandler(Node *n) {
|
|
// REPORT("staticmembervariableHandler",n);
|
|
current = STATIC_VAR;
|
|
return Language::staticmembervariableHandler(n);
|
|
}
|
|
|
|
/* ---------------------------------------------------------------------
|
|
* external runtime generation
|
|
* --------------------------------------------------------------------- */
|
|
|
|
/* This is to support the usage
|
|
SWIG -external-runtime <filename>
|
|
The code consists of two functions:
|
|
String *runtimeCode() // returns a large string with all the runtimes in
|
|
String *defaultExternalRuntimeFilename() // returns the default filename
|
|
I am writing a generic solution, even though SWIG-Lua only has one file right now...
|
|
*/
|
|
String *runtimeCode() {
|
|
String *s = NewString("");
|
|
const char *filenames[] = { "luarun.swg", 0
|
|
}
|
|
; // must be 0 termiated
|
|
String *sfile;
|
|
for (int i = 0; filenames[i] != 0; i++) {
|
|
sfile = Swig_include_sys(filenames[i]);
|
|
if (!sfile) {
|
|
Printf(stderr, "*** Unable to open '%s'\n", filenames[i]);
|
|
} else {
|
|
Append(s, sfile);
|
|
Delete(sfile);
|
|
}
|
|
}
|
|
|
|
return s;
|
|
}
|
|
|
|
String *defaultExternalRuntimeFilename() {
|
|
return NewString("swigluarun.h");
|
|
}
|
|
|
|
/* ---------------------------------------------------------------------
|
|
* helpers
|
|
* --------------------------------------------------------------------- */
|
|
|
|
/* This is to convert the string of Lua code into a proper string, which can then be
|
|
emitted into the C/C++ code.
|
|
Basically is is a lot of search & replacing of odd sequences
|
|
*/
|
|
void EscapeCode(String* str)
|
|
{
|
|
//Printf(f_runtime,"/* original luacode:[[[\n%s\n]]]\n*/\n",str);
|
|
Chop(str); // trim
|
|
Replace(str,"\\","\\\\",DOH_REPLACE_ANY); // \ to \\ (this must be done first)
|
|
Replace(str,"\"","\\\"",DOH_REPLACE_ANY); // " to \"
|
|
Replace(str,"\n","\\n\"\n \"",DOH_REPLACE_ANY); // \n to \n"\n" (ie quoting every line)
|
|
//Printf(f_runtime,"/* hacked luacode:[[[\n%s\n]]]\n*/\n",str);
|
|
}
|
|
};
|
|
|
|
/* NEW LANGUAGE NOTE:***********************************************
|
|
in order to add you language into swig, you need to make the following changes:
|
|
- write this file (obviously)
|
|
- add into the makefile (not 100% clear on how to do this)
|
|
- edit swigmain.cxx to add your module
|
|
|
|
near the top of swigmain.cxx, look for this code & add you own codes
|
|
======= begin change ==========
|
|
extern "C" {
|
|
Language *swig_tcl(void);
|
|
Language *swig_python(void);
|
|
//etc,etc,etc...
|
|
Language *swig_lua(void); // this is my code
|
|
}
|
|
|
|
//etc,etc,etc...
|
|
|
|
swig_module modules[] = {
|
|
{"-guile", swig_guile, "Guile"},
|
|
{"-java", swig_java, "Java"},
|
|
//etc,etc,etc...
|
|
{"-lua", swig_lua, "Lua"}, // this is my code
|
|
{NULL, NULL, NULL} // this must come at the end of the list
|
|
};
|
|
======= end change ==========
|
|
|
|
This is all that is needed
|
|
|
|
NEW LANGUAGE NOTE:END ************************************************/
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* swig_lua() - Instantiate module
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
extern "C" Language *swig_lua(void) {
|
|
return new LUA();
|
|
}
|