summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Zager <szager@gmail.com>2011-04-03 03:14:19 +0000
committerStefan Zager <szager@gmail.com>2011-04-03 03:14:19 +0000
commitf759999f40980df806e87ca0f2ea7cee7996173d (patch)
tree32914c4bb80584b3c18c216fd51f85f28494fdad
parenta403518d03afce2b74139b004f6ea1dddc6aca37 (diff)
parentf24d1b99b1647d398158c1d615f56bf5e426a0e4 (diff)
downloadswig-f759999f40980df806e87ca0f2ea7cee7996173d.tar.gz
Merged trunk through revision 12591
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12592 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--ANNOUNCE8
-rw-r--r--CHANGES72
-rw-r--r--CHANGES.current53
-rw-r--r--Doc/Manual/Contents.html1
-rw-r--r--Doc/Manual/D.html2
-rw-r--r--Doc/Manual/Sections.html2
-rw-r--r--Examples/test-suite/csharp/Makefile.in7
-rw-r--r--Examples/test-suite/csharp/enum_thorough_runme.cs22
-rw-r--r--Examples/test-suite/csharp/enum_thorough_simple_runme.cs22
-rw-r--r--Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs22
-rw-r--r--Examples/test-suite/csharp/friends_runme.cs43
-rw-r--r--Examples/test-suite/enum_thorough.i53
-rw-r--r--Examples/test-suite/java/enum_thorough_proper_runme.java22
-rw-r--r--Examples/test-suite/java/enum_thorough_runme.java22
-rw-r--r--Examples/test-suite/java/enum_thorough_simple_runme.java22
-rw-r--r--Examples/test-suite/java/enum_thorough_typeunsafe_runme.java22
-rw-r--r--Examples/test-suite/java/friends_runme.java53
-rw-r--r--Examples/test-suite/null_pointer.i4
-rw-r--r--Examples/test-suite/smart_pointer_template_const_overload.i6
-rw-r--r--Examples/test-suite/tcl/null_pointer_runme.tcl21
-rw-r--r--Lib/lua/lua.swg4
-rw-r--r--Lib/r/rfragments.swg6
-rw-r--r--Lib/tcl/tclapi.swg1
-rw-r--r--Lib/tcl/tclinit.swg23
-rw-r--r--Lib/tcl/tclrun.swg14
-rw-r--r--README2
-rw-r--r--RELEASENOTES4
-rw-r--r--Source/CParse/parser.y18
-rw-r--r--Source/Modules/chicken.cxx3
-rw-r--r--Source/Modules/csharp.cxx22
-rw-r--r--Source/Modules/guile.cxx3
-rw-r--r--Source/Modules/java.cxx22
-rw-r--r--Source/Modules/lang.cxx3
-rw-r--r--Source/Modules/mzscheme.cxx3
-rw-r--r--Source/Modules/ocaml.cxx3
-rw-r--r--Source/Modules/pike.cxx6
-rw-r--r--Source/Modules/tcl8.cxx12
-rw-r--r--configure.in5
38 files changed, 521 insertions, 112 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index ba23f823c..1a13e074f 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 2.0.3 (in progress) ***
+*** ANNOUNCE: SWIG 2.0.4 (29 March 2011) ***
http://www.swig.org
-We're pleased to announce SWIG-2.0.3, the latest SWIG release.
+We're pleased to announce SWIG-2.0.4, the latest SWIG release.
What is SWIG?
=============
@@ -21,11 +21,11 @@ Availability
============
The release is available for download on Sourceforge at
- http://prdownloads.sourceforge.net/swig/swig-2.0.3.tar.gz
+ http://prdownloads.sourceforge.net/swig/swig-2.0.4.tar.gz
A Windows version is also available at
- http://prdownloads.sourceforge.net/swig/swigwin-2.0.3.zip
+ http://prdownloads.sourceforge.net/swig/swigwin-2.0.4.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.
diff --git a/CHANGES b/CHANGES
index 324eb5160..7e930159e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,78 @@ SWIG (Simplified Wrapper and Interface Generator)
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.3 (29 March 2011)
+=============================
+
+2011-03-29: wsfulton
+ [R] Apply patch #3239076 from Marie White fixing strings for R >= 2.7.0
+
+2011-03-29: wsfulton
+ [Tcl] Apply patch #3248280 from Christian Delbaere which adds better error messages when
+ the incorrect number or type of arguments are passed to overloaded methods.
+
+2011-03-29: wsfulton
+ [Tcl] Apply patch #3224663 from Christian Delbaere.
+ 1. Fix when function returns a NULL value, a "NULL" command will be created in the Tcl interpreter
+ and calling this command will cause a segmentation fault.
+
+ 2. Previous implementation searches for class methods using a linear search causing performance issues
+ in wrappers for classes with many member functions. The patch adds a method hash table to classes and
+ changes method name lookup to use the hash table instead of doing a linear search.
+
+2011-03-26: wsfulton
+ [C#, Java] SF bug #3195112 - fix wrapping of enums that are type char, for example:
+ enum { X = 'X'; }
+
+2011-03-21: vadz
+ Allow setting PCRE_CFLAGS and PCRE_LIBS during configuration to override the values returned by
+ pcre-config, e.g. to allow using a static version of PCRE library.
+
+2011-03-17: wsfulton
+ [UTL] Add missing headers in generated STL wrappers to fix compilation with gcc-4.6.
+
+2011-03-17: wsfulton
+ Fix regression introduced in swig-2.0.2 where filenames with spaces were not found
+ when used with %include and %import. Reported by Shane Liesegang.
+
+2011-03-15: wsfulton
+ [UTL] Fix overloading when using const char[], problem reported by David Maxwell.
+ Similarly for char[ANY] and const char[ANY].
+
+2011-03-15: wsfulton
+ [C#] Apply patch #3212624 fixing std::map Keys property.
+
+2011-03-14: olly
+ [PHP] Fix handling of overloaded methods/functions where some
+ return void and others don't - whether this worked or not depended
+ on the order they were encountered in (SF#3208299).
+
+2011-03-13: klickverbot
+ [D] Extended support for C++ namespaces (nspace feature).
+
+2011-03-12: olly
+ [PHP] Fix sharing of type information between multiple SWIG-wrapped
+ modules (SF#3202463).
+
+2011-03-09: wsfulton
+ [Python] Fix SF #3194294 - corner case bug when 'NULL' is used as the default value
+ for a primitive type parameter in a method declaration.
+
+2011-03-07: olly
+ [PHP] Don't use zend_error_noreturn() for cases where the function
+ returns void - now this issue can only matter if you have a function
+ or method which is directed and returns non-void.
+
+2011-03-06: olly
+ [PHP] Add casts to the typemaps for long long and unsigned long
+ long to avoid issues when they are used with shorter types via
+ %apply.
+
+2011-03-02: wsfulton
+ Templated smart pointers overloaded with both const and non const operator-> generated uncompilable
+ code when the pointee was a class with either public member variables or static methods.
+ Regression in 2.0.x reported as working in 1.3.40 by xantares on swig-user mailing list.
+
Version 2.0.2 (20 February 2011)
================================
diff --git a/CHANGES.current b/CHANGES.current
index aa0a7453c..eab9be62d 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -2,55 +2,10 @@ This file contains the changes for the current release.
See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release.
-Version 2.0.3 (in progress)
+Version 2.0.4 (in progress)
===========================
-2011-03-21: vadz
- [build] Allow setting PCRE_CFLAGS and PCRE_LIBS to override the values returned by
- pcre-config, e.g. to allow using a static version of PCRE library.
-
-2011-03-17: wsfulton
- [UTL] Add missing headers in generated STL wrappers to fix compilation with gcc-4.6.
-
-2011-03-17: wsfulton
- Fix regression introduced in swig-2.0.2 where filenames with spaces were not found
- when used with %include and %import. Reported by Shane Liesegang.
-
-2011-03-15: wsfulton
- [UTL] Fix overloading when using const char[], problem reported by David Maxwell.
- Similarly for char[ANY] and const char[ANY].
-
-2011-03-15: wsfulton
- [C#] Apply patch #3212624 fixing std::map Keys property.
-
-2011-03-14: olly
- [PHP] Fix handling of overloaded methods/functions where some
- return void and others don't - whether this worked or not depended
- on the order they were encountered in (SF#3208299).
-
-2011-03-13: klickverbot
- [D] Extended support for C++ namespaces (nspace feature).
-
-2011-03-12: olly
- [PHP] Fix sharing of type information between multiple SWIG-wrapped
- modules (SF#3202463).
-
-2011-03-09: wsfulton
- [Python] Fix SF #3194294 - corner case bug when 'NULL' is used as the default value
- for a primitive type parameter in a method declaration.
-
-2011-03-07: olly
- [PHP] Don't use zend_error_noreturn() for cases where the function
- returns void - now this issue can only matter if you have a function
- or method which is directed and returns non-void.
-
-2011-03-06: olly
- [PHP] Add casts to the typemaps for long long and unsigned long
- long to avoid issues when they are used with shorter types via
- %apply.
-
-2011-03-02: wsfulton
- Templated smart pointers overloaded with both const and non const operator-> generated uncompilable
- code when the pointee was a class with either public member variables or static methods.
- Regression in 2.0.x reported as working in 1.3.40 by xantares on swig-user mailing list.
+2011-04-01: wsfulton
+ Add in missing wrappers for friend functions for some target languages, mostly
+ the non-scripting languages like Java and C#.
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index 2937b6586..74a201bc6 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -729,6 +729,7 @@
<li><a href="D.html#D_directors">D Directors</a>
<li><a href="D.html#D_other_features">Other features</a>
<ul>
+<li><a href="D.html#D_nspace">Extended namespace support (<tt>nspace</tt>)</a>
<li><a href="D.html#D_native_pointer_support">Native pointer support</a>
<li><a href="D.html#D_operator_overloading">Operator overloading</a>
<li><a href="D.html#D_test_suite">Running the test-suite</a>
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 3e4ad9bc5..abcffa58e 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -28,7 +28,7 @@
<li><a href="#D_directors">D Directors</a>
<li><a href="#D_other_features">Other features</a>
<ul>
-<li><a href="#D_nspace">Extended namespace support (<tt>nspace</tt>)</a></li>
+<li><a href="#D_nspace">Extended namespace support (<tt>nspace</tt>)</a>
<li><a href="#D_native_pointer_support">Native pointer support</a>
<li><a href="#D_operator_overloading">Operator overloading</a>
<li><a href="#D_test_suite">Running the test-suite</a>
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 4073c74e8..62305b9ed 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -6,7 +6,7 @@
<body bgcolor="#ffffff">
<H1><a name="Sections"></a>SWIG-2.0 Documentation</H1>
-Last update : SWIG-2.0.3 (in progress)
+Last update : SWIG-2.0.4 (in progress)
<H2>Sections</H2>
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 18f10c567..f9a4bd76f 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -5,6 +5,7 @@
LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs
INTERPRETER = @CSHARPCILINTERPRETER@
+INTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
srcdir = @srcdir@
@@ -68,13 +69,13 @@ setup = \
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
- CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
+ 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) $*_runme.exe; \
+ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(INTERPRETER) $(INTERPRETER_FLAGS) $*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
- CSHARPFLAGS='-nologo $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
+ CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \
fi
diff --git a/Examples/test-suite/csharp/enum_thorough_runme.cs b/Examples/test-suite/csharp/enum_thorough_runme.cs
index 144736f2b..854c8dbb5 100644
--- a/Examples/test-suite/csharp/enum_thorough_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_runme.cs
@@ -405,6 +405,28 @@ public class runme {
if ((int)enum_thorough.repeatTest(repeat.llast) != 3) throw new Exception("repeatTest 5 failed");
if ((int)enum_thorough.repeatTest(repeat.end) != 3) throw new Exception("repeatTest 6 failed");
}
+ // different types
+ {
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeint) != 10) throw new Exception("differentTypes 1 failed");
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typechar) != 'C') throw new Exception("differentTypes 5 failed");
+ if ((int)enum_thorough.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
+
+ int global_enum = enum_thorough.global_typeint;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
+ global_enum = enum_thorough.global_typeboolfalse;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
+ global_enum = enum_thorough.global_typebooltrue;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
+ global_enum = enum_thorough.global_typebooltwo;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
+ global_enum = enum_thorough.global_typechar;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
+ global_enum = enum_thorough.global_typedefaultint;
+ if ((int)enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
index d5bba1b7d..0c22d8e3f 100644
--- a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
@@ -405,6 +405,28 @@ public class runme {
if (enum_thorough_simple.repeatTest(enum_thorough_simple.llast) != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.end) != 3) throw new Exception("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeint) != 10) throw new Exception("differentTypes 1 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typeboolfalse) != 0) throw new Exception("differentTypes 2 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltrue) != 1) throw new Exception("differentTypes 3 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typebooltwo) != 2) throw new Exception("differentTypes 4 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typechar) != 'C') throw new Exception("differentTypes 5 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simple.typedefaultint) != 'D') throw new Exception("differentTypes 6 failed");
+
+ int global_enum = enum_thorough_simple.global_typeint;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
+ global_enum = enum_thorough_simple.global_typeboolfalse;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
+ global_enum = enum_thorough_simple.global_typebooltrue;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
+ global_enum = enum_thorough_simple.global_typebooltwo;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
+ global_enum = enum_thorough_simple.global_typechar;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
+ global_enum = enum_thorough_simple.global_typedefaultint;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
index 3606d1137..86179dcf4 100644
--- a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
@@ -405,6 +405,28 @@ public class runme {
if (enum_thorough_typesafe.repeatTest(repeat.llast).swigValue != 3) throw new Exception("repeatTest 5 failed");
if (enum_thorough_typesafe.repeatTest(repeat.end).swigValue != 3) throw new Exception("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeint).swigValue != 10) throw new Exception("differentTypes 1 failed");
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltrue).swigValue != 1) throw new Exception("differentTypes 2 failed");
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typebooltwo).swigValue != 2) throw new Exception("differentTypes 3 failed");
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typeboolfalse).swigValue != 0) throw new Exception("differentTypes 4 failed");
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typechar).swigValue != (int)'C') throw new Exception("differentTypes 5 failed");
+ if (enum_thorough_typesafe.differentTypesTest(DifferentTypes.typedefaultint).swigValue != (int)'D') throw new Exception("differentTypes 6 failed");
+
+ int global_enum = enum_thorough_typesafe.global_typeint;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 10) throw new Exception("global differentTypes 1 failed");
+ global_enum = enum_thorough_typesafe.global_typeboolfalse;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 0) throw new Exception("global differentTypes 2 failed");
+ global_enum = enum_thorough_typesafe.global_typebooltrue;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 1) throw new Exception("global differentTypes 3 failed");
+ global_enum = enum_thorough_typesafe.global_typebooltwo;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 2) throw new Exception("global differentTypes 4 failed");
+ global_enum = enum_thorough_typesafe.global_typechar;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'C') throw new Exception("global differentTypes 5 failed");
+ global_enum = enum_thorough_typesafe.global_typedefaultint;
+ if (enum_thorough_typesafe.globalDifferentTypesTest(global_enum) != 'D') throw new Exception("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/csharp/friends_runme.cs b/Examples/test-suite/csharp/friends_runme.cs
new file mode 100644
index 000000000..ae3ffb64f
--- /dev/null
+++ b/Examples/test-suite/csharp/friends_runme.cs
@@ -0,0 +1,43 @@
+using System;
+using friendsNamespace;
+
+public class friends_runme {
+ public static void Main() {
+ A a = new A(2);
+
+ if (friends.get_val1(a) != 2)
+ throw new Exception("failed");
+ if (friends.get_val2(a) != 4)
+ throw new Exception("failed");
+ if (friends.get_val3(a) != 6)
+ throw new Exception("failed");
+
+ // nice overload working fine
+ if (friends.get_val1(1,2,3) != 1)
+ throw new Exception("failed");
+
+ B b = new B(3);
+
+ // David's case
+ if (friends.mix(a,b) != 5)
+ throw new Exception("failed");
+
+ D_d di = new D_d(2);
+ D_d dd = new D_d(3.3);
+
+ // incredible template overloading working just fine
+ if (friends.get_val1(di) != 2)
+ throw new Exception("failed");
+ if (friends.get_val1(dd) != 3.3)
+ throw new Exception("failed");
+
+ friends.set(di, 4);
+ friends.set(dd, 1.3);
+
+ if (friends.get_val1(di) != 4)
+ throw new Exception("failed");
+ if (friends.get_val1(dd) != 1.3)
+ throw new Exception("failed");
+ }
+}
+
diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i
index cb2288574..ec31c2787 100644
--- a/Examples/test-suite/enum_thorough.i
+++ b/Examples/test-suite/enum_thorough.i
@@ -537,7 +537,6 @@ IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
%}
%inline %{
-
namespace RepeatSpace {
typedef enum
{
@@ -550,6 +549,58 @@ typedef enum
} repeat;
repeat repeatTest(repeat e) { return e; }
}
+%}
+
+%inline %{
+namespace DifferentSpace {
+enum DifferentTypes {
+ typeint = 10,
+ typeboolfalse = false,
+ typebooltrue = true,
+ typebooltwo,
+ typechar = 'C',
+ typedefaultint
+};
+DifferentTypes differentTypesTest(DifferentTypes n) { return n; }
+
+enum {
+ global_typeint = 10,
+ global_typeboolfalse = false,
+ global_typebooltrue = true,
+ global_typebooltwo,
+ global_typechar = 'C',
+ global_typedefaultint
+};
+int globalDifferentTypesTest(int n) { return n; }
+}
%}
+#if defined(SWIGJAVA)
+%javaconst(0);
+#elif defined(SWIGCSHARP)
+%csconst(0);
+#endif
+
+%inline %{
+namespace DifferentSpace {
+enum DifferentTypesNoConst {
+ typeint_noconst = 10,
+ typeboolfalse_noconst = false,
+ typebooltrue_noconst = true,
+ typebooltwo_noconst,
+ typechar_noconst = 'C',
+ typedefaultint_noconst
+};
+
+enum {
+ global_typeint_noconst = 10,
+ global_typeboolfalse_noconst = false,
+ global_typebooltrue_noconst = true,
+ global_typebooltwo_noconst,
+ global_typechar_noconst = 'C',
+ global_typedefaultint_noconst
+};
+}
+
+%}
diff --git a/Examples/test-suite/java/enum_thorough_proper_runme.java b/Examples/test-suite/java/enum_thorough_proper_runme.java
index 66968060d..391dfff04 100644
--- a/Examples/test-suite/java/enum_thorough_proper_runme.java
+++ b/Examples/test-suite/java/enum_thorough_proper_runme.java
@@ -416,6 +416,28 @@ public class enum_thorough_proper_runme {
if (enum_thorough_proper.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_proper.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
+ if (enum_thorough_proper.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
+
+ int global_enum = enum_thorough_proper.global_typeint;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
+ global_enum = enum_thorough_proper.global_typeboolfalse;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
+ global_enum = enum_thorough_proper.global_typebooltrue;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
+ global_enum = enum_thorough_proper.global_typebooltwo;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
+ global_enum = enum_thorough_proper.global_typechar;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
+ global_enum = enum_thorough_proper.global_typedefaultint;
+ if (enum_thorough_proper.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/java/enum_thorough_runme.java b/Examples/test-suite/java/enum_thorough_runme.java
index 79c902ccf..2f4d3c2ca 100644
--- a/Examples/test-suite/java/enum_thorough_runme.java
+++ b/Examples/test-suite/java/enum_thorough_runme.java
@@ -416,6 +416,28 @@ public class enum_thorough_runme {
if (enum_thorough.repeatTest(repeat.llast).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough.repeatTest(repeat.end).swigValue() != 3) throw new RuntimeException("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough.differentTypesTest(DifferentTypes.typeint).swigValue() != 10) throw new RuntimeException("differentTypes 1 failed");
+ if (enum_thorough.differentTypesTest(DifferentTypes.typeboolfalse).swigValue() != 0) throw new RuntimeException("differentTypes 2 failed");
+ if (enum_thorough.differentTypesTest(DifferentTypes.typebooltrue).swigValue() != 1) throw new RuntimeException("differentTypes 3 failed");
+ if (enum_thorough.differentTypesTest(DifferentTypes.typebooltwo).swigValue() != 2) throw new RuntimeException("differentTypes 4 failed");
+ if (enum_thorough.differentTypesTest(DifferentTypes.typechar).swigValue() != 'C') throw new RuntimeException("differentTypes 5 failed");
+ if (enum_thorough.differentTypesTest(DifferentTypes.typedefaultint).swigValue() != 'D') throw new RuntimeException("differentTypes 6 failed");
+
+ int global_enum = enum_thorough.global_typeint;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
+ global_enum = enum_thorough.global_typeboolfalse;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
+ global_enum = enum_thorough.global_typebooltrue;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
+ global_enum = enum_thorough.global_typebooltwo;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
+ global_enum = enum_thorough.global_typechar;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
+ global_enum = enum_thorough.global_typedefaultint;
+ if (enum_thorough.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/java/enum_thorough_simple_runme.java b/Examples/test-suite/java/enum_thorough_simple_runme.java
index e54acda70..1e94d2988 100644
--- a/Examples/test-suite/java/enum_thorough_simple_runme.java
+++ b/Examples/test-suite/java/enum_thorough_simple_runme.java
@@ -416,6 +416,28 @@ public class enum_thorough_simple_runme {
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
+ if (enum_thorough_simple.differentTypesTest(enum_thorough_simpleConstants.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
+
+ int global_enum = enum_thorough_simple.global_typeint;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
+ global_enum = enum_thorough_simple.global_typeboolfalse;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
+ global_enum = enum_thorough_simple.global_typebooltrue;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
+ global_enum = enum_thorough_simple.global_typebooltwo;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
+ global_enum = enum_thorough_simple.global_typechar;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
+ global_enum = enum_thorough_simple.global_typedefaultint;
+ if (enum_thorough_simple.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
index b00788911..1b0851e53 100644
--- a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
+++ b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
@@ -416,6 +416,28 @@ public class enum_thorough_typeunsafe_runme {
if (enum_thorough_typeunsafe.repeatTest(repeat.llast) != 3) throw new RuntimeException("repeatTest 5 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.end) != 3) throw new RuntimeException("repeatTest 6 failed");
}
+ // different types
+ {
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeint) != 10) throw new RuntimeException("differentTypes 1 failed");
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typeboolfalse) != 0) throw new RuntimeException("differentTypes 2 failed");
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltrue) != 1) throw new RuntimeException("differentTypes 3 failed");
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typebooltwo) != 2) throw new RuntimeException("differentTypes 4 failed");
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typechar) != 'C') throw new RuntimeException("differentTypes 5 failed");
+ if (enum_thorough_typeunsafe.differentTypesTest(DifferentTypes.typedefaultint) != 'D') throw new RuntimeException("differentTypes 6 failed");
+
+ int global_enum = enum_thorough_typeunsafe.global_typeint;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 10) throw new RuntimeException("global differentTypes 1 failed");
+ global_enum = enum_thorough_typeunsafe.global_typeboolfalse;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 0) throw new RuntimeException("global differentTypes 2 failed");
+ global_enum = enum_thorough_typeunsafe.global_typebooltrue;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 1) throw new RuntimeException("global differentTypes 3 failed");
+ global_enum = enum_thorough_typeunsafe.global_typebooltwo;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 2) throw new RuntimeException("global differentTypes 4 failed");
+ global_enum = enum_thorough_typeunsafe.global_typechar;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'C') throw new RuntimeException("global differentTypes 5 failed");
+ global_enum = enum_thorough_typeunsafe.global_typedefaultint;
+ if (enum_thorough_typeunsafe.globalDifferentTypesTest(global_enum) != 'D') throw new RuntimeException("global differentTypes 6 failed");
+ }
}
}
diff --git a/Examples/test-suite/java/friends_runme.java b/Examples/test-suite/java/friends_runme.java
new file mode 100644
index 000000000..2dced9efa
--- /dev/null
+++ b/Examples/test-suite/java/friends_runme.java
@@ -0,0 +1,53 @@
+import friends.*;
+
+public class friends_runme {
+
+ static {
+ try {
+ System.loadLibrary("friends");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ A a = new A(2);
+
+ if (friends.get_val1(a) != 2)
+ throw new RuntimeException("failed");
+ if (friends.get_val2(a) != 4)
+ throw new RuntimeException("failed");
+ if (friends.get_val3(a) != 6)
+ throw new RuntimeException("failed");
+
+ // nice overload working fine
+ if (friends.get_val1(1,2,3) != 1)
+ throw new RuntimeException("failed");
+
+ B b = new B(3);
+
+ // David's case
+ if (friends.mix(a,b) != 5)
+ throw new RuntimeException("failed");
+
+ D_d di = new D_d(2);
+ D_d dd = new D_d(3.3);
+
+ // incredible template overloading working just fine
+ if (friends.get_val1(di) != 2)
+ throw new RuntimeException("failed");
+ if (friends.get_val1(dd) != 3.3)
+ throw new RuntimeException("failed");
+
+ friends.set(di, 4);
+ friends.set(dd, 1.3);
+
+ if (friends.get_val1(di) != 4)
+ throw new RuntimeException("failed");
+ if (friends.get_val1(dd) != 1.3)
+ throw new RuntimeException("failed");
+ }
+}
+
diff --git a/Examples/test-suite/null_pointer.i b/Examples/test-suite/null_pointer.i
index 0bd7a9b92..0da827f99 100644
--- a/Examples/test-suite/null_pointer.i
+++ b/Examples/test-suite/null_pointer.i
@@ -8,5 +8,9 @@
bool func(A* a) {
return !a;
}
+
+ A* getnull() {
+ return 0;
+ }
}
diff --git a/Examples/test-suite/smart_pointer_template_const_overload.i b/Examples/test-suite/smart_pointer_template_const_overload.i
index 7c890fbcf..831e3f2fe 100644
--- a/Examples/test-suite/smart_pointer_template_const_overload.i
+++ b/Examples/test-suite/smart_pointer_template_const_overload.i
@@ -13,9 +13,9 @@
class FooImplementation {
public:
- int mingy() {}
- int constmingy() const {}
- static int thingy() {}
+ int mingy() { return 0; }
+ int constmingy() const { return 0; }
+ static int thingy() { return 0; }
static int svariable;
static const int constsvariable;
int normalvariable;
diff --git a/Examples/test-suite/tcl/null_pointer_runme.tcl b/Examples/test-suite/tcl/null_pointer_runme.tcl
new file mode 100644
index 000000000..be99c7166
--- /dev/null
+++ b/Examples/test-suite/tcl/null_pointer_runme.tcl
@@ -0,0 +1,21 @@
+if [ catch { load ./null_pointer[info sharedlibextension] null_pointer} err_msg ] {
+ puts stderr "Could not load shared object:\n$err_msg"
+}
+
+set a [A]
+if {[func $a] != 0} {
+ puts stderr "null_pointer test 1 failed"
+ exit 1
+}
+
+set null [getnull]
+if {$null != "NULL"} {
+ puts stderr "null_pointer test 2 failed"
+ exit 1
+}
+
+if {[llength [info commands "NULL"]] != 0} {
+ puts stderr "null_pointer test 3 failed"
+ exit 1
+}
+
diff --git a/Lib/lua/lua.swg b/Lib/lua/lua.swg
index a15f14148..3267ad5eb 100644
--- a/Lib/lua/lua.swg
+++ b/Lib/lua/lua.swg
@@ -35,10 +35,10 @@
// note: char is treated as a seperate special type
// signed char & unsigned char are numbers
%typemap(consttab) char
- { SWIG_LUA_CHAR, (char *)"$symname", (long)$value, 0, 0, 0}
+ { SWIG_LUA_CHAR, (char *)"$symname", (long)$value, 0, 0, 0}
%typemap(consttab) long long, unsigned long long
- { SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
+ { SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
diff --git a/Lib/r/rfragments.swg b/Lib/r/rfragments.swg
index 8a0d85580..afb75c3c1 100644
--- a/Lib/r/rfragments.swg
+++ b/Lib/r/rfragments.swg
@@ -170,12 +170,12 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
order to allow for use of CHARSXP caches. */
Rf_protect(t = Rf_allocVector(STRSXP, 1));
-#if R_VERSION >= R_Version(2,7,0)
+%#if R_VERSION >= R_Version(2,7,0)
c = Rf_mkCharLen(carray, size);
-#else
+%#else
c = Rf_allocVector(CHARSXP, size);
strncpy((char *)CHAR(c), carray, size);
-#endif
+%#endif
SET_STRING_ELT(t, 0, c);
Rf_unprotect(1);
return t;
diff --git a/Lib/tcl/tclapi.swg b/Lib/tcl/tclapi.swg
index 6b67327a2..33dc324d4 100644
--- a/Lib/tcl/tclapi.swg
+++ b/Lib/tcl/tclapi.swg
@@ -49,6 +49,7 @@ typedef struct swig_class {
struct swig_class **bases;
const char **base_names;
swig_module_info *module;
+ Tcl_HashTable hashtable;
} swig_class;
typedef struct swig_instance {
diff --git a/Lib/tcl/tclinit.swg b/Lib/tcl/tclinit.swg
index 6910d3c51..9b3224104 100644
--- a/Lib/tcl/tclinit.swg
+++ b/Lib/tcl/tclinit.swg
@@ -67,6 +67,28 @@ SWIG_Tcl_InstallConstants(Tcl_Interp *interp, swig_const_info constants[]) {
}
}
+/* Create fast method lookup tables */
+
+SWIGINTERN void
+SWIG_Tcl_InstallMethodLookupTables(Tcl_Interp *interp) {
+ int i;
+
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = swig_module.type_initial[i];
+ if (type->clientdata) {
+ swig_class* klass = (swig_class*) type->clientdata;
+ Tcl_InitHashTable(&(klass->hashtable), TCL_STRING_KEYS);
+ swig_method* meth = klass->methods;
+ while (meth && meth->name) {
+ int newEntry;
+ Tcl_HashEntry* hashentry = Tcl_CreateHashEntry(&(klass->hashtable), meth->name, &newEntry);
+ Tcl_SetHashValue(hashentry, (ClientData)meth->method);
+ ++meth;
+ }
+ }
+ }
+}
+
#ifdef __cplusplus
}
#endif
@@ -113,6 +135,7 @@ SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
}
SWIG_Tcl_InstallConstants(interp, swig_constants);
+ SWIG_Tcl_InstallMethodLookupTables(interp);
%}
diff --git a/Lib/tcl/tclrun.swg b/Lib/tcl/tclrun.swg
index eb8bd253c..dd6458e90 100644
--- a/Lib/tcl/tclrun.swg
+++ b/Lib/tcl/tclrun.swg
@@ -367,19 +367,17 @@ SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_
}
cls_stack_bi[cls_stack_top]++;
- meth = cls->methods;
- /* Check for methods */
- while (meth && meth->name) {
- if (strcmp(meth->name,method) == 0) {
+ Tcl_HashEntry* hashentry = Tcl_FindHashEntry(&(cls->hashtable), method);
+ if (hashentry) {
+ ClientData cd = Tcl_GetHashValue(hashentry);
+ swig_wrapper method_wrapper = (swig_wrapper)cd;
oldarg = objv[1];
objv[1] = inst->thisptr;
Tcl_IncrRefCount(inst->thisptr);
- rcode = (*meth->method)(clientData,interp,objc,objv);
+ rcode = (method_wrapper)(clientData,interp,objc,objv);
objv[1] = oldarg;
Tcl_DecrRefCount(inst->thisptr);
return rcode;
- }
- meth++;
}
/* Check class methods for a match */
if (strcmp(method,"cget") == 0) {
@@ -486,7 +484,7 @@ SWIGRUNTIME Tcl_Obj *
SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *type, int flags) {
Tcl_Obj *robj = SWIG_NewPointerObj(thisvalue, type,0);
/* Check to see if this pointer belongs to a class or not */
- if ((type->clientdata) && (interp)) {
+ if (thisvalue && (type->clientdata) && (interp)) {
Tcl_CmdInfo ci;
char *name;
name = Tcl_GetStringFromObj(robj,NULL);
diff --git a/README b/README
index 10fbeb86a..2626f0bef 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
SWIG (Simplified Wrapper and Interface Generator)
-Version: 2.0.3 (in progress)
+Version: 2.0.4 (in progress)
Tagline: SWIG is a compiler that integrates C and C++ with languages
including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua,
diff --git a/RELEASENOTES b/RELEASENOTES
index 770f7a31e..ea2f0c5b6 100644
--- a/RELEASENOTES
+++ b/RELEASENOTES
@@ -4,6 +4,10 @@ and CHANGES files.
Release Notes
=============
+SWIG-2.0.3 summary:
+- A bug fix release including a couple of fixes for regressions in the
+ 2.0 series.
+
SWIG-2.0.2 summary:
- Support for the D language has been added.
- Various bug fixes and minor enhancements.
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 9ce51b576..926471ff9 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -5591,21 +5591,14 @@ edecl : ID {
Delete(type);
}
| ID EQUAL etype {
+ SwigType *type = NewSwigType($3.type == T_BOOL ? T_BOOL : ($3.type == T_CHAR ? T_CHAR : T_INT));
$$ = new_node("enumitem");
Setattr($$,"name",$1);
- Setattr($$,"enumvalue", $3.val);
- if ($3.type == T_CHAR) {
- SwigType *type = NewSwigType(T_CHAR);
- Setattr($$,"value",NewStringf("\'%(escape)s\'", $3.val));
- Setattr($$,"type",type);
- Delete(type);
- } else {
- SwigType *type = NewSwigType($3.type == T_BOOL ? T_BOOL : T_INT);
- Setattr($$,"value",$1);
- Setattr($$,"type",type);
- Delete(type);
- }
+ Setattr($$,"type",type);
SetFlag($$,"feature:immutable");
+ Setattr($$,"enumvalue", $3.val);
+ Setattr($$,"value",$1);
+ Delete(type);
}
| empty { $$ = 0; }
;
@@ -5619,7 +5612,6 @@ etype : expr {
($$.type != T_CHAR) && ($$.type != T_BOOL)) {
Swig_error(cparse_file,cparse_line,"Type error. Expecting an integral type\n");
}
- if ($$.type == T_CHAR) $$.type = T_INT;
}
;
diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx
index f5378af3e..0aab50332 100644
--- a/Source/Modules/chicken.cxx
+++ b/Source/Modules/chicken.cxx
@@ -863,9 +863,10 @@ int CHICKEN::constantWrapper(Node *n) {
Delete(SwigType_pop(nctype));
}
+ bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
if (SwigType_type(nctype) == T_STRING) {
rvalue = NewStringf("\"%s\"", value);
- } else if (SwigType_type(nctype) == T_CHAR) {
+ } else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) {
rvalue = NewStringf("\'%s\'", value);
} else {
rvalue = NewString(value);
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index b70f626b3..d74f00a36 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1274,11 +1274,15 @@ public:
// Note that this is used in enumValue() amongst other places
Setattr(n, "value", tmpValue);
- // Deal with enum values that are bools
- if (SwigType_type(Getattr(n, "type")) == T_BOOL) {
- String *boolValue = NewStringf("%s ? 1 : 0", Getattr(n, "enumvalue"));
- Setattr(n, "enumvalue", boolValue);
- Delete(boolValue);
+ // Deal with enum values that are not int
+ int swigtype = SwigType_type(Getattr(n, "type"));
+ if (swigtype == T_BOOL) {
+ const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
+ Setattr(n, "enumvalue", val);
+ } else if (swigtype == T_CHAR) {
+ String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
+ Setattr(n, "enumvalue", val);
+ Delete(val);
}
{
@@ -1329,11 +1333,12 @@ public:
}
} else {
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
- String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */
- SwigType *typemap_lookup_type = parent_name ? parent_name : type;
+ SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
+ Setattr(n, "type", typemap_lookup_type);
const String *tm = typemapLookup(n, "cstype", typemap_lookup_type, WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF);
String *return_type = Copy(tm);
+ substituteClassname(typemap_lookup_type, return_type);
const String *methodmods = Getattr(n, "feature:cs:methodmodifiers");
methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string);
@@ -1362,6 +1367,7 @@ public:
Printf(enum_code, " %s %s %s %s = %s;\n", methodmods, const_readonly, return_type, symname, value);
Delete(value);
}
+ Delete(return_type);
}
// Add the enum value to the comma separated list being constructed in the enum declaration.
@@ -1396,6 +1402,7 @@ public:
String *tm;
String *return_type = NewString("");
String *constants_code = NewString("");
+ Swig_save("constantWrapper", n, "value", NIL);
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
@@ -1444,7 +1451,6 @@ public:
// Add the stripped quotes back in
String *new_value = NewString("");
- Swig_save("constantWrapper", n, "value", NIL);
if (SwigType_type(t) == T_STRING) {
Printf(new_value, "\"%s\"", Copy(Getattr(n, "value")));
Setattr(n, "value", new_value);
diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx
index d55f260a1..bbeb1db03 100644
--- a/Source/Modules/guile.cxx
+++ b/Source/Modules/guile.cxx
@@ -1393,9 +1393,10 @@ public:
}
// See if there's a typemap
+ bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
if (SwigType_type(nctype) == T_STRING) {
rvalue = NewStringf("\"%s\"", value);
- } else if (SwigType_type(nctype) == T_CHAR) {
+ } else if (SwigType_type(nctype) == T_CHAR && !is_enum_item) {
rvalue = NewStringf("\'%s\'", value);
} else {
rvalue = NewString(value);
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 5574cce59..6cdf26fe3 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1349,11 +1349,15 @@ public:
// Note that this is used in enumValue() amongst other places
Setattr(n, "value", tmpValue);
- // Deal with enum values that are bools
- if (SwigType_type(Getattr(n, "type")) == T_BOOL) {
- String *boolValue = NewStringf("%s ? 1 : 0", Getattr(n, "enumvalue"));
- Setattr(n, "enumvalue", boolValue);
- Delete(boolValue);
+ // Deal with enum values that are not int
+ int swigtype = SwigType_type(Getattr(n, "type"));
+ if (swigtype == T_BOOL) {
+ const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
+ Setattr(n, "enumvalue", val);
+ } else if (swigtype == T_CHAR) {
+ String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
+ Setattr(n, "enumvalue", val);
+ Delete(val);
}
{
@@ -1394,11 +1398,12 @@ public:
}
} else {
// Wrap C/C++ enums with constant integers or use the typesafe enum pattern
- String *type = Getattr(n, "type"); /* should be int unless explicitly specified in a C++0x enum class */
- SwigType *typemap_lookup_type = parent_name ? parent_name : type;
+ SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum ");
+ Setattr(n, "type", typemap_lookup_type);
const String *tm = typemapLookup(n, "jstype", typemap_lookup_type, WARN_JAVA_TYPEMAP_JSTYPE_UNDEF);
String *return_type = Copy(tm);
+ substituteClassname(typemap_lookup_type, return_type);
const String *methodmods = Getattr(n, "feature:java:methodmodifiers");
methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string);
@@ -1419,6 +1424,7 @@ public:
Printf(enum_code, " %s final static %s %s = %s;\n", methodmods, return_type, symname, value);
Delete(value);
}
+ Delete(return_type);
}
// Add the enum value to the comma separated list being constructed in the enum declaration.
@@ -1453,6 +1459,7 @@ public:
String *tm;
String *return_type = NewString("");
String *constants_code = NewString("");
+ Swig_save("constantWrapper", n, "value", NIL);
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
@@ -1498,7 +1505,6 @@ public:
// Add the stripped quotes back in
String *new_value = NewString("");
- Swig_save("constantWrapper", n, "value", NIL);
if (SwigType_type(t) == T_STRING) {
Printf(new_value, "\"%s\"", Copy(Getattr(n, "value")));
Setattr(n, "value", new_value);
diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx
index 82af250f7..9f155fd02 100644
--- a/Source/Modules/lang.cxx
+++ b/Source/Modules/lang.cxx
@@ -1044,7 +1044,10 @@ int Language::functionHandler(Node *n) {
if (isstatic) {
staticmemberfunctionHandler(n);
} else if (isfriend) {
+ int oldInClass = InClass;
+ InClass = 0;
globalfunctionHandler(n);
+ InClass = oldInClass;
} else {
Node *explicit_n = 0;
if (directorsEnabled() && is_member_director(CurrentClass, n) && !extraDirectorProtectedCPPMethodsRequired()) {
diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx
index 3f6a97d63..7dc095d06 100644
--- a/Source/Modules/mzscheme.cxx
+++ b/Source/Modules/mzscheme.cxx
@@ -637,9 +637,10 @@ public:
// Create variable and assign it a value
Printf(f_header, "static %s = ", SwigType_lstr(type, var_name));
+ bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
if ((SwigType_type(type) == T_STRING)) {
Printf(f_header, "\"%s\";\n", value);
- } else if (SwigType_type(type) == T_CHAR) {
+ } else if (SwigType_type(type) == T_CHAR && !is_enum_item) {
Printf(f_header, "\'%s\';\n", value);
} else {
Printf(f_header, "%s;\n", value);
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 3007e0b86..1f7249348 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -927,9 +927,10 @@ public:
// Create variable and assign it a value
Printf(f_header, "static %s = ", SwigType_lstr(type, name));
+ bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
if ((SwigType_type(type) == T_STRING)) {
Printf(f_header, "\"%s\";\n", value);
- } else if (SwigType_type(type) == T_CHAR) {
+ } else if (SwigType_type(type) == T_CHAR && !is_enum_item) {
Printf(f_header, "\'%s\';\n", value);
} else {
Printf(f_header, "%s;\n", value);
diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx
index 659496d52..81adc5462 100644
--- a/Source/Modules/pike.cxx
+++ b/Source/Modules/pike.cxx
@@ -578,12 +578,16 @@ public:
String *symname = Getattr(n, "sym:name");
SwigType *type = Getattr(n, "type");
String *value = Getattr(n, "value");
+ bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
- /* Special hook for member pointer */
if (SwigType_type(type) == T_MPOINTER) {
+ /* Special hook for member pointer */
String *wname = Swig_name_wrapper(symname);
Printf(f_header, "static %s = %s;\n", SwigType_str(type, wname), value);
value = wname;
+ } else if (SwigType_type(type) == T_CHAR && is_enum_item) {
+ type = NewSwigType(T_INT);
+ Setattr(n, "type", type);
}
/* Perform constant typemap substitution */
diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx
index dfdd71b64..d209570a9 100644
--- a/Source/Modules/tcl8.cxx
+++ b/Source/Modules/tcl8.cxx
@@ -531,7 +531,17 @@ public:
Printf(df->code, "Tcl_Obj *CONST *argv = objv+1;\n");
Printf(df->code, "int argc = objc-1;\n");
Printv(df->code, dispatch, "\n", NIL);
- Printf(df->code, "Tcl_SetResult(interp,(char *) \"No matching function for overloaded '%s'\", TCL_STATIC);\n", iname);
+ Node *sibl = n;
+ while (Getattr(sibl, "sym:previousSibling"))
+ sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
+ String *protoTypes = NewString("");
+ do {
+ Printf(protoTypes, "\n\" %s(%s)\\n\"", SwigType_str(Getattr(sibl, "name"), 0), ParmList_protostr(Getattr(sibl, "wrap:parms")));
+ } while ((sibl = Getattr(sibl, "sym:nextSibling")));
+ Printf(df->code, "Tcl_SetResult(interp,(char *) "
+ "\"Wrong number or type of arguments for overloaded function '%s'.\\n\""
+ "\n\" Possible C/C++ prototypes are:\\n\"%s, TCL_STATIC);\n", iname, protoTypes);
+ Delete(protoTypes);
Printf(df->code, "return TCL_ERROR;\n");
Printv(df->code, "}\n", NIL);
Wrapper_print(df, f_wrappers);
diff --git a/configure.in b/configure.in
index e6c7a6e82..3c9f8f9c3 100644
--- a/configure.in
+++ b/configure.in
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl The macros which aren't shipped with the autotools are stored in the
dnl Tools/config directory in .m4 files.
-AC_INIT([swig],[2.0.3],[http://www.swig.org])
+AC_INIT([swig],[2.0.4],[http://www.swig.org])
dnl NB: When this requirement is increased to 2.60 or later, AC_PROG_SED
dnl definition below can be removed
@@ -1741,6 +1741,7 @@ CSHARPPATHSEPARATOR="/"
CSHARPCYGPATH_W=echo
if test -z "$CSHARPBIN" ; then
CSHARPCILINTERPRETER=""
+ CSHARPCILINTERPRETER_FLAGS=""
if test "cscc" = "$CSHARPCOMPILER" ; then
AC_CHECK_PROGS(CSHARPCILINTERPRETER, ilrun)
else
@@ -1761,6 +1762,7 @@ if test -z "$CSHARPBIN" ; then
fi
if test "mcs" = "$CSHARPCOMPILER" || test "gmcs" = "$CSHARPCOMPILER"; then
AC_CHECK_PROGS(CSHARPCILINTERPRETER, mono) # Mono JIT
+ CSHARPCILINTERPRETER_FLAGS="--debug"
else
if test "csc" = "$CSHARPCOMPILER"; then
CSHARPPATHSEPARATOR="\\\\"
@@ -1805,6 +1807,7 @@ case $host in
esac
fi
+AC_SUBST(CSHARPCILINTERPRETER_FLAGS)
AC_SUBST(CSHARPCILINTERPRETER)
AC_SUBST(CSHARPPATHSEPARATOR)
AC_SUBST(CSHARPCYGPATH_W)