From: <bh...@us...> - 2008-07-02 11:35:05
|
Revision: 10630 http://swig.svn.sourceforge.net/swig/?rev=10630&view=rev Author: bhy Date: 2008-07-02 04:34:55 -0700 (Wed, 02 Jul 2008) Log Message: ----------- Merged revisions 10571-10629 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/trunk ........ r10574 | wsfulton | 2008-06-25 04:10:28 +0800 (Wed, 25 Jun 2008) | 1 line zap last entry ........ r10575 | wsfulton | 2008-06-25 04:11:46 +0800 (Wed, 25 Jun 2008) | 1 line variable name changes to remove php keywords ........ r10576 | wsfulton | 2008-06-25 04:12:08 +0800 (Wed, 25 Jun 2008) | 1 line variable name hiding fix ........ r10577 | wsfulton | 2008-06-25 04:12:43 +0800 (Wed, 25 Jun 2008) | 1 line More info about numobjects added ........ r10578 | wsfulton | 2008-06-25 04:13:41 +0800 (Wed, 25 Jun 2008) | 1 line update for 1.3.36 release ........ r10579 | wsfulton | 2008-06-25 05:48:46 +0800 (Wed, 25 Jun 2008) | 1 line remove deprecated -c commandline option (runtime library generation) ........ r10580 | wsfulton | 2008-06-25 05:53:12 +0800 (Wed, 25 Jun 2008) | 1 line correct comment about deprecated option ........ r10582 | wsfulton | 2008-06-25 07:00:27 +0800 (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 07:24:48 +0800 (Wed, 25 Jun 2008) | 1 line correction for 1.3.36 ........ r10588 | wsfulton | 2008-06-25 08:16:04 +0800 (Wed, 25 Jun 2008) | 1 line section update ........ r10589 | wsfulton | 2008-06-25 08:16:40 +0800 (Wed, 25 Jun 2008) | 1 line bump version to 1.3.37 ........ r10594 | wsfulton | 2008-06-27 02:33:06 +0800 (Fri, 27 Jun 2008) | 1 line correct typo in first entry about %fragment ........ r10607 | wsfulton | 2008-06-29 08:19:05 +0800 (Sun, 29 Jun 2008) | 1 line fix some potential null pointer usage as reported by CoveriCoverity Prevent ........ r10608 | wsfulton | 2008-06-29 08:50:27 +0800 (Sun, 29 Jun 2008) | 1 line fix potential null pointer usage as reported by Coverity Prevent ........ r10609 | wsfulton | 2008-06-29 17:57:41 +0800 (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 18:08:14 +0800 (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 07:41:27 +0800 (Tue, 01 Jul 2008) | 2 lines Hopefully this provides more portable values for Infinity and NaN in Perl. ........ r10621 | wsfulton | 2008-07-02 06:02:14 +0800 (Wed, 02 Jul 2008) | 1 line update old commandline option ........ r10624 | olly | 2008-07-02 11:17:46 +0800 (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 12:56:11 +0800 (Wed, 02 Jul 2008) | 1 line fix the relative import patch by try both relative and absolute import ........ r10626 | olly | 2008-07-02 13:55:18 +0800 (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 14:06:56 +0800 (Wed, 02 Jul 2008) | 1 line fix the previous commit -- new approach using imp module ........ r10628 | bhy | 2008-07-02 14:29:15 +0800 (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 15:08:00 +0800 (Wed, 02 Jul 2008) | 1 line reconstruct the relative import, now the generated code looks better ........ Modified Paths: -------------- branches/gsoc2008-bhy/ANNOUNCE branches/gsoc2008-bhy/CHANGES branches/gsoc2008-bhy/CHANGES.current branches/gsoc2008-bhy/Doc/Manual/Contents.html branches/gsoc2008-bhy/Doc/Manual/Extending.html branches/gsoc2008-bhy/Doc/Manual/Sections.html branches/gsoc2008-bhy/Doc/Manual/Typemaps.html branches/gsoc2008-bhy/Doc/Manual/Warnings.html branches/gsoc2008-bhy/Examples/test-suite/csharp/char_strings_runme.cs branches/gsoc2008-bhy/Examples/test-suite/fvirtual.i branches/gsoc2008-bhy/Examples/test-suite/java/char_strings_runme.java branches/gsoc2008-bhy/Examples/test-suite/li_std_string.i branches/gsoc2008-bhy/Examples/test-suite/octave/fvirtual_runme.m branches/gsoc2008-bhy/Examples/test-suite/octave/li_std_string_runme.m branches/gsoc2008-bhy/Examples/test-suite/perl5/li_std_string_runme.pl branches/gsoc2008-bhy/Examples/test-suite/perl5/li_typemaps_runme.pl branches/gsoc2008-bhy/Examples/test-suite/python/fvirtual_runme.py branches/gsoc2008-bhy/Examples/test-suite/python/li_std_string_runme.py branches/gsoc2008-bhy/Examples/test-suite/ruby/li_std_string_runme.rb branches/gsoc2008-bhy/Examples/test-suite/template_int_const.i branches/gsoc2008-bhy/Examples/test-suite/template_typedef_rec.i branches/gsoc2008-bhy/README branches/gsoc2008-bhy/Source/CParse/templ.c branches/gsoc2008-bhy/Source/Modules/allegrocl.cxx branches/gsoc2008-bhy/Source/Modules/csharp.cxx branches/gsoc2008-bhy/Source/Modules/main.cxx branches/gsoc2008-bhy/Source/Modules/ocaml.cxx branches/gsoc2008-bhy/Source/Modules/php4.cxx branches/gsoc2008-bhy/Source/Modules/python.cxx branches/gsoc2008-bhy/Source/Modules/swigmain.cxx branches/gsoc2008-bhy/Source/Swig/typesys.c branches/gsoc2008-bhy/TODO branches/gsoc2008-bhy/Tools/mkrelease.py branches/gsoc2008-bhy/configure.in Removed Paths: ------------- branches/gsoc2008-bhy/Tools/config/config.guess branches/gsoc2008-bhy/Tools/config/config.sub Property Changed: ---------------- branches/gsoc2008-bhy/ branches/gsoc2008-bhy/Tools/config/ Property changes on: branches/gsoc2008-bhy ___________________________________________________________________ Name: svnmerge-integrated - /trunk:1-10570 + /trunk:1-10629 Modified: branches/gsoc2008-bhy/ANNOUNCE =================================================================== --- branches/gsoc2008-bhy/ANNOUNCE 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/ANNOUNCE 2008-07-02 11:34:55 UTC (rev 10630) @@ -1,10 +1,10 @@ -*** ANNOUNCE: SWIG 1.3.35 (7 April 2008) *** +*** ANNOUNCE: SWIG 1.3.36 (24 June 2008) *** http://www.swig.org -We're pleased to announce SWIG-1.3.35, the latest installment in the -SWIG development effort. SWIG-1.3.35 includes a number of bug fixes +We're pleased to announce SWIG-1.3.36, the latest installment in the +SWIG development effort. SWIG-1.3.36 includes a number of bug fixes and large number of enhancements throughout. What is SWIG? @@ -24,11 +24,11 @@ ------------- The release is available for download on Sourceforge at - http://prdownloads.sourceforge.net/swig/swig-1.3.35.tar.gz + http://prdownloads.sourceforge.net/swig/swig-1.3.36.tar.gz A Windows version is also available at - http://prdownloads.sourceforge.net/swig/swigwin-1.3.35.zip + http://prdownloads.sourceforge.net/swig/swigwin-1.3.36.zip Release numbers --------------- Modified: branches/gsoc2008-bhy/CHANGES =================================================================== --- branches/gsoc2008-bhy/CHANGES 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/CHANGES 2008-07-02 11:34:55 UTC (rev 10630) @@ -2,6 +2,162 @@ See CHANGES.current for current version. +Version 1.3.36 (24 June 2008) +============================= + +06/24/2008: wsfulton + Remove deprecated -c commandline option (runtime library generation). + +06/24/2008: olly + [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) + (testcase ignore_parameter). + +06/24/2008: olly + [PHP] Fix segfault when wrapping a non-class function marked with + %newobject (testcase char_strings). + +06/22/2008: wsfulton + [Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread + in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see + Lib/java/director.swg. + +06/21/2008: wsfulton + [Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods) + +06/19/2008: wsfulton + [Java, C#] C# and Java keywords will be renamed instead of just issuing a warning + and then generating uncompileable code. Warning 314 gives the new name when a + keyword is found. + +06/19/2008: wsfulton + [R] Keyword handling added. R Keywords will be renamed as necessary. + Warning 314 gives the new name when a keyword is found. + +06/17/2008: mgossage + [Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase. + (Bug #1938142) + +06/07/2008: bhy + Added test case keyword_rename, then made the keyword renaming works properly + by fixing Swig_name_make() for a incomplete condition checking. + +06/02/2008: wsfulton + [Java, C#] Fix enum wrappers when using -noproxy. + +05/30/2008: bhy + Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive + type in SWIG - fixed SF #1976978. + +05/29/2008: wsfulton + [Java, C#] Fix variable wrappers when using -noproxy. + +05/29/2008: bhy + [Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related + to -extranative SWIG option - SF #1971977. + +05/20/2008: wsfulton + New partialcheck makefile targets for partial testing of the test-suite. These + just invoke SWIG, ie no compilation and no runtime testing. It can be faster + when developing by just doing a directory diff of the files SWIG generates + against those from a previous run. Example usage from the top level directory: + + make partialcheck-test-suite + make partialcheck-java-test-suite + + This change also encompasses more flexibility in running the test-suite, eg + it is possible to prefix the command line which runs any target language test + with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk + file and makefiles in the test-suite directory. For example it is possible to + run the runtime tests through valgrind using: + + make check RUNTOOL="valgrind --leak-check=full" + + or invoke SWIG under valgrind using: + + make check SWIGTOOL="valgrind --tool=memcheck" + +05/19/2008: drjoe + [R] Fixed define that was breaking pre-2.7. Checked in + patch from Soren Sonnenburg that creates strings in + version independent way + +05/15/2008: wsfulton + [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. + +05/14/2008: wsfulton + Add an optimisation for functions that return objects by value, reducing + the number of copies of the object that are made. Implemented using an + optional attribute in the "out" typemap called "optimal". Details in + Typemaps.html. + +05/11/2008: olly + [PHP] Check for %feature("notabstract") when generating PHP5 class + wrapper. + +05/11/2008: wsfulton + Fix SF #1943608 - $self substitution in %contract, patch submitted by + Toon Verstraelen. + +05/09/2008: olly + [PHP] Fix char * typemaps to work when applied to signed char * and + unsigned char * (uncovered by testcase apply_strings). + +05/09/2008: wsfulton + Fix wrapping of char * member variables when using allprotected mode. + Bug reported by Warren Wang. + +05/09/2008: olly + [PHP] Fix bad PHP code generated when wrapping an enum in a + namespace (uncovered by testcase arrays_scope). + +05/09/2008: olly + [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 + is essentially obsolete now, so we care much more about solid PHP5 + support. + +05/07/2008: wsfulton + STL fixes when using %import rather than %include and the Solaris Workshop + compiler and the Roguewave STL. + +05/07/2008: wsfulton + Fix wrapping of overloaded protected methods when using allprotected mode. + Bug reported by Warren Wang. + +05/03/2008: wsfulton + Commit patch #1956607 to add -MT support from Richard Boulton. + This patch mirrors the gcc -MT option which allows one to change the default + Makefile target being generated when generating makefiles with the -M family + of options. For example: + + $ swig -java -MM -MT overiddenname -c++ example.i + overiddenname: \ + example.i \ + example.h + +04/30/2008: mgossage + [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor) + which was unused and causing warning with g++ -Wall. + Removed other unused warning in typemaps.i and other places. + Added Examples/lua/embed3, and run tests a few test cases. + +04/24/2008: olly + [Python] Fix generated code for IBM's C++ compiler on AIX (patch + from Goeran Uddeborg in SF#1928048). + +04/24/2008: olly + Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to + avoid a clash with BSIZE defined by headers on AIX with Perl + (reported in SF#1928048). + +04/20/2008: wsfulton + Add the ability to wrap all protected members when using directors. + Previously only the virtual methods were available to the target language. + Now all protected members, (static and non-static variables, non-virtual methods + and static methods) are wrapped when using the allprotected mode. The allprotected + mode is turned on in the module declaration: + + %module(directors="1", allprotected="1") modulename + Version 1.3.35 (7 April 2008) ============================= @@ -12123,7 +12279,8 @@ with helper functions even if they aren't used. To fix this, a new fragment directive is available. For example: - %fragment("type_helper","header") %{ + (corrected typo in line below - 06/26/2008) + %fragment("type_header","header") %{ void some_helper_function() { ... } Modified: branches/gsoc2008-bhy/CHANGES.current =================================================================== --- branches/gsoc2008-bhy/CHANGES.current 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/CHANGES.current 2008-07-02 11:34:55 UTC (rev 10630) @@ -1,157 +1,14 @@ Version 1.3.36 (in progress) ============================= -06/24/2008: olly - [PHP] Fix typemap_namespace.i to not try to copy a non-existent - typemap. +2008-07-02: olly + [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. -06/24/2008: olly - [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) - (testcase ignore_parameter). +2008-07-02: olly + [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. -06/24/2008: olly - [PHP] Fix segfault when wrapping a non-class function marked with - %newobject (testcase char_strings). - -06/22/2008: wsfulton - [Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread - in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see - Lib/java/director.swg. - -06/21/2008: wsfulton - [Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods) - -06/19/2008: wsfulton - [Java, C#] C# and Java keywords will be renamed instead of just issuing a warning - and then generating uncompileable code. Warning 314 gives the new name when a - keyword is found. - -06/19/2008: wsfulton - [R] Keyword handling added. R Keywords will be renamed as necessary. - Warning 314 gives the new name when a keyword is found. - -06/17/2008: mgossage - [Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase. - (Bug #1938142) - -06/07/2008: bhy - Added test case keyword_rename, then made the keyword renaming works properly - by fixing Swig_name_make() for a incomplete condition checking. - -06/02/2008: wsfulton - [Java, C#] Fix enum wrappers when using -noproxy. - -05/30/2008: bhy - Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive - type in SWIG - fixed SF #1976978. - -05/29/2008: wsfulton - [Java, C#] Fix variable wrappers when using -noproxy. - -05/29/2008: bhy - [Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related - to -extranative SWIG option - SF #1971977. - -05/20/2008: wsfulton - New partialcheck makefile targets for partial testing of the test-suite. These - just invoke SWIG, ie no compilation and no runtime testing. It can be faster - when developing by just doing a directory diff of the files SWIG generates - against those from a previous run. Example usage from the top level directory: - - make partialcheck-test-suite - make partialcheck-java-test-suite - - This change also encompasses more flexibility in running the test-suite, eg - it is possible to prefix the command line which runs any target language test - with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk - file and makefiles in the test-suite directory. For example it is possible to - run the runtime tests through valgrind using: - - make check RUNTOOL="valgrind --leak-check=full" - - or invoke SWIG under valgrind using: - - make check SWIGTOOL="valgrind --tool=memcheck" - -05/19/2008: drjoe - [R] Fixed define that was breaking pre-2.7. Checked in - patch from Soren Sonnenburg that creates strings in - version independent way - -05/15/2008: wsfulton - [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. - -05/14/2008: wsfulton - Add an optimisation for functions that return objects by value, reducing - the number of copies of the object that are made. Implemented using an - optional attribute in the "out" typemap called "optimal". Details in - Typemaps.html. - -05/11/2008: olly - [PHP] Check for %feature("notabstract") when generating PHP5 class - wrapper. - -05/11/2008: wsfulton - Fix SF #1943608 - $self substitution in %contract, patch submitted by - Toon Verstraelen. - -05/09/2008: olly - [PHP] Fix char * typemaps to work when applied to signed char * and - unsigned char * (uncovered by testcase apply_strings). - -05/09/2008: wsfulton - Fix wrapping of char * member variables when using allprotected mode. - Bug reported by Warren Wang. - -05/09/2008: olly - [PHP] Fix bad PHP code generated when wrapping an enum in a - namespace (uncovered by testcase arrays_scope). - -05/09/2008: olly - [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 - is essentially obsolete now, so we care much more about solid PHP5 - support. - -05/07/2008: wsfulton - STL fixes when using %import rather than %include and the Solaris Workshop - compiler and the Roguewave STL. - -05/07/2008: wsfulton - Fix wrapping of overloaded protected methods when using allprotected mode. - Bug reported by Warren Wang. - -05/03/2008: wsfulton - Commit patch #1956607 to add -MT support from Richard Boulton. - This patch mirrors the gcc -MT option which allows one to change the default - Makefile target being generated when generating makefiles with the -M family - of options. For example: - - $ swig -java -MM -MT overiddenname -c++ example.i - overiddenname: \ - example.i \ - example.h - -04/30/2008: mgossage - [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor) - which was unused and causing warning with g++ -Wall. - Removed other unused warning in typemaps.i and other places. - Added Examples/lua/embed3, and run tests a few test cases. - -04/24/2008: olly - [Python] Fix generated code for IBM's C++ compiler on AIX (patch - from Goeran Uddeborg in SF#1928048). - -04/24/2008: olly - Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to - avoid a clash with BSIZE defined by headers on AIX with Perl - (reported in SF#1928048). - -04/20/2008: wsfulton - Add the ability to wrap all protected members when using directors. - Previously only the virtual methods were available to the target language. - Now all protected members, (static and non-static variables, non-virtual methods - and static methods) are wrapped when using the allprotected mode. The allprotected - mode is turned on in the module declaration: - - %module(directors="1", allprotected="1") modulename - Modified: branches/gsoc2008-bhy/Doc/Manual/Contents.html =================================================================== --- branches/gsoc2008-bhy/Doc/Manual/Contents.html 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Doc/Manual/Contents.html 2008-07-02 11:34:55 UTC (rev 10630) @@ -380,7 +380,7 @@ </ul> <li><a href="Typemaps.html#Typemaps_nn43">Typemaps for multiple languages</a> <li><a href="Typemaps.html#Typemaps_optimal">Optimal code generation when returning by value</a> -<li><a href="Typemaps.html#Typemaps_nn42">Multi-argument typemaps</a> +<li><a href="Typemaps.html#Typemaps_multi_argument_typemaps">Multi-argument typemaps</a> <li><a href="Typemaps.html#runtime_type_checker">The run-time type checker</a> <ul> <li><a href="Typemaps.html#Typemaps_nn45">Implementation</a> Modified: branches/gsoc2008-bhy/Doc/Manual/Extending.html =================================================================== --- branches/gsoc2008-bhy/Doc/Manual/Extending.html 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Doc/Manual/Extending.html 2008-07-02 11:34:55 UTC (rev 10630) @@ -448,7 +448,8 @@ <p> The contents of each parse tree node consist of a collection of attribute/value pairs. Internally, the nodes are simply represented by hash tables. A display of -the entire parse-tree structure can be obtained using <tt>swig -dump_tree</tt>. +the entire parse-tree structure can be obtained using <tt>swig -debug-top <n></tt>, where <tt>n</tt> is +the stage being processed. There are a number of other parse tree display options, for example, <tt>swig -debug-module <n></tt> will avoid displaying system parse information and only display the parse tree pertaining to the user's module at stage <tt>n</tt> of processing. Modified: branches/gsoc2008-bhy/Doc/Manual/Sections.html =================================================================== --- branches/gsoc2008-bhy/Doc/Manual/Sections.html 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Doc/Manual/Sections.html 2008-07-02 11:34:55 UTC (rev 10630) @@ -6,7 +6,7 @@ <body bgcolor="#ffffff"> <H1><a name="Sections"></a>SWIG-1.3 Development Documentation</H1> -Last update : SWIG-1.3.36 (in progress) +Last update : SWIG-1.3.37 (in progress) <H2>Sections</H2> Modified: branches/gsoc2008-bhy/Doc/Manual/Typemaps.html =================================================================== --- branches/gsoc2008-bhy/Doc/Manual/Typemaps.html 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Doc/Manual/Typemaps.html 2008-07-02 11:34:55 UTC (rev 10630) @@ -65,7 +65,7 @@ </ul> <li><a href="#Typemaps_nn43">Typemaps for multiple languages</a> <li><a href="#Typemaps_optimal">Optimal code generation when returning by value</a> -<li><a href="#Typemaps_nn42">Multi-argument typemaps</a> +<li><a href="#Typemaps_multi_argument_typemaps">Multi-argument typemaps</a> <li><a href="#runtime_type_checker">The run-time type checker</a> <ul> <li><a href="#Typemaps_nn45">Implementation</a> @@ -1933,7 +1933,7 @@ <p> In addition, the "in" typemap allows the number of converted arguments to be -specified. For example: +specified. The <tt>numinputs</tt> attributes facilitates this. For example: </p> <div class="code"> @@ -1946,7 +1946,12 @@ </div> <p> -At this time, only zero or one arguments may be converted. +At this time, only zero or one arguments may be converted. +When <tt>numinputs</tt> is set to 0, the argument is effectively ignored and cannot be supplied from the target language. +The argument is still required when making the C/C++ call and the above typemap +shows the value used is instead obtained from a locally declared variable called <tt>temp</tt>. +Usually <tt>numinputs</tt> is not specified, whereupon the default value is 1, that is, there is a one to one mapping of the number of arguments when used from the target language to the C/C++ call. +<a href="#Typemaps_multi_argument_typemaps">Multi-argument typemaps</a> provide a similar concept where the number of arguments mapped from the target language to C/C++ can be changed for more tha multiple adjacent C/C++ arguments. </p> <p> @@ -2811,7 +2816,7 @@ However, it doesn't always get it right, for example when <tt>$1</tt> is within some commented out code. </p> -<H2><a name="Typemaps_nn42"></a>10.9 Multi-argument typemaps</H2> +<H2><a name="Typemaps_multi_argument_typemaps"></a>10.9 Multi-argument typemaps</H2> <p> Modified: branches/gsoc2008-bhy/Doc/Manual/Warnings.html =================================================================== --- branches/gsoc2008-bhy/Doc/Manual/Warnings.html 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Doc/Manual/Warnings.html 2008-07-02 11:34:55 UTC (rev 10630) @@ -373,7 +373,7 @@ <li>117. Deprecated <tt>%new</tt> directive. <li>118. Deprecated <tt>%typemap(except)</tt>. <li>119. Deprecated <tt>%typemap(ignore)</tt>. -<li>120. Deprecated command line option (-c). +<li>120. Deprecated command line option (-runtime, -noruntime). <li>121. Deprecated <tt>%name</tt> directive. </ul> Modified: branches/gsoc2008-bhy/Examples/test-suite/csharp/char_strings_runme.cs =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/csharp/char_strings_runme.cs 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/csharp/char_strings_runme.cs 2008-07-02 11:34:55 UTC (rev 10630) @@ -5,7 +5,7 @@ public class char_strings_runme { private static string CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; - private static string OTHERLAND_MSG = "Little message from the the safe world."; + private static string OTHERLAND_MSG = "Little message from the safe world."; public static void Main() { Modified: branches/gsoc2008-bhy/Examples/test-suite/fvirtual.i =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/fvirtual.i 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/fvirtual.i 2008-07-02 11:34:55 UTC (rev 10630) @@ -10,11 +10,11 @@ virtual ~Node() {} }; - class Switch : public Node { + class NodeSwitch : public Node { public : virtual int addChild( Node *child ) { return 2; } // This was hidden with -fvirtual virtual int addChild( Node *child, bool value ) { return 3; } - virtual ~Switch() {} + virtual ~NodeSwitch() {} }; %} Modified: branches/gsoc2008-bhy/Examples/test-suite/java/char_strings_runme.java =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/java/char_strings_runme.java 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/java/char_strings_runme.java 2008-07-02 11:34:55 UTC (rev 10630) @@ -12,7 +12,7 @@ } private static String CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; - private static String OTHERLAND_MSG = "Little message from the the safe world."; + private static String OTHERLAND_MSG = "Little message from the safe world."; public static void main(String argv[]) { Modified: branches/gsoc2008-bhy/Examples/test-suite/li_std_string.i =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/li_std_string.i 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/li_std_string.i 2008-07-02 11:34:55 UTC (rev 10630) @@ -129,7 +129,7 @@ %} %inline %{ - std::string empty() { + std::string stdstring_empty() { return std::string(); } Modified: branches/gsoc2008-bhy/Examples/test-suite/octave/fvirtual_runme.m =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/octave/fvirtual_runme.m 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/octave/fvirtual_runme.m 2008-07-02 11:34:55 UTC (rev 10630) @@ -1,6 +1,6 @@ fvirtual -sw = Switch(); +sw = NodeSwitch(); n = Node(); i = sw.addChild(n); Modified: branches/gsoc2008-bhy/Examples/test-suite/octave/li_std_string_runme.m =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/octave/li_std_string_runme.m 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/octave/li_std_string_runme.m 2008-07-02 11:34:55 UTC (rev 10630) @@ -148,7 +148,7 @@ endif -if (li_std_string.empty() != "") +if (li_std_string.stdstring_empty() != "") error endif Modified: branches/gsoc2008-bhy/Examples/test-suite/perl5/li_std_string_runme.pl =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/perl5/li_std_string_runme.pl 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/perl5/li_std_string_runme.pl 2008-07-02 11:34:55 UTC (rev 10630) @@ -98,7 +98,7 @@ is($gen1->testl("9234567890121111113"), "9234567890121111114", "ulonglong big number"); -is(li_std_string::empty(), "", "empty"); +is(li_std_string::stdstring_empty(), "", "stdstring_empty"); is(li_std_string::c_empty(), "", "c_empty"); @@ -110,4 +110,4 @@ is(li_std_string::get_null(li_std_string::c_empty()), "non-null", "c_empty"); -is(li_std_string::get_null(li_std_string::empty()), "non-null", "c_empty"); +is(li_std_string::get_null(li_std_string::stdstring_empty()), "non-null", "stdstring_empty"); Modified: branches/gsoc2008-bhy/Examples/test-suite/perl5/li_typemaps_runme.pl =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/perl5/li_typemaps_runme.pl 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/perl5/li_typemaps_runme.pl 2008-07-02 11:34:55 UTC (rev 10630) @@ -37,24 +37,29 @@ batch('uchar', 0, 1, 12, 0xff); batch('schar', -0x80, 0, 1, 12, 0x7f); -# IEEE 754 machine, please! -batch('float', - -(2 - 2 ** -23) * 2 ** 127, - -1, -2 ** -149, 0, 2 ** -149, 1, - (2 - 2 ** -23) * 2 ** 127, - 'nan'); -{ local $TODO = "shouldn't some Inf <=> float work?"; - # I'm going to guess that it could work reasonably as - # NV Inf => float Inf - # float Inf => NV NaN - # but this needs some thought. - batch('float', 'inf'); +{ + use Math::BigInt qw(); + # the pack dance is to get plain old NVs out of the + # Math::BigInt objects. + my $inf = unpack 'd', pack 'd', Math::BigInt->binf(); + my $nan = unpack 'd', pack 'd', Math::BigInt->bnan(); + batch('float', + -(2 - 2 ** -23) * 2 ** 127, + -1, -2 ** -149, 0, 2 ** -149, 1, + (2 - 2 ** -23) * 2 ** 127, + $nan); + { local $TODO = "float typemaps don't pass infinity"; + # it seems as though SWIG is unwilling to pass infinity around + # because that value always fails bounds checking. I think that + # is a bug. + batch('float', $inf); + } + batch('double', + -(2 - 2 ** -53) ** 1023, + -1, -2 ** -1074, 0, 2 ** 1074, + (2 - 2 ** -53) ** 1023, + $nan, $inf); } -batch('double', - -(2 - 2 ** -53) ** 1023, - -1, -2 ** -1074, 0, 2 ** 1074, - (2 - 2 ** -53) ** 1023, - 'nan', 'inf'); batch('longlong', -1, 0, 1, 12); batch('ulonglong', 0, 1, 12); SKIP: { Modified: branches/gsoc2008-bhy/Examples/test-suite/python/fvirtual_runme.py =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/python/fvirtual_runme.py 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/python/fvirtual_runme.py 2008-07-02 11:34:55 UTC (rev 10630) @@ -1,6 +1,6 @@ from fvirtual import * -sw = Switch() +sw = NodeSwitch() n = Node() i = sw.addChild(n); Modified: branches/gsoc2008-bhy/Examples/test-suite/python/li_std_string_runme.py =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/python/li_std_string_runme.py 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/python/li_std_string_runme.py 2008-07-02 11:34:55 UTC (rev 10630) @@ -121,7 +121,7 @@ raise RuntimeError -if li_std_string.empty() != "": +if li_std_string.stdstring_empty() != "": raise RuntimeError Modified: branches/gsoc2008-bhy/Examples/test-suite/ruby/li_std_string_runme.rb =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/ruby/li_std_string_runme.rb 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/ruby/li_std_string_runme.rb 2008-07-02 11:34:55 UTC (rev 10630) @@ -124,7 +124,7 @@ end -if (empty() != "") +if (stdstring_empty() != "") raise RuntimeError end Modified: branches/gsoc2008-bhy/Examples/test-suite/template_int_const.i =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/template_int_const.i 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/template_int_const.i 2008-07-02 11:34:55 UTC (rev 10630) @@ -10,7 +10,7 @@ static const Polarization polarization = UnaryPolarization; }; template <Polarization P> - struct Interface + struct Interface_ { }; @@ -26,16 +26,16 @@ }; %} -%template(Interface_UP) Interface<UnaryPolarization>; +%template(Interface_UP) Interface_<UnaryPolarization>; %template(Module_1) Module<1>; %inline %{ struct ExtInterface1 : - Interface<UnaryPolarization> // works + Interface_<UnaryPolarization> // works { }; struct ExtInterface2 : - Interface<interface_traits::polarization> // doesn't work + Interface_<interface_traits::polarization> // doesn't work { }; struct ExtModule1 : Modified: branches/gsoc2008-bhy/Examples/test-suite/template_typedef_rec.i =================================================================== --- branches/gsoc2008-bhy/Examples/test-suite/template_typedef_rec.i 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Examples/test-suite/template_typedef_rec.i 2008-07-02 11:34:55 UTC (rev 10630) @@ -16,7 +16,7 @@ template <typename T> -class ArrayIterator +class ArrayIterator_ { public: typedef test_Array::intT intT; @@ -38,8 +38,8 @@ public: typedef T ValueT; typedef T valueT; - typedef ArrayIterator<T> Iterator; - typedef ArrayIterator<const T> ConstIterator; + typedef ArrayIterator_<T> Iterator; + typedef ArrayIterator_<const T> ConstIterator; typedef ArrayReverseIterator<T> ReverseIterator; typedef ArrayReverseIterator<const T> ConstReverseIterator; }; Modified: branches/gsoc2008-bhy/README =================================================================== --- branches/gsoc2008-bhy/README 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/README 2008-07-02 11:34:55 UTC (rev 10630) @@ -1,6 +1,6 @@ SWIG (Simplified Wrapper and Interface Generator) -Version: 1.3.35 (7 April 2008) +Version: 1.3.36 (24 June 2008) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua, @@ -91,6 +91,13 @@ What's New? =========== +SWIG-1.3.36 summary: +- Enhancement to directors to wrap all protected members +- Optimisation feature for objects returned by value +- A few bugs fixes in the PHP, Java, Ruby, R, C#, Python, Lua and + Perl modules +- Other minor generic bug fixes + SWIG-1.3.35 summary: - Octave language module added - Bug fixes in Python, Lua, Java, C#, Perl modules Modified: branches/gsoc2008-bhy/Source/CParse/templ.c =================================================================== --- branches/gsoc2008-bhy/Source/CParse/templ.c 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/CParse/templ.c 2008-07-02 11:34:55 UTC (rev 10630) @@ -167,18 +167,21 @@ add_parms(Getattr(n, "throws"), cpatchlist, typelist); } else if (Equal(nodeType, "destructor")) { String *name = Getattr(n, "name"); - if (name && strchr(Char(name), '<')) { - Append(patchlist, Getattr(n, "name")); - } else { - Append(name, templateargs); + if (name) { + if (strchr(Char(name), '<')) + Append(patchlist, Getattr(n, "name")); + else + Append(name, templateargs); } name = Getattr(n, "sym:name"); - if (name && strchr(Char(name), '<')) { - String *sn = Copy(tname); - Setattr(n, "sym:name", sn); - Delete(sn); - } else { - Replace(name, tname, rname, DOH_REPLACE_ANY); + if (name) { + if (strchr(Char(name), '<')) { + String *sn = Copy(tname); + Setattr(n, "sym:name", sn); + Delete(sn); + } else { + Replace(name, tname, rname, DOH_REPLACE_ANY); + } } /* Setattr(n,"sym:name",name); */ Append(cpatchlist, Getattr(n, "code")); Modified: branches/gsoc2008-bhy/Source/Modules/allegrocl.cxx =================================================================== --- branches/gsoc2008-bhy/Source/Modules/allegrocl.cxx 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/Modules/allegrocl.cxx 2008-07-02 11:34:55 UTC (rev 10630) @@ -2271,7 +2271,7 @@ return SWIG_OK; } -int ALLEGROCL::emit_defun(Node *n, File *f_cl) { +int ALLEGROCL::emit_defun(Node *n, File *fcl) { #ifdef ALLEGROCL_WRAP_DEBUG Printf(stderr, "emit_defun: ENTER... "); #endif @@ -2307,27 +2307,27 @@ if (Generate_Wrapper) { String *extra_parms = id_converter_arguments(n)->noname_str(); if (Getattr(n, "sym:overloaded")) - Printf(f_cl, "(swig-defmethod (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); + Printf(fcl, "(swig-defmethod (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); else - Printf(f_cl, "(swig-defun (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); + Printf(fcl, "(swig-defun (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); Delete(extra_parms); } // Just C else { - Printf(f_cl, "(swig-defun (\"%s\" \"%s\")\n", funcname, Generate_Wrapper ? mangled_name : funcname); + Printf(fcl, "(swig-defun (\"%s\" \"%s\")\n", funcname, Generate_Wrapper ? mangled_name : funcname); } ////////////////////////////////////// // Lisp foreign call parameter list // ////////////////////////////////////// - Printf(f_cl, " ("); + Printf(fcl, " ("); /* Special cases */ if (ParmList_len(pl) == 0) { - Printf(f_cl, ":void"); + Printf(fcl, ":void"); /* } else if (any_varargs(pl)) { - Printf(f_cl, "#| varargs |#"); + Printf(fcl, "#| varargs |#"); varargs=1; */ } else { String *largs = NewString(""); @@ -2337,7 +2337,7 @@ SwigType *argtype = Swig_cparse_type(Getattr(p, "tmap:ctype")); if (!first) { - Printf(f_cl, "\n "); + Printf(fcl, "\n "); } if (SwigType_isvarargs(argtype)) { @@ -2393,7 +2393,7 @@ // if this parameter has been removed from the C/++ wrapper // it shouldn't be in the lisp wrapper either. if (!checkAttribute(p, "tmap:in:numinputs", "0")) { - Printf(f_cl, "(%s %s %s %s %s)", + Printf(fcl, "(%s %s %s %s %s)", // parms in the ff wrapper, but not in the lisp wrapper. (checkAttribute(p, "tmap:lin:numinputs", "0") ? ":p-" : ":p+"), argname, dispatchtype, ffitype, lisptype); @@ -2479,12 +2479,12 @@ Replaceall(wrap->code, "$ldestructor", ldestructor); Delete(ldestructor); - Printf(f_cl, ")\n"); /* finish arg list */ + Printf(fcl, ")\n"); /* finish arg list */ ///////////////////////////////////////////////////// // Lisp foreign call return type and optimizations // ///////////////////////////////////////////////////// - Printf(f_cl, " (:returning (%s %s)", compose_foreign_type(result_type), get_lisp_type(Getattr(n, "type"), "result")); + Printf(fcl, " (:returning (%s %s)", compose_foreign_type(result_type), get_lisp_type(Getattr(n, "type"), "result")); for (Iterator option = First(n); option.item; option = Next(option)) { if (Strncmp("feature:ffargs:", option.key, 15)) @@ -2494,12 +2494,12 @@ Replaceall(option_name, "_", "-"); // TODO: varargs vs call-direct ? - Printf(f_cl, "\n %s %s", option_name, option_val); + Printf(fcl, "\n %s %s", option_name, option_val); Delete(option_name); } - Printf(f_cl, ")\n %s)\n\n", wrap->code); + Printf(fcl, ")\n %s)\n\n", wrap->code); // Wrapper_print(wrap, stderr); Delete(result_type); @@ -2518,6 +2518,8 @@ ParmList *parms = CopyParmList(Getattr(n, "parms")); Wrapper *f = NewWrapper(); + SwigType *t = Getattr(n, "type"); + String *name = Getattr(n, "name"); String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0); SwigType *return_type = Swig_cparse_type(raw_return_type); @@ -2556,7 +2558,7 @@ if (Getattr(n, "overload:ignore")) { // if we're the last overload, make sure to force the emit // of the rest of the overloads before we leave. - Printf(stderr, "ignored overload %s(%x)\n", Getattr(n, "name"), Getattr(n, "sym:nextSibling")); + Printf(stderr, "ignored overload %s(%x)\n", name, Getattr(n, "sym:nextSibling")); if (!Getattr(n, "sym:nextSibling")) { update_package_if_needed(n); emit_buffered_defuns(n); @@ -2571,7 +2573,7 @@ int gencomma = 0; #ifdef ALLEGROCL_DEBUG - Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), Getattr(n, "name")); + Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), name); #endif // Now walk the function parameter list and generate code to get arguments String *name_and_parms = NewStringf("%s (", mangled); @@ -2625,12 +2627,16 @@ String *actioncode = emit_action(n); - String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode); - Replaceall(result_convert, "$result", "lresult"); - Printf(f->code, "%s\n", result_convert); - Printf(f->code, " return lresult;\n"); - Delete(result_convert); - emit_return_variable(n, Getattr(n, "type"), f); + String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode); + if (tm) { + Replaceall(tm, "$result", "lresult"); + Printf(f->code, "%s\n", tm); + Printf(f->code, " return lresult;\n"); + Delete(tm); + } else { + Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(t, 0), name); + } + emit_return_variable(n, t, f); if (CPlusPlus) { Printf(f->code, " } catch (...) {\n"); Modified: branches/gsoc2008-bhy/Source/Modules/csharp.cxx =================================================================== --- branches/gsoc2008-bhy/Source/Modules/csharp.cxx 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/Modules/csharp.cxx 2008-07-02 11:34:55 UTC (rev 10630) @@ -1998,7 +1998,8 @@ if (!(variable_wrapper_flag && i == 0)) { SwigType *pt = Getattr(p, "type"); String *param_type = NewString(""); - last_parm = p; + if (setter_flag) + last_parm = p; /* Get the C# parameter type */ if ((tm = Getattr(p, "tmap:cstype"))) { Modified: branches/gsoc2008-bhy/Source/Modules/main.cxx =================================================================== --- branches/gsoc2008-bhy/Source/Modules/main.cxx 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/Modules/main.cxx 2008-07-02 11:34:55 UTC (rev 10630) @@ -33,7 +33,7 @@ int Verbose = 0; int AddExtern = 0; int NoExcept = 0; -int SwigRuntime = 0; // 0 = no option, 1 = -c or -runtime, 2 = -noruntime +int SwigRuntime = 0; // 0 = no option, 1 = -runtime, 2 = -noruntime /* Suppress warning messages for private inheritance, preprocessor evaluation etc... WARN_PP_EVALUATION 202 @@ -491,13 +491,13 @@ Wrapper_compact_print_mode_set(1); Wrapper_virtual_elimination_mode_set(1); Swig_mark_arg(i); - } else if (strcmp(argv[i], "-runtime") == 0) { + } else if (strcmp(argv[i], "-runtime") == 0) { // Used to also accept -c. removed in swig-1.3.36 Swig_mark_arg(i); - Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-c, -runtime, -noruntime command line options are deprecated.\n"); + Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-runtime, -noruntime command line options are deprecated.\n"); SwigRuntime = 1; - } else if ((strcmp(argv[i], "-c") == 0) || (strcmp(argv[i], "-noruntime") == 0)) { + } else if (strcmp(argv[i], "-noruntime") == 0) { Swig_mark_arg(i); - Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-c, -runtime, -noruntime command line options are deprecated.\n"); + Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-runtime, -noruntime command line options are deprecated.\n"); SwigRuntime = 2; } else if (strcmp(argv[i], "-external-runtime") == 0) { external_runtime = 1; Modified: branches/gsoc2008-bhy/Source/Modules/ocaml.cxx =================================================================== --- branches/gsoc2008-bhy/Source/Modules/ocaml.cxx 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/Modules/ocaml.cxx 2008-07-02 11:34:55 UTC (rev 10630) @@ -1292,56 +1292,50 @@ * which means looking up and registering by typedef and enum name. */ int enumDeclaration(Node *n) { String *name = Getattr(n, "name"); - String *oname = name ? NewString(name) : NULL; - /* name is now fully qualified */ - String *fully_qualified_name = NewString(name); - bool seen_enum = false; - if (name_qualifier) - Delete(name_qualifier); - char *strip_position; - name_qualifier = fully_qualify_enum_name(n, NewString("")); + if (name) { + String *oname = NewString(name); + /* name is now fully qualified */ + String *fully_qualified_name = NewString(name); + bool seen_enum = false; + if (name_qualifier) + Delete(name_qualifier); + char *strip_position; + name_qualifier = fully_qualify_enum_name(n, NewString("")); - /* Recent changes have distrubed enum and template naming again. - * Will try to keep it consistent by can't guarantee much given - * that these things move around a lot. - * - * I need to figure out a way to isolate this module better. - */ - if (oname) { strip_position = strstr(Char(oname), "::"); while (strip_position) { - strip_position += 2; - oname = NewString(strip_position); - strip_position = strstr(Char(oname), "::"); + strip_position += 2; + oname = NewString(strip_position); + strip_position = strstr(Char(oname), "::"); } - } - seen_enum = oname ? (Getattr(seen_enums, fully_qualified_name) ? true : false) : false; + seen_enum = (Getattr(seen_enums, fully_qualified_name) ? true : false); - if (oname && !seen_enum) { - const_enum = true; - Printf(f_enum_to_int, "| `%s -> (match y with\n", oname); - Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname); - /* * * * A note about enum name resolution * * * * - * This code should now work, but I think we can do a bit better. - * The problem I'm having is that swig isn't very precise about - * typedef name resolution. My opinion is that SwigType_typedef - * resolve_all should *always* return the enum tag if one exists, - * rather than the admittedly friendlier enclosing typedef. - * - * This would make one of the cases below unnecessary. - * * * */ - Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname); - if (!strncmp(Char(fully_qualified_name), "enum ", 5)) { - String *fq_noenum = NewString(Char(fully_qualified_name) + 5); - Printf(f_mlbody, - "let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name); - } + if (!seen_enum) { + const_enum = true; + Printf(f_enum_to_int, "| `%s -> (match y with\n", oname); + Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname); + /* * * * A note about enum name resolution * * * * + * This code should now work, but I think we can do a bit better. + * The problem I'm having is that swig isn't very precise about + * typedef name resolution. My opinion is that SwigType_typedef + * resolve_all should *always* return the enum tag if one exists, + * rather than the admittedly friendlier enclosing typedef. + * + * This would make one of the cases below unnecessary. + * * * */ + Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname); + if (!strncmp(Char(fully_qualified_name), "enum ", 5)) { + String *fq_noenum = NewString(Char(fully_qualified_name) + 5); + Printf(f_mlbody, + "let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name); + } - Printf(f_enumtypes_type, "| `%s\n", oname); - Insert(fully_qualified_name, 0, "enum "); - Setattr(seen_enums, fully_qualified_name, n); + Printf(f_enumtypes_type, "| `%s\n", oname); + Insert(fully_qualified_name, 0, "enum "); + Setattr(seen_enums, fully_qualified_name, n); + } } int ret = Language::enumDeclaration(n); Modified: branches/gsoc2008-bhy/Source/Modules/php4.cxx =================================================================== --- branches/gsoc2008-bhy/Source/Modules/php4.cxx 2008-07-02 07:08:00 UTC (rev 10629) +++ branches/gsoc2008-bhy/Source/Modules/php4.cxx 2008-07-02 11:34:55 UTC (rev 10630) @@ -13,11 +13,9 @@ * Short term: * * Sort out auto-renaming of method and class names which are reserved - * words (e.g. empty, clone, exception, etc.) vs -php4/-php5 in some - * sane way. + * words (e.g. empty, clone, exception, etc.) * - * Sort out wrapping of static member variables in OO PHP5 (which first may - * mean we need to sort them out for PHP4!) + * Sort out wrapping of static member variables in OO PHP5. * * Medium term: * @@ -50,7 +48,7 @@ #include <errno.h> static const char *usage = (char *) "\ -PHP Options (available with -php4 or -php5)\n\ +PHP Options (available with -php5)\n\ -cppext - cpp file extension (default to .cpp)\n\ -noproxy - Don't generate proxy classes.\n\ -prefix <prefix> - Prepend <prefix> to all class names in PHP5 wrappers\n\ @@ -116,9 +114,6 @@ static Hash *shadow_get_vars; static Hash *shadow_set_vars; -#define NATIVE_CONSTRUCTOR 1 -#define ALTERNATIVE_CONSTRUCTOR 2 -static int native_constructor = 0; static Hash *zend_types = 0; static int shadow = 1; @@ -295,11 +290,7 @@ } Preprocessor_define((void *) "SWIGPHP 1", 0); - if (php_version == 4) { - Preprocessor_define((void *) "SWIGPHP4 1", 0); - } else if (php_version == 5) { - Preprocessor_define((void *) "SWIGPHP5 1", 0); - } + Preprocessor_define((void *) "SWIGPHP5 1", 0); SWIG_typemap_lang("php4"); /* DB: Suggest using a language configuration file */ SWIG_config_file("php4.swg"); @@ -609,9 +600,8 @@ Printf(f_phpcode, " if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {\n"); Printf(f_phpcode, " if (!dl('php_%s.dll')) return;\n", module); Printf(f_phpcode, " } else {\n"); - Printf(f_phpcode, " // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.\n"); - Printf(f_phpcode, " // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.\n"); - Printf(f_phpcode, " if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {\n"); + Printf(f_phpcode, " // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.\n"); + Printf(f_phpcode, " if (PHP_SHLIB_SUFFIX === 'dylib') {\n"); Printf(f_phpcode, " if (!dl('%s.so')) return;\n", module); Printf(f_phpcode, " } else {\n"); Printf(f_phpcode, " if (!dl('%s.'.PHP_SHLIB_SUFFIX)) return;\n", module); @@ -852,10 +842,6 @@ /* Just need to append function names to function table to register with PHP. */ void create_command(String *cname, String *iname) { // This is for the single main zend_function_entry record - if (shadow && php_version == 4) { - if (wrapperType != standard) - return; - } Printf(f_h, "ZEND_NAMED_FUNCTION(%s);\n", iname); String * s = cs_entry; if (!s) s = s_entry; @@ -872,8 +858,6 @@ String *tmp = NewStringEmpty(); String *dispatch = Swig_overload_dispatch(n, "return %s(INTERNAL_FUNCTION_PARAM_PASSTHRU);", &maxargs); - int has_this_ptr = (wrapperType == memberfn && shadow && php_version == 4); - /* Generate a dispatch wrapper for all overloaded functions */ Wrapper *f = NewWrapper(); @@ -890,13 +874,7 @@ Printf(f->code, "argc = ZEND_NUM_ARGS();\n"); - if (has_this_ptr) { - Printf(f->code, "argv[0] = &this_ptr;\n"); - Printf(f->code, "zend_get_parameters_array_ex(argc,argv+1);\n"); - Printf(f->code, "argc++;\n"); - } else { - Printf(f->code, "zend_get_parameters_array_ex(argc,argv);\n"); - } + Printf(f->code, "zend_get_parameters_array_ex(argc,argv);\n"); Replaceall(dispatch, "$args", "self,args"); @@ -945,8 +923,6 @@ int numopt; String *tm; Wrapper *f; - bool mvr = (shadow && php_version == 4 && wrapperType == membervar); - bool mvrset = (mvr && (Strcmp(iname, Swig_name_set(Swig_name_member(shadow_classname, name))) == 0)); String *wname; int overloaded = 0; @@ -971,40 +947,18 @@ if (overname) { Printf(wname, "%s", overname); } - // if PHP4, shadow and variable wrapper we want to snag the main contents - // of this function to stick in to the property handler... - if (mvr) { - String *php_function_name = NewString(iname); - if (Strcmp(iname, Swig_name_set(Swig_name_member(shadow_classname, name))) == 0) { - Setattr(shadow_set_vars, php_function_name, name); - } - if (Strcmp(iname, Swig_name_get(Swig_name_member(shadow_classname, name))) == 0) { - Setattr(shadow_get_vars, php_function_name, name); - } - Delete(php_function_name); - } - f = NewWrapper(); numopt = 0; String *outarg = NewStringEmpty(); String *cleanup = NewStringEmpty(); - if (mvr) { // do prop[gs]et header - if (mvrset) { - Printf(f->def, "static int _wrap_%s(zend_property_reference *property_reference, pval *value) {\n", iname); - } else { - Printf(f->def, "static pval _wrap_%s(zend_property_reference *property_reference) {\n", iname); - } - } else { - // regular header - // Not issued for overloaded functions or static member variables. - if (!overloaded && wrapperType != staticmembervar) { - create_command(iname, wname); - } - Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL); + // Not issued for overloaded functions or static member variables. + if (!overloaded && wrapperType != staticmembervar) { + create_command(iname, wname); } + Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL); emit_parameter_variables(l, f); /* Attach standard typemaps */ @@ -1018,10 +972,8 @@ int num_required = emit_num_required(l); numopt = num_arguments - num_required; - int has_this_ptr = (wrapperType == memberfn && shadow && php_version == 4); - - if (num_arguments - has_this_ptr > 0) { - String *args = NewStringf("zval **args[%d]", num_arguments - has_this_ptr); + if (num_arguments > 0) { + String *args = NewStringf("zval **args[%d]", num_arguments); Wrapper_add_local(f, "args", args); Delete(args); args = NULL; @@ -1036,34 +988,17 @@ Printf(f->code, "SWIG_ResetError();\n"); - if (has_this_ptr) - Printf(f->code, "/* This function uses a this_ptr*/\n"); - - if (native_constructor) { - if (native_constructor == NATIVE_CONSTRUCTOR) { - Printf(f->code, "/* NATIVE Constructor */\n"); - } else { - Printf(f->code, "/* ALTERNATIVE Constructor */\n"); - } - } - - if (mvr && !mvrset) { - Wrapper_add_local(f, "_return_value", "zval _return_value"); - Wrapper_add_local(f, "return_value", "zval *return_value=&_return_value"); - } - if (numopt > 0) { // membervariable wrappers do not have optional args Wrapper_add_local(f, "arg_count", "int arg_count"); Printf(f->code, "arg_count = ZEND_NUM_ARGS();\n"); Printf(f->code, "if(arg_count<%d || arg_count>%d ||\n", num_required, num_arguments); Printf(f->code, " zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)\n"); Printf(f->code, "\tWRONG_PARAM_COUNT;\n\n"); - } else if (!mvr) { - int num = num_arguments - has_this_ptr; - if (num == 0) { + } else { + if (num_arguments == 0) { Printf(f->code, "if(ZEND_NUM_ARGS() != 0) {\n"); } else { - Printf(f->code, "if(ZEND_NUM_ARGS() != %d || zend_get_parameters_array_ex(%d, args) != SUCCESS) {\n", num, num); + Printf(f->code, "if(ZEND_NUM_ARGS() != %d || zend_get_parameters_array_ex(%d, args) != SUCCESS) {\n", num_arguments, num_arguments); } Printf(f->code, "WRONG_PARAM_COUNT;\n}\n\n"); } @@ -1089,19 +1024,7 @@ SwigType *pt = Getattr(p, "type"); - if (mvr) { // do we assert that numargs=2, that i<2 - if (i == 0) { - source = NewString("&(property_reference->object)"); - } else { - source = NewString("&value"); - } - } else { - if (i == 0 && has_this_ptr) { - source = NewString("&this_ptr"); - } else { - source = NewStringf("args[%d]", i - has_this_ptr); - } - } + source = NewStringf("args[%d]", i); String *ln = Getattr(p, "lname"); @@ -1183,24 +1106,6 @@ Replaceall(tm, "$result", "return_value"); Replaceall(tm, "$owner", newobject ? "1" : "0"); Printf(f->code, "%s\n", tm); - // Are we returning a wrapable object? - if (shadow && php_version == 4 && is_shadow(d) && (SwigType_type(d) != T_ARRAY)) { - // Make object. - Printf(f->code, "{\n/* Wrap this return value */\n"); - Printf(f->code, "zval *_cPtr;\n"); - Printf(f->code, "ALLOC_ZVAL(_cPtr);\n"); - Printf(f->code, "*_cPtr = *return_value;\n"); - Printf(f->code, "IN... [truncated message content] |