Skip to content
Browse files

Merge branch 'master' into travis-osx

* master:
  added example with %pythonbegin
  Remove duplicate header includes in director.swg
  Move some header file includes into fragments for UTL languages
  Fix warning suppression using %warnfilter for PHP reserved class names.
  Improve Examples/README
  Recommend compiling with PIC consistently.
  Remove register storage class declarations
  Improve ignore pattern for vim swap files to not match SWIG *.swg files
  [Lua] Add keyword warnings for Lua keywords and Basic Functions.
  Make Lib/ocaml/swigp4.ml a non-generated file.
  Extend php_namewarn_rename to act as a regression test for the warning about built-in function names used in %extend
  -Wallkw now includes keywords for all languages with keyword warnings (previously Go and R were missing).
  Remove incorrect comments
  Add expected functions which get generated to silence testsuite warning
  Rename "struct Global" to "struct Global_" to avoid PHP keyword
  Fix incorrect patch number
  [PHP] Update the lists of PHP keywords with new ones from PHP 5.4 and newer (and some missing ones from 5.3).  Reserved PHP constants names are now checked against enum values and constants, instead of against function and method names.  Built-in PHP function names no longer match methods added by %extend.  Functions and methods named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no longer needlessly renamed.
  Make PHP %keywordwarn message wording consistent with other languages
  Fix comment typos
  Add %$isextendmember for %rename of members added via %extend
  guile std_string test: run test in utf8 locale
  Fix %$ismember %rename predicate for members added via %extend
  fix typo
  Whitespace tweaks
  "if (strlen(msg))" -> "if (msg[0])"
  Just call strcmp() rather than strlen() twice plus zend_binary_strcmp()
  Only call strlen(lc_fname) if we are going to use the result
  CHANGES files corrections since 2.0.12 release
  Add release summary for 2.0.12
  Python 3.3 should now work on Travis
  C++ exception (wrapped by a Python exception as a shadow instance) segfaulting Python
  Fix configure for binary specified by --with-python3
  Executable bits and shebang fixes
  Fix typo in .travis.yml
  Travis testing of Python 3.3 added
  C# examples to use debug flags when using mono interpreter
  Errors tests more visibly show failures as the output of diff
  Fix shadow instance creation failure in Python 3
  Release scripts to release from any branch
  Add release summary for 2.0.12
  Make string encoding explitic
  Turn on Travis testing for maintenance-2.0 branch
  Temporary workaround for bug in Travis build environment
  mkdist script tweaks to support releasing from any named branch
  Guile: illustrate bug in non-ascii string handling
  Guile: make scm to string conversion work with non-ascii strings
  Fix PHP compilation error in ZTS mode (64 bit windows) due to TSRMLS_FETCH() expansion
  octave: update support to Octave version 3.8.0
  C++11 support for new versions of erase and insert in the STL containers.
  Fix unused variable warning in Ruby wrappers when using gcc -Wall
  Fix Visual Studio compile error in C++ wrappers due to #include <exception> within extern "C" block.
  Add missing #include <stddef.h> for offsetof when using -builtin.
  fix "long long" tests for perl v5.6
  Add change note for missing Lua return statements
  Bump version to 2.0.12
  Lua: Fix void return for non-void functions

Conflicts:
	.travis.yml
  • Loading branch information...
2 parents 7496268 + 0ed98c0 commit d246af3b02b7f5a2851c212fc8ac10bcfb570a3e @wsfulton wsfulton committed Feb 21, 2014
Showing with 732 additions and 347 deletions.
  1. +1 −2 .gitignore
  2. +65 −0 CHANGES
  3. +31 −62 CHANGES.current
  4. +1 −1 Doc/Manual/Go.html
  5. +3 −4 Doc/Manual/Java.html
  6. +2 −2 Doc/Manual/Lua.html
  7. +2 −2 Doc/Manual/Perl5.html
  8. +9 −1 Doc/Manual/Python.html
  9. +14 −6 Doc/Manual/Ruby.html
  10. +1 −1 Doc/Manual/SWIGPlus.html
  11. +1 −6 Doc/Manual/Scripting.html
  12. +6 −6 Doc/Manual/Tcl.html
  13. +2 −1 Examples/Makefile.in
  14. +3 −9 Examples/README
  15. +0 −2 Examples/python/performance/constructor/runme.py
  16. +0 −2 Examples/python/performance/func/runme.py
  17. +0 −2 Examples/python/performance/harness.py
  18. +0 −2 Examples/python/performance/hierarchy/runme.py
  19. +0 −2 Examples/python/performance/hierarchy_operator/runme.py
  20. +0 −2 Examples/python/performance/operator/runme.py
  21. 0 Examples/ruby/constants/runme.rb
  22. 0 Examples/ruby/hashargs/runme.rb
  23. 0 Examples/ruby/multimap/runme.rb
  24. 0 Examples/ruby/simple/runme.rb
  25. +2 −0 Examples/test-suite/common.mk
  26. +3 −3 Examples/test-suite/csharp/Makefile.in
  27. +2 −2 Examples/test-suite/errors/Makefile.in
  28. +1 −1 Examples/test-suite/guile/li_std_string_runme.scm
  29. +3 −7 Examples/test-suite/lua/keyword_rename_runme.lua
  30. +2 −1 Examples/test-suite/nested_scope.i
  31. +1 −4 Examples/test-suite/php/director_protected_runme.php
  32. +10 −0 Examples/test-suite/php_namewarn_rename.i
  33. +42 −0 Examples/test-suite/python/rename_predicates_runme.py
  34. +71 −0 Examples/test-suite/rename_predicates.i
  35. +1 −1 Examples/test-suite/wallkw.i
  36. +7 −4 Lib/allkw.swg
  37. +7 −7 Lib/csharp/csharp.swg
  38. +7 −7 Lib/d/dmemberfunctionpointers.swg
  39. +7 −7 Lib/java/java.swg
  40. +2 −1 Lib/lua/lua.swg
  41. +67 −0 Lib/lua/luakw.swg
  42. 0 Lib/ocaml/{swigp4.ml.in → swigp4.ml}
  43. +1 −3 Lib/octave/octcontainer.swg
  44. +0 −1 Lib/perl5/director.swg
  45. +2 −2 Lib/perl5/std_list.i
  46. +2 −2 Lib/perl5/std_map.i
  47. +2 −2 Lib/perl5/std_vector.i
  48. +2 −3 Lib/php/director.swg
  49. +10 −10 Lib/php/globalvar.i
  50. +220 −70 Lib/php/phpkw.swg
  51. +1 −2 Lib/python/director.swg
  52. +1 −3 Lib/python/pycontainer.swg
  53. +4 −4 Lib/python/pyrun.swg
  54. +1 −1 Lib/ruby/director.swg
  55. +1 −3 Lib/ruby/rubycontainer.swg
  56. +1 −1 Lib/std/_std_deque.i
  57. +2 −4 Lib/std/std_common.i
  58. +1 −3 Lib/std/std_except.i
  59. +2 −2 Lib/std/std_map.i
  60. +2 −2 Lib/std/std_unordered_map.i
  61. +1 −0 Lib/swig.swg
  62. +12 −12 Lib/swigrun.swg
  63. +2 −2 Lib/tcl/std_map.i
  64. +2 −2 Lib/tcl/std_vector.i
  65. +3 −3 Lib/typemaps/exception.swg
  66. +8 −0 Lib/typemaps/fragments.swg
  67. +1 −3 Lib/typemaps/traits.swg
  68. +1 −1 Makefile.in
  69. +8 −0 RELEASENOTES
  70. +21 −9 Source/CParse/parser.y
  71. +42 −37 configure.ac
View
3 .gitignore
@@ -3,7 +3,7 @@
*.class
# Editor files and various other junk
-*.sw?
+.*.sw?
*.bak
# Local PCRE
@@ -67,7 +67,6 @@ Examples/Makefile
Examples/guile/Makefile
Examples/test-suite/*/Makefile
Examples/xml/Makefile
-Lib/ocaml/swigp4.ml
/Makefile
Source/Include/stamp-h1
Source/Include/swigconfig.h
View
65 CHANGES
@@ -4,6 +4,71 @@ See the CHANGES.current file for changes in the current version.
See the RELEASENOTES file for a summary of changes in each release.
+Version 2.0.12 (9 Feb 2014)
+===========================
+
+2014-01-16: wsfulton
+ [PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement
+ of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth.
+
+2014-01-13: kwwette
+ [Octave] update support to Octave version 3.8.0
+
+ - Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1
+ will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see
+ http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e
+ So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to
+ enable features requiring Octave version major.minor.patch or later.
+
+ For Octave versions prior to 3.8.1, we reconstruct values for
+ OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER,
+ extracted from Octave's ChangeLogs. An additional hack is needed to
+ distinguish between Octave <= 3.2.x and 3.8.0, neither of which define
+ OCTAVE_API_VERSION_NUMBER.
+
+ - Octave 3.8.0 deprecates symbol_table::varref(), so remove its use
+ for this and future versions of Octave.
+
+ - Octave 3.8.0 removes octave_value::is_real_nd_array(), used in
+ octave_swig_type::dims(). Its use is not required here, so remove it.
+
+ - Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
+
+ - Updated Octave documentation with tested Octave versions, and added a
+ warning against using versions <= 3.x.x, which are no longer tested.
+
+2013-12-22: wsfulton
+ C++11 support for new versions of erase and insert in the STL containers.
+
+ The erase and insert methods in the containers use const_iterator instead
+ of iterator in C++11. There are times when the methods wrapped must match
+ the parameters exactly. Specifically when full type information for
+ template types is missing or SWIG fails to look up the type correctly,
+ for example:
+
+ %include <std_vector.i>
+ typedef float Real;
+ %template(RealVector) std::vector<Real>;
+
+ SWIG does not find std::vector<Real>::iterator because %template using
+ typedefs does not always work and so SWIG doesn't know if the type is
+ copyable and so uses SwigValueWrapper<iterator> which does
+ not support conversion to another type (const_iterator). This resulted
+ in compilation errors when using the C++11 version of the containers.
+
+ Closes #73
+
+2013-10-17: wsfulton
+ [R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include <exception>
+ within extern "C" block.
+
+2013-10-17: wsfulton
+ [Python] Fix SF #1345 - Missing #include <stddef.h> for offsetof when using -builtin.
+
+2013-10-12: wsfulton
+ [Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details()
+ and SWIG_Lua_namespace_register().
+
Version 2.0.11 (15 Sep 2013)
============================
View
93 CHANGES.current
@@ -5,6 +5,37 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.0 (in progress)
============================
+2014-02-21: wsfulton
+ [PHP] Fix warning suppression using %warnfilter for PHP reserved class names.
+
+2014-02-19: olly
+ [Lua] Add keyword warnings for Lua keywords and Basic Functions.
+
+2014-02-19: olly
+ -Wallkw now includes keywords for all languages with keyword
+ warnings (previously Go and R were missing).
+
+2014-02-19: olly
+ [PHP] Update the lists of PHP keywords with new ones from PHP 5.4
+ and newer (and some missing ones from 5.3). Reserved PHP constants
+ names are now checked against enum values and constants, instead
+ of against function and method names. Built-in PHP function names
+ no longer match methods added by %extend. Functions and methods
+ named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
+ longer needlessly renamed.
+
+2014-02-15: wsfulton
+ Fix the %$ismember %rename predicates to also apply to members added via %extend.
+
+ Add %$isextendmember for %rename of members added via %extend. This can be used to
+ distinguish between normal class/struct members and %extend members. For example
+ '%$ismember, %$not %$isextendmember' will now identify just class/struct members.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2014-02-16: hfalcic
+ [Python] Patch #137 - fix crashes/exceptions in exception handling in Python 3.3
+
2014-02-15: wsfulton
[Java] Add support for the cdata library.
@@ -37,41 +68,10 @@ Version 3.0.0 (in progress)
Director exceptions (Swig::DirectorException) now derive from std::exception
and hence provide the what() method. In Python and Ruby, this replaces the now
deprecated DirectorException::getMessage() method.
-
-2014-01-16: wsfulton
- [PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement
- of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth.
-
2014-01-14: diorcety
Patch #112 - Fix symbol resolution involving scopes that have multiple levels
of typedefs - fixes some template resolutions as well as some typemap searches.
-2014-01-13: kwwette
- [Octave] update support to Octave version 3.8.0
-
- - Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1
- will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see
- http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e
- So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to
- enable features requiring Octave version major.minor.patch or later.
-
- For Octave versions prior to 3.8.1, we reconstruct values for
- OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER,
- extracted from Octave's ChangeLogs. An additional hack is needed to
- distinguish between Octave <= 3.2.x and 3.8.0, neither of which define
- OCTAVE_API_VERSION_NUMBER.
-
- - Octave 3.8.0 deprecates symbol_table::varref(), so remove its use
- for this and future versions of Octave.
-
- - Octave 3.8.0 removes octave_value::is_real_nd_array(), used in
- octave_swig_type::dims(). Its use is not required here, so remove it.
-
- - Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
-
- - Updated Octave documentation with tested Octave versions, and added a
- warning against using versions <= 3.x.x, which are no longer tested.
-
2014-01-11: wsfulton
Fix and document the naturalvar feature override behaviour - the naturalvar
feature attached to a variable name has precedence over the naturalvar
@@ -123,27 +123,6 @@ Version 3.0.0 (in progress)
2013-12-23: talby
[Perl] Add support for directors.
-2013-12-22: wsfulton
- C++11 support for new versions of erase and insert in the STL containers.
-
- The erase and insert methods in the containers use const_iterator instead
- of iterator in C++11. There are times when the methods wrapped must match
- the parameters exactly. Specifically when full type information for
- template types is missing or SWIG fails to look up the type correctly,
- for example:
-
- %include <std_vector.i>
- typedef float Real;
- %template(RealVector) std::vector<Real>;
-
- SWIG does not find std::vector<Real>::iterator because %template using
- typedefs does not always work and so SWIG doesn't know if the type is
- copyable and so uses SwigValueWrapper<iterator> which does
- not support conversion to another type (const_iterator). This resulted
- in compilation errors when using the C++11 version of the containers.
-
- Closes #73
-
2013-12-18: ianlancetaylor
[Go] Don't require that Go environment variables be set
when running examples or testsuite when using Go 1 or
@@ -214,20 +193,10 @@ Version 3.0.0 (in progress)
[Java] Apply patch #91 from Marvin Greenberg - Add director:except feature for improved
exception handling in director methods for Java.
-2013-10-17: wsfulton
- [R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include <exception>
- within extern "C" block.
-
-2013-10-17: wsfulton
- [Python] Fix SF #1345 - Missing #include <stddef.h> for offsetof when using -builtin.
-
2013-10-15: vadz
Allow using \l, \L, \u, \U and \E in the substitution part of %(regex:/pattern/subst/)
inside %rename to change the case of the text being replaced.
-2013-10-12: wsfulton
- [Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details()
- and SWIG_Lua_namespace_register().
2013-10-12: wsfulton
[CFFI] Apply #96 - superclass not lispify
View
2 Doc/Manual/Go.html
@@ -55,7 +55,7 @@
<p>
There are (at least) two different Go compilers. One is the gc
-compiler, normally invoked under via the go tool. The other
+compiler, normally invoked via the go tool. The other
is the gccgo compiler, which is a frontend to the gcc compiler suite.
The interface to C/C++ code is completely different for the two Go
compilers. SWIG supports both, selected by a command line option.
View
7 Doc/Manual/Java.html
@@ -332,8 +332,8 @@
<div class="code"><pre>
$ swig -java example.i
-$ gcc -c example_wrap.c -I/usr/java/include -I/usr/java/include/solaris
-$ gcc -c example.c
+$ gcc -fPIC -c example_wrap.c -I/usr/java/include -I/usr/java/include/solaris
+$ gcc -fPIC -c example.c
$ ld -G example_wrap.o example.o -o libexample.so
</pre></div>
@@ -493,8 +493,7 @@
<div class="code"><pre>
% swig -c++ -java example.i
% g++ -c -fpic example.cxx
-% g++ -c -fpic example_wrap.cxx -I/usr/java/j2sdk1.4.1/include -I/usr/java/
-j2sdk1.4.1/include/linux
+% g++ -c -fpic example_wrap.cxx -I/usr/java/j2sdk1.4.1/include -I/usr/java/j2sdk1.4.1/include/linux
% g++ -shared example.o example_wrap.o -o libexample.so
</pre></div>
View
4 Doc/Manual/Lua.html
@@ -240,8 +240,8 @@
</p>
<div class="shell"><pre>
$ swig -lua example.i -o example_wrap.c
-$ gcc -I/usr/include/lua -c example_wrap.c -o example_wrap.o
-$ gcc -c example.c -o example.o
+$ gcc -fPIC -I/usr/include/lua -c example_wrap.c -o example_wrap.o
+$ gcc -fPIC -c example.c -o example.o
$ gcc -shared -I/usr/include/lua -L/usr/lib/lua example_wrap.o example.o -o example.so
</pre></div>
<p>
View
4 Doc/Manual/Perl5.html
@@ -493,8 +493,8 @@
<div class="code"><pre>
$ swig -c++ -perl example.i
-$ CC -c example.cxx
-$ CC -c example_wrap.cxx -I/usr/lib/perl/5.14/i386-linux/CORE
+$ CC -Kpic -c example.cxx
+$ CC -Kpic -c example_wrap.cxx -I/usr/lib/perl/5.14/i386-linux/CORE
$ CC -shared example.o example_wrap.o -o example.so <b>-lCrun</b>
</pre></div>
View
10 Doc/Manual/Python.html
@@ -5551,7 +5551,15 @@
</div>
<p>at the very beginning of his proxy <tt>*.py</tt> file. In SWIG, it may be
-accomplished with <tt>%pythonbegin</tt> directive.</p>
+accomplished with <tt>%pythonbegin</tt> directive as follows:</p>
+
+<div class="code">
+<pre>
+%pythonbegin %{
+from __future__ import absolute_import
+%}
+</pre>
+</div>
<H3><a name="Python_importfrominit"></a>34.11.4 Importing from __init__.py</H3>
View
20 Doc/Manual/Ruby.html
@@ -259,14 +259,22 @@
<div class="code shell">
<pre>$ swig -ruby example.i
-$ gcc -c example.c
-$ gcc -c example_wrap.c -I/usr/local/lib/ruby/1.6/i686-linux
+$ gcc -O2 -fPIC -c example.c
+$ gcc -O2 -fPIC -c example_wrap.c -I/usr/local/lib/ruby/1.6/i686-linux
$ gcc -shared example.o example_wrap.o -o example.so
</pre>
</div>
-<p> For other platforms it may be necessary to compile with the <tt>-fPIC</tt>
-option to generate position-independent code. If in doubt, consult the
+<p>
+The -fPIC option tells GCC to generate position-independent code (PIC)
+which is required for most architectures (it's not vital on x86, but
+still a good idea as it allows code pages from the library to be shared between
+processes). Other compilers may need a different option specified instead of
+-fPIC.
+</p>
+
+<p>
+If in doubt, consult the
manual pages for your compiler and linker to determine the correct set
of options. You might also check the <a href="http://www.dabeaz.com/cgi-bin/wiki.pl">SWIG Wiki</a>
for additional information. </p>
@@ -325,8 +333,8 @@
<div class="code shell">
<pre>
$ swig -c++ -ruby example.i
-$ g++ -c example.cxx
-$ g++ -c example_wrap.cxx -I/usr/local/lib/ruby/1.6/i686-linux
+$ g++ -fPIC -c example.cxx
+$ g++ -fPIC -c example_wrap.cxx -I/usr/local/lib/ruby/1.6/i686-linux
$ g++ -shared example.o example_wrap.o -o example.so
</pre>
</div>
View
2 Doc/Manual/SWIGPlus.html
@@ -216,7 +216,7 @@
<div class="shell">
<pre>
$ swig -c++ -tcl example.i
-$ c++ -c example_wrap.cxx
+$ c++ -fPIC -c example_wrap.cxx
$ c++ example_wrap.o $(OBJS) -o example.so
</pre>
</div>
View
7 Doc/Manual/Scripting.html
@@ -368,17 +368,12 @@
<div class="shell"><pre>
# Build a shared library for Solaris
-gcc -c example.c example_wrap.c -I/usr/local/include
+gcc -fpic -c example.c example_wrap.c -I/usr/local/include
ld -G example.o example_wrap.o -o example.so
# Build a shared library for Linux
gcc -fpic -c example.c example_wrap.c -I/usr/local/include
gcc -shared example.o example_wrap.o -o example.so
-
-# Build a shared library for Irix
-gcc -c example.c example_wrap.c -I/usr/local/include
-ld -shared example.o example_wrap.o -o example.so
-
</pre></div>
<p>
View
12 Doc/Manual/Tcl.html
@@ -139,8 +139,8 @@
<div class="code"><pre>
$ swig -tcl example.i
-$ gcc -c example.c
-$ gcc -c example_wrap.c -I/usr/local/include
+$ gcc -fPIC -c example.c
+$ gcc -fPIC -c example_wrap.c -I/usr/local/include
$ gcc -shared example.o example_wrap.o -o example.so
</pre></div>
@@ -374,8 +374,8 @@
<div class="code"><pre>
% swig -c++ -tcl example.i
-% g++ -c example.cxx
-% g++ -c example_wrap.cxx -I/usr/local/include
+% g++ -fPIC -c example.cxx
+% g++ -fPIC -c example_wrap.cxx -I/usr/local/include
% g++ -shared example.o example_wrap.o -o example.so
</pre></div>
@@ -387,8 +387,8 @@
<div class="code"><pre>
% swig -c++ -tcl example.i
-% CC -c example.cxx
-% CC -c example_wrap.cxx -I/usr/local/include
+% CC -KPIC -c example.cxx
+% CC -KPIC -c example_wrap.cxx -I/usr/local/include
% CC -G example.o example_wrap.o -L/opt/SUNWspro/lib -o example.so -lCrun
</pre></div>
View
3 Examples/Makefile.in
@@ -1203,9 +1203,10 @@ CSHARP_DLNK = @CSHARPDYNAMICLINKING@
CSHARP_LIBPREFIX = @CSHARPLIBRARYPREFIX@
CSHARPCOMPILER = @CSHARPCOMPILER@
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
+CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPCFLAGS = @CSHARPCFLAGS@
CSHARPSO = @CSHARPSO@
-CSHARP_RUNME = $(CSHARPCILINTERPRETER) ./$(RUNME).exe
+CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
# ----------------------------------------------------------------
# Build a CSharp dynamically loadable module (C)
View
12 Examples/README
@@ -1,24 +1,18 @@
SWIG Examples
-The "perl5", "python", "tcl", "guile", "java", "mzscheme", "ruby", and
-"chicken" directories contain a number of simple examples that are
-primarily used for testing.
+The subdirectories of "Examples" named after SWIG's language backends
+contain a number of simple examples that are primarily used for testing.
The file 'index.html' is the top of a hyperlinked document that
contains information about all of the examples along with various
notes related to each example.
-The Examples directory is currently quite incomplete because it
-is being reorganized. A more complete set of examples can be found
-in the SWIG1.1p5 distribution (most of which should still work with
-SWIG1.3).
-
Note: All of the examples rely upon the Makefile in this directory.
You may need to edit it to reflect the configuration of your machine
in case the configure script guesses incorrect settings.
-*** Special note concering C++ ***
+*** Special note concerning C++ ***
The configure script is currently unable to handle all of the possible
options for producing dynamically loadable C++ extensions. Here are
View
2 Examples/python/performance/constructor/runme.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
sys.path.append('..')
import harness
View
2 Examples/python/performance/func/runme.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
sys.path.append('..')
import harness
View
2 Examples/python/performance/harness.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
import time
import imp
View
2 Examples/python/performance/hierarchy/runme.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
sys.path.append('..')
import harness
View
2 Examples/python/performance/hierarchy_operator/runme.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
sys.path.append('..')
import harness
View
2 Examples/python/performance/operator/runme.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env
-
import sys
sys.path.append('..')
import harness
View
0 Examples/ruby/constants/runme.rb 100755 → 100644
File mode changed.
View
0 Examples/ruby/hashargs/runme.rb 100755 → 100644
File mode changed.
View
0 Examples/ruby/multimap/runme.rb 100755 → 100644
File mode changed.
View
0 Examples/ruby/simple/runme.rb 100755 → 100644
File mode changed.
View
2 Examples/test-suite/common.mk
@@ -86,6 +86,7 @@ CPP_TEST_BROKEN += \
li_boost_shared_ptr_template \
nested_private \
overload_complicated \
+ rename_camel \
template_default_pointer \
template_private_assignment \
template_expr \
@@ -323,6 +324,7 @@ CPP_TEST_CASES += \
rename_strip_encoder \
rename_pcre_encoder \
rename_pcre_enum \
+ rename_predicates \
restrict_cplusplus \
return_const_value \
return_value_scope \
View
6 Examples/test-suite/csharp/Makefile.in
@@ -4,8 +4,8 @@
LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs
-INTERPRETER = @CSHARPCILINTERPRETER@
-INTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
+CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
+CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
srcdir = @srcdir@
@@ -75,7 +75,7 @@ run_testcase = \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
- env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) ./$*_runme.exe; \
+ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
View
4 Examples/test-suite/errors/Makefile.in
@@ -35,12 +35,12 @@ include $(srcdir)/../common.mk
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
-$(SWIG) -c++ -python -Wall $(SWIGOPT) $*.i 2> $*.$(ERROR_EXT)
- $(COMPILETOOL) diff $*.stderr $*.newerr
+ $(COMPILETOOL) diff -c $*.stderr $*.newerr
%.ctest:
echo "$(ACTION)ing errors testcase $*"
-$(SWIG) -python -Wall $(SWIGOPT) $*.i 2> $*.$(ERROR_EXT)
- $(COMPILETOOL) diff $*.stderr $*.newerr
+ $(COMPILETOOL) diff -c $*.stderr $*.newerr
%.clean:
View
2 Examples/test-suite/guile/li_std_string_runme.scm
@@ -5,5 +5,5 @@
; Note: when working with non-ascii strings in guile 2
; locale must be set explicitly
; The setlocale call below takes care of that
-(setlocale LC_ALL "")
+(setlocale LC_ALL "en_US.utf8")
(load "../schemerunme/li_std_string.scm")
View
10 Examples/test-suite/lua/keyword_rename_runme.lua
@@ -7,10 +7,6 @@ local env = _ENV -- Lua 5.2
if not env then env = getfenv () end -- Lua 5.1
setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
-
--- assert(kn.end(5) == 5) -- Curretly SWIG/Lua doesn't rename keywords
--- assert(kn.nil(7) == 7)
-
--- But you can always access wrongly named members using string constants
-assert(kn["end"](5) == 5)
-assert(kn["nil"](7) == 7)
+-- Check renaming of Lua keywords
+assert(kn.c_end(5) == 5)
+assert(kn.c_nil(7) == 7)
View
3 Examples/test-suite/nested_scope.i
@@ -6,7 +6,8 @@
%inline %{
namespace ns {
- struct Global {
+ // "global" is a case-insensitive keyword in PHP.
+ struct Global_ {
#ifdef __clang__
struct Outer {
struct Nested;
View
5 Examples/test-suite/php/director_protected_runme.php
@@ -3,11 +3,8 @@
require "tests.php";
require "director_protected.php";
-// No new functions
-check::functions(array(foo_pong,foo_s,foo_q,foo_ping,foo_pang,foo_used,bar_create,bar_pong,bar_used,bar_ping,bar_pang,a_draw,b_draw));
-// No new classes
+check::functions(array(foo_pong,foo_s,foo_q,foo_ping,foo_pang,foo_used,foo_cheer,bar_create,bar_callping,bar_callcheer,bar_cheer,bar_pong,bar_used,bar_ping,bar_pang,a_draw,b_draw));
check::classes(array(Foo,Bar,PrivateFoo,A,B,AA,BB));
-// now new vars
check::globals(array(bar_a));
class FooBar extends Bar {
View
10 Examples/test-suite/php_namewarn_rename.i
@@ -7,6 +7,11 @@
%warnfilter(SWIGWARN_PARSE_KEYWORD) Hello::empty();
#endif
+%ignore prev::operator++;
+%extend prev {
+ void next() { ++(*self); }
+}
+
%inline %{
int Exception() { return 13; }
@@ -26,4 +31,9 @@
void empty() {}
};
+ struct prev {
+ prev & operator++() { }
+ prev operator++(int) { }
+ };
+
%}
View
42 Examples/test-suite/python/rename_predicates_runme.py
@@ -0,0 +1,42 @@
+from rename_predicates import *
+
+r = RenamePredicates(123)
+r.MF_member_function()
+r.MF_static_member_function()
+r.MF_extend_function_before()
+r.MF_extend_function_after()
+GF_global_function()
+
+if r.MV_member_variable != 123:
+ raise RuntimeError("variable wrong")
+r.MV_member_variable = 1234;
+if r.MV_member_variable != 1234:
+ raise RuntimeError("variable wrong")
+
+if cvar.RenamePredicates_MV_static_member_variable != 456:
+ raise RuntimeError("variable wrong")
+cvar.RenamePredicates_MV_static_member_variable = 4567;
+if cvar.RenamePredicates_MV_static_member_variable != 4567:
+ raise RuntimeError("variable wrong")
+
+if cvar.GV_global_variable != 789:
+ raise RuntimeError("variable wrong")
+cvar.GV_global_variable = 7890;
+if cvar.GV_global_variable != 7890:
+ raise RuntimeError("variable wrong")
+
+UC_UPPERCASE()
+LC_lowercase()
+TI_Title()
+FU_FirstUpperCase()
+FL_firstLowerCase()
+CA_CamelCase()
+LC_lowerCamelCase()
+UC_under_case_it()
+
+ex = ExtendCheck()
+ex.MF_real_member1()
+ex.MF_real_member2()
+ex.EX_EXTENDMETHOD1()
+ex.EX_EXTENDMETHOD2()
+ex.EX_EXTENDMETHOD3()
View
71 Examples/test-suite/rename_predicates.i
@@ -0,0 +1,71 @@
+%module rename_predicates
+
+// Test a few of the predicates - %$isfunction etc
+%rename("AF_%(utitle)s", %$isfunction) "";
+%rename("MF_%(utitle)s", %$isfunction, %$ismember) "";
+%rename("GF_%(utitle)s", %$isfunction, %$not %$ismember) "";
+%rename("MV_%(utitle)s", %$isvariable) "";
+%rename("GV_%(utitle)s", %$isvariable, %$isglobal) "";
+
+%extend RenamePredicates {
+ void extend_function_before() {}
+}
+
+%inline %{
+struct RenamePredicates {
+ RenamePredicates(int v = 0) : member_variable(v) {}
+ void member_function() {}
+ static void static_member_function() {}
+ int member_variable;
+ static int static_member_variable;
+};
+int RenamePredicates::static_member_variable = 456;
+int global_variable = 789;
+void global_function() {}
+%}
+
+%extend RenamePredicates {
+ void extend_function_after() {}
+}
+
+// Test the various %rename functions - %(upper) etc
+%rename("UC_%(upper)s") "uppercase";
+%rename("LC_%(lower)s") "LOWERcase";
+%rename("TI_%(title)s") "title";
+%rename("FU_%(firstuppercase)s") "firstUpperCase";
+%rename("FL_%(firstlowercase)s") "FirstLowerCase";
+%rename("CA_%(camelcase)s") "camel_Case";
+%rename("LC_%(lowercamelcase)s") "Lower_camel_Case";
+%rename("UC_%(undercase)s") "UnderCaseIt";
+
+%inline %{
+void uppercase() {}
+void LOWERcase() {}
+void title() {}
+void firstUpperCase() {}
+void FirstLowerCase() {}
+void camel_Case() {}
+void Lower_camel_Case() {}
+void UnderCaseIt() {}
+%}
+
+// Test renaming only member functions in %extend
+%rename("EX_%(upper)s", %$isfunction, %$isextendmember) "";
+%extend ExtendCheck {
+ void ExtendMethod1() {}
+}
+%inline %{
+struct ExtendCheck {
+ void RealMember1() {}
+#ifdef SWIG
+ %extend {
+ void ExtendMethod2() {}
+ }
+#endif
+ void RealMember2() {}
+};
+%}
+%extend ExtendCheck {
+ void ExtendMethod3() {}
+}
+
View
2 Examples/test-suite/wallkw.i
@@ -2,7 +2,7 @@
// test the -Wallkw option
-%warnfilter(SWIGWARN_PARSE_KEYWORD) clone; // 'clone' is a php keyword, renamed as 'c_clone'
+%warnfilter(SWIGWARN_PARSE_KEYWORD) clone; // 'clone' is a PHP keyword, renaming to 'c_clone'
%warnfilter(SWIGWARN_PARSE_KEYWORD) delegate; // 'delegate' is a C# keyword, renaming to '_delegate'
%warnfilter(SWIGWARN_PARSE_KEYWORD) pass; // 'pass' is a python keyword, renaming to '_pass'
%warnfilter(SWIGWARN_PARSE_KEYWORD) alias; // 'alias' is a D keyword, renaming to '_alias'
View
11 Lib/allkw.swg
@@ -4,29 +4,32 @@
/*
Include all the known keyword warnings. Very useful for adding test
- files to the test-suite, or check if your own library is ok for all
+ files to the test-suite, or checking if your own library is ok for all
the swig supported languages.
Use as
swig -Wallkw ...
- If you add a new language, remember to create a separete languagekw.swg
+ If you add a new language, remember to create a separate languagekw.swg
file, and add it here.
*/
%include <chicken/chickenkw.swg>
%include <csharp/csharpkw.swg>
%include <d/dkw.swg>
+%include <go/gokw.swg>
%include <java/javakw.swg>
+%include <lua/luakw.swg>
+%include <ocaml/ocamlkw.swg>
+%include <perl5/perlkw.swg>
%include <php/phpkw.swg>
%include <pike/pikekw.swg>
%include <python/pythonkw.swg>
-%include <ocaml/ocamlkw.swg>
+%include <r/rkw.swg>
%include <ruby/rubykw.swg>
%include <tcl/tclkw.swg>
-%include <perl5/perlkw.swg>
#endif //__Lib_allkw_swg__
View
14 Lib/csharp/csharp.swg
@@ -35,10 +35,10 @@ using global::System.Runtime.InteropServices;
/* Pack binary data into a string */
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register unsigned char uu = *u;
+ unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
@@ -49,11 +49,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
%fragment("SWIG_UnPackData", "header") {
/* Unpack binary data from a string */
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
+ char d = *(c++);
+ unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
View
14 Lib/d/dmemberfunctionpointers.swg
@@ -53,10 +53,10 @@
/* Pack binary data into a string */
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register unsigned char uu = *u;
+ unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
@@ -67,11 +67,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
%fragment("SWIG_UnPackData", "header") {
/* Unpack binary data from a string */
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
+ char d = *(c++);
+ unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
View
14 Lib/java/java.swg
@@ -16,10 +16,10 @@
/* Pack binary data into a string */
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register unsigned char uu = *u;
+ unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
@@ -30,11 +30,11 @@ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
%fragment("SWIG_UnPackData", "header") {
/* Unpack binary data from a string */
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
+ char d = *(c++);
+ unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
View
3 Lib/lua/lua.swg
@@ -9,8 +9,9 @@
* includes
* ----------------------------------------------------------------------------- */
-%include <luatypemaps.swg> /* The typemaps */
+%include <luatypemaps.swg> /* The typemaps */
%include <luaruntime.swg> /* The runtime stuff */
+%include <luakw.swg> /* Warnings for Lua keywords */
//%include <typemaps/swigmacros.swg>
/* -----------------------------------------------------------------------------
View
67 Lib/lua/luakw.swg
@@ -0,0 +1,67 @@
+/*
+ Warnings for Lua keywords, built-in names and bad names.
+*/
+
+#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword, renaming to 'c_" `x` "'", rename="c_%s") `x`
+#define LUABN(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "'" `x` "' conflicts with a basic function in Lua"), %$not %$ismember) `x`
+
+/*
+ Warnings for Lua keywords
+ http://www.lua.org/manual/5.2/manual.html#3.1
+*/
+
+LUAKW(and);
+LUAKW(break);
+LUAKW(do);
+LUAKW(else);
+LUAKW(elseif);
+LUAKW(end);
+LUAKW(false);
+LUAKW(for);
+LUAKW(function);
+LUAKW(goto);
+LUAKW(if);
+LUAKW(in);
+LUAKW(local);
+LUAKW(nil);
+LUAKW(not);
+LUAKW(or);
+LUAKW(repeat);
+LUAKW(return);
+LUAKW(then);
+LUAKW(true);
+LUAKW(until);
+LUAKW(while);
+
+/*
+ Basic functions
+ http://www.lua.org/manual/5.2/manual.html#6.1
+*/
+
+LUABN(assert);
+LUABN(collectgarbage);
+LUABN(dofile);
+LUABN(error);
+LUABN(_G); // Not actually a function
+LUABN(getmetatable);
+LUABN(ipairs);
+LUABN(load);
+LUABN(loadfile);
+LUABN(next);
+LUABN(pairs);
+LUABN(pcall);
+LUABN(print);
+LUABN(rawequal);
+LUABN(rawget);
+LUABN(rawlen);
+LUABN(rawset);
+LUABN(select);
+LUABN(setmetatable);
+LUABN(tonumber);
+LUABN(tostring);
+LUABN(type);
+LUABN(_VERSION); // Not actually a function
+LUABN(xpcall);
+
+#undef LUABN
+#undef LUAKW
View
0 Lib/ocaml/swigp4.ml.in → Lib/ocaml/swigp4.ml
File renamed without changes.
View
4 Lib/octave/octcontainer.swg
@@ -26,9 +26,7 @@
// The Octave C++ Wrap
-%insert(header) %{
-#include <stdexcept>
-%}
+%fragment("<stdexcept>");
%include <std_except.i>
View
1 Lib/perl5/director.swg
@@ -27,7 +27,6 @@
*/
# ifndef SWIG_DIRECTOR_RTDIR
# define SWIG_DIRECTOR_RTDIR
-#include <map>
namespace Swig {
class Director;
View
4 Lib/perl5/std_list.i
@@ -36,9 +36,9 @@
%{
#include <list>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
4 Lib/perl5/std_map.i
@@ -12,9 +12,9 @@
%{
#include <map>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
4 Lib/perl5/std_vector.i
@@ -32,9 +32,9 @@
%{
#include <vector>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
5 Lib/php/director.swg
@@ -102,12 +102,11 @@ namespace Swig {
TSRMLS_FETCH_FROM_CTX(swig_zts_ctx);
zend_class_entry **ce;
zend_function *mptr;
- int name_len = strlen(lc_fname);
if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) {
return false;
}
- if (zend_hash_find(&(*ce)->function_table, lc_fname, name_len + 1, (void **) &mptr) != SUCCESS) {
+ if (zend_hash_find(&(*ce)->function_table, lc_fname, strlen(lc_fname) + 1, (void **) &mptr) != SUCCESS) {
return false;
}
// common.scope points to the declaring class
@@ -128,7 +127,7 @@ namespace Swig {
std::string swig_msg;
public:
DirectorException(int code, const char *hdr, const char *msg TSRMLS_DC) : swig_msg(hdr) {
- if (strlen(msg)) {
+ if (msg[0]) {
swig_msg += " ";
swig_msg += msg;
}
View
20 Lib/php/globalvar.i
@@ -164,7 +164,7 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
convert_to_string_ex(z_var);
s1 = Z_STRVAL_PP(z_var);
- if ((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
+ if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if (s1)
$1 = estrdup(s1);
else
@@ -190,9 +190,9 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
- if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
- if(s1)
- strncpy($1, s1, $1_dim0);
+ if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
+ if (s1)
+ strncpy($1, s1, $1_dim0);
}
}
@@ -216,7 +216,7 @@
$1_ltype _temp;
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
+ if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor");
}
@@ -288,12 +288,12 @@
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
- if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1) )) {
+ if((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) {
if(s1)
efree(s1);
if($1) {
(*z_var)->value.str.val = estrdup($1);
- (*z_var)->value.str.len = strlen($1) +1;
+ (*z_var)->value.str.len = strlen($1) + 1;
} else {
(*z_var)->value.str.val = 0;
(*z_var)->value.str.len = 0;
@@ -314,7 +314,7 @@
zval **z_var;
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
- if($1)
+ if($1)
SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0);
}
@@ -325,10 +325,10 @@
deliberate error cos this code looks bogus to me
zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var);
s1 = Z_STRVAL_PP(z_var);
- if((s1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) {
+ if((s1 == NULL) || strcmp(s1, $1)) {
if($1) {
(*z_var)->value.str.val = estrdup($1);
- (*z_var)->value.str.len = strlen($1)+1;
+ (*z_var)->value.str.len = strlen($1) + 1;
} else {
(*z_var)->value.str.val = 0;
(*z_var)->value.str.len = 0;
View
290 Lib/php/phpkw.swg
@@ -2,37 +2,41 @@
* phpkw.swg
* ----------------------------------------------------------------------------- */
-#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
+/* Keyword (case insensitive) */
+#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x`
-#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, class renamed as 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
+/* Class (case insensitive) */
+#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x`
-#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP",sourcefmt="%(lower)s") `x`
-#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP") "::" `x`
-#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
+/* Constant (case insensitive) */
+#define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x`
+#define PHPBN1b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant,sourcefmt="%(lower)s") `x`
+%define PHPBN1(X)
+ PHPBN1a(X); PHPBN1b(X)
+%enddef
-/*
- From
+/* Constant (case sensitive) */
+#define PHPBN2a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem) `x`
+#define PHPBN2b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant) `x`
+%define PHPBN2(X)
+ PHPBN2a(X); PHPBN2b(X)
+%enddef
- http://aspn.activestate.com/ASPN/docs/PHP/reserved.html
- http://php.net/manual/en/reserved.keywords.php
+#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x`
- and reviewed by Olly Betts.
-
- Further updates from the PHP manual on php.net.
-*/
-
-/* We classify these as kw since PHP will not run if used globally. */
-/* "You cannot use any of the following words as constants, class names,
+/* From: http://php.net/manual/en/reserved.keywords.php
+ * "You cannot use any of the following words as constants, class names,
* function or method names. Using them as variable names is generally OK, but
* could lead to confusion."
*/
-/* case insensitive */
+/* Check is case insensitive - these *MUST* be listed in lower case here */
PHPKW(__halt_compiler);
PHPKW(abstract);
PHPKW(and);
PHPKW(array);
PHPKW(as);
PHPKW(break);
+PHPKW(callable); // As of PHP 5.4
PHPKW(case);
PHPKW(catch);
PHPKW(class);
@@ -57,20 +61,22 @@ PHPKW(eval); // "Language construct"
PHPKW(exit); // "Language construct"
PHPKW(extends);
PHPKW(final);
+PHPKW(finally); // As of PHP 5.5
PHPKW(for);
PHPKW(foreach);
PHPKW(function);
PHPKW(global);
-PHPKW(goto); // As of PHP5.3
+PHPKW(goto); // As of PHP 5.3
PHPKW(if);
PHPKW(implements);
PHPKW(include); // "Language construct"
PHPKW(include_once); // "Language construct"
PHPKW(instanceof);
+PHPKW(insteadof); // As of PHP 5.4
PHPKW(interface);
PHPKW(isset); // "Language construct"
PHPKW(list); // "Language construct"
-PHPKW(namespace); // As of PHP5.3
+PHPKW(namespace); // As of PHP 5.3
PHPKW(new);
PHPKW(or);
PHPKW(print); // "Language construct"
@@ -83,72 +89,89 @@ PHPKW(return); // "Language construct"
PHPKW(static);
PHPKW(switch);
PHPKW(throw);
+PHPKW(trait); // As of PHP 5.4
PHPKW(try);
PHPKW(unset); // "Language construct"
PHPKW(use);
PHPKW(var);
PHPKW(while);
PHPKW(xor);
-// Compile-time constants
-PHPKW(__CLASS__);
-PHPKW(__DIR__); // As of PHP5.3
-PHPKW(__FILE__);
-PHPKW(__FUNCTION__);
-PHPKW(__METHOD__);
-PHPKW(__NAMESPACE__); // As of PHP5.3
-PHPKW(__LINE__);
+PHPKW(yield); // As of PHP 5.5
+
+// Compile-time "magic" constants
+// From: http://php.net/manual/en/reserved.keywords.php
+// also at: http://php.net/manual/en/language.constants.predefined.php
+/* These *MUST* be listed in lower case here */
+PHPKW(__class__);
+PHPKW(__dir__); // As of PHP 5.3
+PHPKW(__file__);
+PHPKW(__function__);
+PHPKW(__line__);
+PHPKW(__method__);
+PHPKW(__namespace__); // As of PHP 5.3
+PHPKW(__trait__); // As of PHP 5.4
/* We classify these as built-in names since they conflict, but PHP still runs */
-/* Type 1: case insensitive */
-PHPBN1(__sleep);
-PHPBN1(__wakeup);
-PHPBN1(not);
-PHPBN1(parent);
-PHPBN1(virtual);
-PHPBN1(NULL);
-PHPBN1(TRUE);
-PHPBN1(FALSE);
+/* Predefined case-insensitive constants */
+/* These *MUST* be listed in lower case here */
+PHPBN1(null);
+PHPBN1(true);
+PHPBN1(false);
-/* Type 2: case sensitive */
-/* "Core Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
-PHPBN2(E_ALL);
-PHPBN2(E_ERROR);
-PHPBN2(E_PARSE);
-PHPBN2(E_WARNING);
-PHPBN2(E_NOTICE);
-PHPBN2(E_CORE_ERROR);
-PHPBN2(E_CORE_WARNING);
-PHPBN2(E_COMPILE_ERROR);
-PHPBN2(E_COMPILE_WARNING);
-PHPBN2(E_USER_ERROR);
-PHPBN2(E_USER_WARNING);
-PHPBN2(E_USER_NOTICE);
-PHPBN2(E_DEPRECATED); // As of PHP 5.3
-PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3
-PHPBN2(PHP_OS);
+/* "Core Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
+/* These are case sensitive */
PHPBN2(PHP_VERSION);
+PHPBN2(PHP_MAJOR_VERSION); // As of PHP 5.2.7
+PHPBN2(PHP_MINOR_VERSION); // As of PHP 5.2.7
+PHPBN2(PHP_RELEASE_VERSION); // As of PHP 5.2.7
+PHPBN2(PHP_VERSION_ID); // As of PHP 5.2.7
+PHPBN2(PHP_EXTRA_VERSION); // As of PHP 5.2.7
+PHPBN2(PHP_ZTS); // As of PHP 5.2.7
+PHPBN2(PHP_DEBUG); // As of PHP 5.2.7
+PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3.0
+PHPBN2(PHP_OS);
PHPBN2(PHP_SAPI);
-PHPBN2(PHP_EOL);
-PHPBN2(PHP_INT_MAX);
-PHPBN2(PHP_INT_SIZE);
+PHPBN2(PHP_EOL); // As of PHP 5.0.2
+PHPBN2(PHP_INT_MAX); // As of PHP 5.0.5
+PHPBN2(PHP_INT_SIZE); // As of PHP 5.0.5
PHPBN2(DEFAULT_INCLUDE_PATH);
PHPBN2(PEAR_INSTALL_DIR);
PHPBN2(PEAR_EXTENSION_DIR);
PHPBN2(PHP_EXTENSION_DIR);
PHPBN2(PHP_PREFIX);
PHPBN2(PHP_BINDIR);
+PHPBN2(PHP_BINARY); // As of PHP 5.4
+PHPBN2(PHP_MANDIR); // As of PHP 5.3.7
PHPBN2(PHP_LIBDIR);
PHPBN2(PHP_DATADIR);
PHPBN2(PHP_SYSCONFDIR);
PHPBN2(PHP_LOCALSTATEDIR);
PHPBN2(PHP_CONFIG_FILE_PATH);
PHPBN2(PHP_CONFIG_FILE_SCAN_DIR);
PHPBN2(PHP_SHLIB_SUFFIX);
+PHPBN2(E_ERROR);
+PHPBN2(E_WARNING);
+PHPBN2(E_PARSE);
+PHPBN2(E_NOTICE);
+PHPBN2(E_CORE_ERROR);
+PHPBN2(E_CORE_WARNING);
+PHPBN2(E_COMPILE_ERROR);
+PHPBN2(E_COMPILE_WARNING);
+PHPBN2(E_USER_ERROR);
+PHPBN2(E_USER_WARNING);
+PHPBN2(E_USER_NOTICE);
+PHPBN2(E_DEPRECATED); // As of PHP 5.3.0
+PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3.0
+PHPBN2(E_ALL);
+PHPBN2(E_STRICT);
+PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0
+// TRUE, FALSE, NULL are listed on the same page, but are actually
+// case-insensitive, whereas all the other constants listed there seem to be
+// case-sensitive, so we handle TRUE, FALSE, NULL in PHPBN1.
PHPBN2(PHP_OUTPUT_HANDLER_START);
PHPBN2(PHP_OUTPUT_HANDLER_CONT);
PHPBN2(PHP_OUTPUT_HANDLER_END);
-PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3
/* These don't actually seem to be set (tested on Linux, I guess they're
* Windows only?) */
PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3
@@ -162,7 +185,7 @@ PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3
PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3
-/* "Standard Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */
+/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */
PHPBN2(EXTR_OVERWRITE);
PHPBN2(EXTR_SKIP);
PHPBN2(EXTR_PREFIX_SAME);
@@ -370,10 +393,6 @@ PHPBN2(LOG_NDELAY);
PHPBN2(LOG_NOWAIT);
PHPBN2(LOG_PERROR);
-/* Added in PHP5 */
-PHPBN2(E_STRICT);
-PHPBN2(__COMPILER_HALT_OFFSET__);
-
/* Added in PHP 5.2 */
PHPBN2(PREG_BACKTRACK_LIMIT_ERROR);
PHPBN2(PREG_BAD_UTF8_ERROR);
@@ -485,17 +504,143 @@ PHPBN2(SIG_UNBLOCK);
PHPBN2(TRAP_BRKPT);
PHPBN2(TRAP_TRACE);
-/* Class names reserved by PHP */
-/* case insensitive */
+/* Added in PHP 5.4 */
+PHPBN2(ENT_DISALLOWED);
+PHPBN2(ENT_HTML401);
+PHPBN2(ENT_HTML5);
+PHPBN2(ENT_SUBSTITUTE);
+PHPBN2(ENT_XML1);
+PHPBN2(ENT_XHTML);
+PHPBN2(IPPROTO_IP);
+PHPBN2(IPPROTO_IPV6);
+PHPBN2(IPV6_MULTICAST_HOPS);
+PHPBN2(IPV6_MULTICAST_IF);
+PHPBN2(IPV6_MULTICAST_LOOP);
+PHPBN2(IP_MULTICAST_IF);
+PHPBN2(IP_MULTICAST_LOOP);
+PHPBN2(IP_MULTICAST_TTL);
+PHPBN2(MCAST_JOIN_GROUP);
+PHPBN2(MCAST_LEAVE_GROUP);
+PHPBN2(MCAST_BLOCK_SOURCE);
+PHPBN2(MCAST_UNBLOCK_SOURCE);
+PHPBN2(MCAST_JOIN_SOURCE_GROUP);
+PHPBN2(MCAST_LEAVE_SOURCE_GROUP);
+PHPBN2(CURLOPT_MAX_RECV_SPEED_LARGE);
+PHPBN2(CURLOPT_MAX_SEND_SPEED_LARGE);
+PHPBN2(LIBXML_HTML_NODEFDTD);
+PHPBN2(LIBXML_HTML_NOIMPLIED);
+PHPBN2(LIBXML_PEDANTIC);
+PHPBN2(OPENSSL_CIPHER_AES_128_CBC);
+PHPBN2(OPENSSL_CIPHER_AES_192_CBC);
+PHPBN2(OPENSSL_CIPHER_AES_256_CBC);
+PHPBN2(OPENSSL_RAW_DATA);
+PHPBN2(OPENSSL_ZERO_PADDING);
+PHPBN2(PHP_OUTPUT_HANDLER_CLEAN);
+PHPBN2(PHP_OUTPUT_HANDLER_CLEANABLE);
+PHPBN2(PHP_OUTPUT_HANDLER_DISABLED);
+PHPBN2(PHP_OUTPUT_HANDLER_FINAL);
+PHPBN2(PHP_OUTPUT_HANDLER_FLUSH);
+PHPBN2(PHP_OUTPUT_HANDLER_FLUSHABLE);
+PHPBN2(PHP_OUTPUT_HANDLER_REMOVABLE);
+PHPBN2(PHP_OUTPUT_HANDLER_STARTED);
+PHPBN2(PHP_OUTPUT_HANDLER_STDFLAGS);
+PHPBN2(PHP_OUTPUT_HANDLER_WRITE);
+PHPBN2(PHP_SESSION_ACTIVE);
+PHPBN2(PHP_SESSION_DISABLED);
+PHPBN2(PHP_SESSION_NONE);
+PHPBN2(STREAM_META_ACCESS);
+PHPBN2(STREAM_META_GROUP);
+PHPBN2(STREAM_META_GROUP_NAME);
+PHPBN2(STREAM_META_OWNER);
+PHPBN2(STREAM_META_OWNER_NAME);
+PHPBN2(STREAM_META_TOUCH);
+PHPBN2(ZLIB_ENCODING_DEFLATE);
+PHPBN2(ZLIB_ENCODING_GZIP);
+PHPBN2(ZLIB_ENCODING_RAW);
+PHPBN2(U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR);
+PHPBN2(IDNA_CHECK_BIDI);
+PHPBN2(IDNA_CHECK_CONTEXTJ);
+PHPBN2(IDNA_NONTRANSITIONAL_TO_ASCII);
+PHPBN2(IDNA_NONTRANSITIONAL_TO_UNICODE);
+PHPBN2(INTL_IDNA_VARIANT_2003);
+PHPBN2(INTL_IDNA_VARIANT_UTS46);
+PHPBN2(IDNA_ERROR_EMPTY_LABEL);
+PHPBN2(IDNA_ERROR_LABEL_TOO_LONG);
+PHPBN2(IDNA_ERROR_DOMAIN_NAME_TOO_LONG);
+PHPBN2(IDNA_ERROR_LEADING_HYPHEN);
+PHPBN2(IDNA_ERROR_TRAILING_HYPHEN);
+PHPBN2(IDNA_ERROR_HYPHEN_3_4);
+PHPBN2(IDNA_ERROR_LEADING_COMBINING_MARK);
+PHPBN2(IDNA_ERROR_DISALLOWED);
+PHPBN2(IDNA_ERROR_PUNYCODE);
+PHPBN2(IDNA_ERROR_LABEL_HAS_DOT);
+PHPBN2(IDNA_ERROR_INVALID_ACE_LABEL);
+PHPBN2(IDNA_ERROR_BIDI);
+PHPBN2(IDNA_ERROR_CONTEXTJ);
+PHPBN2(JSON_PRETTY_PRINT);
+PHPBN2(JSON_UNESCAPED_SLASHES);
+PHPBN2(JSON_NUMERIC_CHECK);
+PHPBN2(JSON_UNESCAPED_UNICODE);
+PHPBN2(JSON_BIGINT_AS_STRING);
+
+/* Added in PHP 5.5 */
+PHPBN2(IMG_AFFINE_TRANSLATE);
+PHPBN2(IMG_AFFINE_SCALE);
+PHPBN2(IMG_AFFINE_ROTATE);
+PHPBN2(IMG_AFFINE_SHEAR_HORIZONTAL);
+PHPBN2(IMG_AFFINE_SHEAR_VERTICAL);
+PHPBN2(IMG_CROP_DEFAULT);
+PHPBN2(IMG_CROP_TRANSPARENT);
+PHPBN2(IMG_CROP_BLACK);
+PHPBN2(IMG_CROP_WHITE);
+PHPBN2(IMG_CROP_SIDES);
+PHPBN2(IMG_FLIP_BOTH);
+PHPBN2(IMG_FLIP_HORIZONTAL);
+PHPBN2(IMG_FLIP_VERTICAL);
+PHPBN2(IMG_BELL);
+PHPBN2(IMG_BESSEL);
+PHPBN2(IMG_BICUBIC);
+PHPBN2(IMG_BICUBIC_FIXED);
+PHPBN2(IMG_BLACKMAN);
+PHPBN2(IMG_BOX);
+PHPBN2(IMG_BSPLINE);
+PHPBN2(IMG_CATMULLROM);
+PHPBN2(IMG_GAUSSIAN);
+PHPBN2(IMG_GENERALIZED_CUBIC);
+PHPBN2(IMG_HERMITE);
+PHPBN2(IMG_HAMMING);
+PHPBN2(IMG_HANNING);
+PHPBN2(IMG_MITCHELL);
+PHPBN2(IMG_POWER);
+PHPBN2(IMG_QUADRATIC);
+PHPBN2(IMG_SINC);
+PHPBN2(IMG_NEAREST_NEIGHBOUR);
+PHPBN2(IMG_WEIGHTED4);
+PHPBN2(IMG_TRIANGLE);
+PHPBN2(JSON_ERROR_RECURSION);
+PHPBN2(JSON_ERROR_INF_OR_NAN);
+PHPBN2(JSON_ERROR_UNSUPPORTED_TYPE);
+PHPBN2(MYSQLI_SERVER_PUBLIC_KEY);
+
+/* Added in PHP 5.6 */
+PHPBN2(LDAP_ESCAPE_DN);
+PHPBN2(LDAP_ESCAPE_FILTER);
+
+/* Class names reserved by PHP (case insensitive) */
+PHPCN(directory);
PHPCN(stdclass);
PHPCN(__php_incomplete_class);
-PHPCN(directory);
-/* Added in PHP5 (this list apparently depends which extensions you load by default). */
-PHPCN(parent);
-PHPCN(self);
+/* Added in PHP5. */
PHPCN(exception);
+PHPCN(errorexception); // As of PHP 5.1
PHPCN(php_user_filter);
-PHPCN(errorexception);
+PHPCN(closure); // As of PHP 5.3
+PHPCN(generator); // As of PHP 5.5
+PHPCN(self);
+PHPCN(static);
+PHPCN(parent);
+/* From extensions (which of these are actually predefined depends which
+ * extensions are loaded by default). */
PHPCN(xmlwriter);
PHPCN(libxmlerror);
PHPCN(simplexmlelement);
@@ -588,7 +733,8 @@ PHPCN(sqliteexception);
PHPCN(datetime);
/* Built-in PHP functions (incomplete). */
-/* Includes Array Functions - http://us3.php.net/manual/en/ref.array.php */
+/* Includes Array Functions - http://php.net/manual/en/ref.array.php */
+/* Check is case insensitive - these *MUST* be listed in lower case here */
PHPFN(acos);
PHPFN(array_change_key_case);
PHPFN(array_chunk);
@@ -688,7 +834,11 @@ PHPFN(uksort);
PHPFN(usort);
#undef PHPKW
+#undef PHPBN1a
+#undef PHPBN1b
#undef PHPBN1
+#undef PHPBN2a
+#undef PHPBN2b
#undef PHPBN2
#undef PHPCN
#undef PHPFN
View
3 Lib/python/director.swg
@@ -62,7 +62,6 @@
*/
# ifndef SWIG_DIRECTOR_RTDIR
# define SWIG_DIRECTOR_RTDIR
-#include <map>
namespace Swig {
class Director;
@@ -179,7 +178,7 @@ namespace Swig {
public:
DirectorException(PyObject *error, const char *hdr ="", const char *msg ="") : swig_msg(hdr) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- if (strlen(msg)) {
+ if (msg[0]) {
swig_msg += " ";
swig_msg += msg;
}
View
4 Lib/python/pycontainer.swg
@@ -32,9 +32,7 @@
/**** The PySequence C++ Wrap ***/
-%insert(header) %{
-#include <stdexcept>
-%}
+%fragment("<stdexcept>");
%include <std_except.i>
View
8 Lib/python/pyrun.swg
@@ -175,7 +175,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
}
if (!PyTuple_Check(args)) {
if (min <= 1 && max >= 1) {
- register int i;
+ int i;
objs[0] = args;
for (i = 1; i < max; ++i) {
objs[i] = 0;
@@ -185,7 +185,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
- register Py_ssize_t l = PyTuple_GET_SIZE(args);
+ Py_ssize_t l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
name, (min == max ? "" : "at least "), (int)min, (int)l);
@@ -195,7 +195,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
- register int i;
+ int i;
for (i = 0; i < l; ++i) {
objs[i] = PyTuple_GET_ITEM(args, i);
}
@@ -1310,7 +1310,7 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
}
} else {
#if PY_VERSION_HEX >= 0x03000000
- inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
+ inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
if (inst) {
PyObject_SetAttr(inst, SWIG_This(), swig_this);
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
View
2 Lib/ruby/director.swg
@@ -118,7 +118,7 @@ namespace Swig {
}
DirectorException(VALUE error, const char *hdr, const char *msg ="") : swig_error(error), swig_msg(hdr) {
- if (strlen(msg)) {
+ if (msg[0]) {
swig_msg += " ";
swig_msg += msg;
}
View
4 Lib/ruby/rubycontainer.swg
@@ -26,9 +26,7 @@
/**** The RubySequence C++ Wrap ***/
-%insert(header) %{
-#include <stdexcept>
-%}
+%fragment("<stdexcept>");
%include <std_except.i>
View
2 Lib/std/_std_deque.i
@@ -10,8 +10,8 @@
%{
#include <deque>
-#include <stdexcept>
%}
+%fragment("<stdexcept>");
/* This macro defines all of the standard methods for a deque. This
View
6 Lib/std/std_common.i
@@ -24,10 +24,8 @@
//
%fragment("<string>");
-%{
-#include <stdexcept>
-#include <stddef.h>
-%}
+%fragment("<stdexcept>");
+%fragment("<stddef.h>");
%fragment("StdIteratorTraits","header",fragment="<stddef.h>") %{
View
4 Lib/std/std_except.i
@@ -2,9 +2,7 @@
#error "do not use this version of std_except.i"
#endif
-%{
-#include <stdexcept>
-%}
+%fragment("<stdexcept>");
#if defined(SWIG_STD_EXCEPTIONS_AS_CLASSES)
View
4 Lib/std/std_map.i
@@ -57,9 +57,9 @@
%{
#include <map>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
4 Lib/std/std_unordered_map.i
@@ -60,9 +60,9 @@
%{
#include <unordered_map>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
1 Lib/swig.swg
@@ -297,6 +297,7 @@ static int NAME(TYPE x) {
%define %$ismember "match$ismember"="1" %enddef
%define %$isglobal %$not %$ismember %enddef
+%define %$isextendmember "match$isextendmember"="1" %enddef
%define %$innamespace "match$parentNode$nodeType"="namespace" %enddef
%define %$ispublic "match$access"="public" %enddef
View
24 Lib/swigrun.swg
@@ -404,14 +404,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *iter = start;
do {
if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
+ size_t l = 0;
+ size_t r = iter->size - 1;
do {
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
+ size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
if (iname) {
- register int compare = strcmp(name, iname);
+ int compare = strcmp(name, iname);
if (compare == 0) {
return iter->types[i];
} else if (compare < 0) {
@@ -455,7 +455,7 @@ SWIG_TypeQueryModule(swig_module_info *start,
of the str field (the human readable name) */
swig_module_info *iter = start;
do {
- register size_t i = 0;
+ size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return iter->types[i];
@@ -474,10 +474,10 @@ SWIG_TypeQueryModule(swig_module_info *start,
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ const unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register unsigned char uu = *u;
+ unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
@@ -489,11 +489,11 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
+ unsigned char *u = (unsigned char *) ptr;
+ const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
+ char d = *(c++);
+ unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
View
4 Lib/tcl/std_map.i
@@ -13,9 +13,9 @@
%{
#include <map>
-#include <algorithm>
-#include <stdexcept>
%}
+%fragment("<algorithm>");
+%fragment("<stdexcept>");
// exported class
View
4 Lib/tcl/std_vector.i
@@ -29,10 +29,10 @@
// ------------------------------------------------------------------------
%fragment("<string>");
+%fragment("<stdexcept>");
+%fragment("<algorithm>");
%{
#include <vector>
-#include <algorithm>
-#include <stdexcept>
Tcl_Obj* SwigString_FromString(const std::string &s) {
return Tcl_NewStringObj(s.data(), (int)s.length());
View
6 Lib/typemaps/exception.swg
@@ -52,9 +52,9 @@
}
}
*/
-%{
-#include <stdexcept>
-%}
+
+%fragment("<stdexcept>");
+
%define SWIG_CATCH_STDEXCEPT
/* catching std::exception */
catch (std::invalid_argument& e) {
View
8 Lib/typemaps/fragments.swg
@@ -157,6 +157,14 @@
#include <string>
%}
+%fragment("<stdexcept>", "header") %{
+#include <stdexcept>
+%}
+
+%fragment("<algorithm>", "header") %{
+#include <algorithm>
+%}
+
%fragment("SWIG_isfinite","header",fragment="<math.h>,<float.h>") %{
/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
#ifndef SWIG_isfinite
View
4 Lib/typemaps/traits.swg
@@ -22,9 +22,7 @@
//
%fragment("<string>");
-%{
-#include <stdexcept>
-%}
+%fragment("<stdexcept>");
%fragment("Traits","header",fragment="<string>")
{
View
2 Makefile.in
@@ -391,7 +391,7 @@ clean-ccache:
# DISTCLEAN - clean what configure built
#####################################################################
-DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool preinst-swig Lib/ocaml/swigp4.ml
+DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool preinst-swig
distclean-helper: distclean-test-suite distclean-examples distclean-dead
View
8 RELEASENOTES
@@ -4,6 +4,14 @@ and CHANGES files.
Release Notes
=============
+SWIG-2.0.12 summary:
+- This is a maintenance release backporting some fixes from the pending
+ 3.0.0 release.
+- Octave 3.8 support added.
+- C++11 support for new versions of erase/insert in the STL containers.
+- Compilation fixes on some systems for the generated Lua, PHP, Python
+ and R wrappers.
+
SWIG-2.0.11 summary:
- Minor bug fixes and enhancements mostly in Python, but also
C#, Lua, Ocaml, Octave, Perl, PHP, Python, R, Ruby, Tcl.
View
30 Source/CParse/parser.y
@@ -356,10 +356,17 @@ static void add_symbols(Node *n) {
}
Delete(prefix);
}
-
- Setattr(n,"ismember","1");
}
}
+
+ if (!isfriend && (inclass || extendmode)) {
+ Setattr(n,"ismember","1");
+ }
+
+ if (extendmode) {
+ Setattr(n,"isextendmember","1");
+ }
+
if (!isfriend && inclass) {
if ((cplus_mode != CPLUS_PUBLIC)) {
only_csymbol = 1;
@@ -1389,6 +1396,7 @@ static void mark_nodes_as_extend(Node *n) {
for (; n; n = nextSibling(n)) {
if (Getattr(n, "template") && Strcmp(nodeType(n), "class") == 0)
continue;
+ /* Fix me: extend is not a feature. Replace with isextendmember? */
Setattr(n, "feature:extend", &q