From 5f1e95ff67573bd3b9855eee4179034067b69e21 Mon Sep 17 00:00:00 2001
From: Robert Stone
Date: Tue, 2 Jun 2009 21:13:03 +0000
Subject: [PATCH 001/352] bugfix for Lib/perl5/reference.i (test-suite
enhancements coming soon).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11244 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 4 ++++
Lib/perl5/reference.i | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/CHANGES.current b/CHANGES.current
index b7fde04cc..7cf00afaa 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,10 @@
Version 1.3.40 (in progress)
============================
+2009-06-02: talby
+ [Perl] Resolved reference.i overload support problem
+ identfied by John Potowsky.
+
2009-05-26: wsfulton
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
now implements System.Collections.Generic.IDictionary<>.
diff --git a/Lib/perl5/reference.i b/Lib/perl5/reference.i
index d3d745cfc..e03d0c303 100644
--- a/Lib/perl5/reference.i
+++ b/Lib/perl5/reference.i
@@ -202,6 +202,31 @@ as follows :
$1 = &dvalue;
}
+%typemap(typecheck) int *REFERENCE, int &REFERENCE,
+ short *REFERENCE, short &REFERENCE,
+ long *REFERENCE, long &REFERENCE,
+ signed char *REFERENCE, unsigned char &REFERENCE,
+ bool *REFERENCE, bool &REFERENCE
+{
+ $1 = SvROK($input) && SvIOK(SvRV($input));
+}
+%typemap(typecheck) double *REFERENCE, double &REFERENCE,
+ float *REFERENCE, float &REFERENCE
+{
+ $1 = SvROK($input);
+ if($1) {
+ SV *tmpsv = SvRV($input);
+ $1 = SvNOK(tmpsv) || SvIOK(tmpsv);
+ }
+}
+%typemap(typecheck) unsigned int *REFERENCE, unsigned int &REFERENCE,
+ unsigned short *REFERENCE, unsigned short &REFERENCE,
+ unsigned long *REFERENCE, unsigned long &REFERENCE,
+ unsigned char *REFERENCE, unsigned char &REFERENCE
+{
+ $1 = SvROK($input) && SvUOK(SvRV($input));
+}
+
%typemap(argout) double *REFERENCE, double &REFERENCE,
float *REFERENCE, float &REFERENCE
{
From 54b87bdd7d021418a3ca4cae2a3f04df69c1ea4a Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Fri, 5 Jun 2009 17:19:29 +0000
Subject: [PATCH 002/352] remove extra lookup of directorout typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11246 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Source/Modules/ocaml.cxx | 5 -----
Source/Modules/octave.cxx | 5 -----
Source/Modules/python.cxx | 5 -----
Source/Modules/ruby.cxx | 5 -----
4 files changed, 20 deletions(-)
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index b925328a3..8a797759c 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -1627,11 +1627,6 @@ public:
Setattr(n, "type", return_type);
tm = Swig_typemap_lookup("directorout", n, "c_result", w);
Setattr(n, "type", type);
- if (tm == 0) {
- String *name = NewString("c_result");
- tm = Swig_typemap_search("directorout", return_type, name, NULL);
- Delete(name);
- }
if (tm != 0) {
Replaceall(tm, "$input", "swig_result");
/* TODO check this */
diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx
index 39b61e93b..55ffe8cbb 100644
--- a/Source/Modules/octave.cxx
+++ b/Source/Modules/octave.cxx
@@ -1305,11 +1305,6 @@ public:
Setattr(n, "type", return_type);
tm = Swig_typemap_lookup("directorout", n, "result", w);
Setattr(n, "type", type);
- if (tm == 0) {
- String *name = NewString("result");
- tm = Swig_typemap_search("directorout", return_type, name, NULL);
- Delete(name);
- }
if (tm != 0) {
char temp[24];
sprintf(temp, "out(%d)", idx);
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index bd22e79a6..73f280e6b 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -3949,11 +3949,6 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
Setattr(n, "type", return_type);
tm = Swig_typemap_lookup("directorout", n, "result", w);
Setattr(n, "type", type);
- if (tm == 0) {
- String *name = NewString("result");
- tm = Swig_typemap_search("directorout", return_type, name, NULL);
- Delete(name);
- }
if (tm != 0) {
if (outputs > 1) {
Printf(w->code, "output = PyTuple_GetItem(result, %d);\n", idx++);
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index 1c13747e5..8d5ab4fae 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -3245,11 +3245,6 @@ public:
Setattr(n, "type", return_type);
tm = Swig_typemap_lookup("directorout", n, "result", w);
Setattr(n, "type", type);
- if (tm == 0) {
- String *name = NewString("result");
- tm = Swig_typemap_search("directorout", return_type, name, NULL);
- Delete(name);
- }
if (tm != 0) {
if (outputs > 1 && !asvoid ) {
Printf(w->code, "output = rb_ary_entry(result, %d);\n", idx++);
From 1dc517575390fbcdb3c411753900c8ae7904f326 Mon Sep 17 00:00:00 2001
From: Robert Stone
Date: Fri, 5 Jun 2009 18:47:30 +0000
Subject: [PATCH 003/352] reference.i improvements, testcase coverage.
language specific interface support for test-suite.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11247 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 2 +-
Examples/test-suite/perl5/Makefile.in | 1 +
Examples/test-suite/perl5/byreference.i | 52 +++++++++++++++++++
.../test-suite/perl5/byreference_runme.pl | 36 +++++++++++++
Lib/perl5/reference.i | 10 ++--
5 files changed, 97 insertions(+), 4 deletions(-)
create mode 100644 Examples/test-suite/perl5/byreference.i
create mode 100644 Examples/test-suite/perl5/byreference_runme.pl
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 5c6a332a4..753c5fbdf 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -64,7 +64,7 @@ INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
LIBS = -L.
LIBPREFIX = lib
ACTION = check
-INTERFACEDIR = ../
+INTERFACEDIR = $(if $(wildcard $*.i), ./, ../)
#
# Please keep test cases in alphabetical order.
diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in
index 3fee35bcb..518d341b2 100644
--- a/Examples/test-suite/perl5/Makefile.in
+++ b/Examples/test-suite/perl5/Makefile.in
@@ -15,6 +15,7 @@ CPP_TEST_CASES += \
li_cdata \
li_cstring \
li_cdata_carrays \
+ byreference \
C_TEST_CASES += \
li_cdata \
diff --git a/Examples/test-suite/perl5/byreference.i b/Examples/test-suite/perl5/byreference.i
new file mode 100644
index 000000000..43215f1cc
--- /dev/null
+++ b/Examples/test-suite/perl5/byreference.i
@@ -0,0 +1,52 @@
+%module byreference
+
+%include "reference.i"
+
+%inline %{
+ double FrVal;
+ double ToVal;
+ void PDouble(double *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RDouble(double &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PFloat(float *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RFloat(float &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PInt(int *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RInt(int &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PShort(short *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RShort(short &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PLong(long *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RLong(long &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PUInt(unsigned int *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RUInt(unsigned int &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PUShort(unsigned short *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RUShort(unsigned short &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PULong(unsigned long *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RULong(unsigned long &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PUChar(unsigned char *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RUChar(unsigned char &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PChar(signed char *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RChar(signed char &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+ void PBool(bool *REFERENCE, int t = 0)
+ { ToVal = *REFERENCE; *REFERENCE = FrVal + t; }
+ void RBool(bool &REFERENCE, int t = 0)
+ { ToVal = REFERENCE; REFERENCE = FrVal + t; }
+%}
diff --git a/Examples/test-suite/perl5/byreference_runme.pl b/Examples/test-suite/perl5/byreference_runme.pl
new file mode 100644
index 000000000..845d870cd
--- /dev/null
+++ b/Examples/test-suite/perl5/byreference_runme.pl
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+use Test::More tests => 68;
+BEGIN { use_ok('byreference') }
+require_ok('byreference');
+
+sub chk { my($type, $call, $v1, $v2) = @_;
+ $byreference::FrVal = $v1;
+ my $v = $v2;
+ eval { $call->(\$v) };
+ is($@, '', "$type check");
+ is($byreference::ToVal, $v2, "$type out");
+ is($v, $v1, "$type in");
+}
+chk("double*", \&byreference::PDouble, 12.2, 18.6);
+chk("double&", \&byreference::RDouble, 32.5, 64.8);
+chk("float*", \&byreference::PFloat, 64.5, 96.0);
+chk("float&", \&byreference::RFloat, 98.5, 6.25);
+chk("int*", \&byreference::PInt, 1887, 3356);
+chk("int&", \&byreference::RInt, 2622, 9867);
+chk("short*", \&byreference::PShort, 4752, 3254);
+chk("short&", \&byreference::RShort, 1898, 5757);
+chk("long*", \&byreference::PLong, 6687, 7132);
+chk("long&", \&byreference::RLong, 8346, 4398);
+chk("uint*", \&byreference::PUInt, 6853, 5529);
+chk("uint&", \&byreference::RUInt, 5483, 7135);
+chk("ushort*", \&byreference::PUShort, 9960, 9930);
+chk("ushort&", \&byreference::RUShort, 1193, 4178);
+chk("ulong*", \&byreference::PULong, 7960, 4788);
+chk("ulong&", \&byreference::RULong, 8829, 1603);
+chk("uchar*", \&byreference::PUChar, 110, 239);
+chk("uchar&", \&byreference::RUChar, 15, 97);
+chk("char*", \&byreference::PChar, -7, 118);
+chk("char&", \&byreference::RChar, -3, -107);
+chk("bool*", \&byreference::PBool, 0, 1);
+chk("bool&", \&byreference::RBool, 1, 0);
diff --git a/Lib/perl5/reference.i b/Lib/perl5/reference.i
index e03d0c303..6f5eda518 100644
--- a/Lib/perl5/reference.i
+++ b/Lib/perl5/reference.i
@@ -205,7 +205,7 @@ as follows :
%typemap(typecheck) int *REFERENCE, int &REFERENCE,
short *REFERENCE, short &REFERENCE,
long *REFERENCE, long &REFERENCE,
- signed char *REFERENCE, unsigned char &REFERENCE,
+ signed char *REFERENCE, signed char &REFERENCE,
bool *REFERENCE, bool &REFERENCE
{
$1 = SvROK($input) && SvIOK(SvRV($input));
@@ -224,7 +224,11 @@ as follows :
unsigned long *REFERENCE, unsigned long &REFERENCE,
unsigned char *REFERENCE, unsigned char &REFERENCE
{
- $1 = SvROK($input) && SvUOK(SvRV($input));
+ $1 = SvROK($input);
+ if($1) {
+ SV *tmpsv = SvRV($input);
+ $1 = SvUOK(tmpsv) || SvIOK(tmpsv);
+ }
}
%typemap(argout) double *REFERENCE, double &REFERENCE,
@@ -239,7 +243,7 @@ as follows :
%typemap(argout) int *REFERENCE, int &REFERENCE,
short *REFERENCE, short &REFERENCE,
long *REFERENCE, long &REFERENCE,
- signed char *REFERENCE, unsigned char &REFERENCE,
+ signed char *REFERENCE, signed char &REFERENCE,
bool *REFERENCE, bool &REFERENCE
{
SV *tempsv;
From 16ef97f362df4332f9626823e830e17a0722d124 Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Mon, 15 Jun 2009 12:27:21 +0000
Subject: [PATCH 004/352] Remove non-standard targets makecpptests, makectests,
maketests, runcpptests, runctests, runtests - the C ones at least don't work
properly, and haven't for a long time. Remove explicit use of bash from
missingcpptests and missingctests as it isn't required and bash may not be
available.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11259 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/php/Makefile.in | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in
index b8aeaaa11..d48f37e8a 100644
--- a/Examples/test-suite/php/Makefile.in
+++ b/Examples/test-suite/php/Makefile.in
@@ -16,28 +16,12 @@ include $(srcdir)/../common.mk
# Overridden variables here
TARGETPREFIX =# Should be php_ for Windows, empty otherwise
-makecpptests:
- @bash -ec 'for test in $(CPP_TEST_CASES) ; do $(MAKE) clean && $(MAKE) $${test}.cpptest; done'
-
-maketests: makecpptests makectests
-
-makectests:
- @bash -ec 'for test in $(C_TEST_CASES) ; do $($(MAKE)) clean && $(MAKE) $${test}.cpptest; done'
-
-runcpptests:
- @bash -ec 'for test in $(CPP_TEST_CASES) ; do if [ -f $${test}_runme.php ] ; then $(MAKE) clean && $(MAKE) $${test}.cpptest; fi ; done'
-
-runctests:
- @bash -ec 'for test in $(C_TEST_CASES) ; do if [ -f $${test}_runme.php ] ; then $(MAKE) clean && $(MAKE) $${test}.cpptest; fi; done'
-
-runtests: runcpptests runctests
-
# write out tests without a _runme.php
missingcpptests:
- @bash -ec 'for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done'
+ for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
missingctests:
- @bash -ec 'for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done'
+ for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done
missingtests: missingcpptests missingctests
From 0a1c7c91b1ac41306e2054123be3f0aa58bfc651 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Tue, 16 Jun 2009 19:29:08 +0000
Subject: [PATCH 005/352] fix Java and C# enums when one of the enum items is
ignored
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11279 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 5 ++
.../test-suite/csharp/enum_thorough_runme.cs | 39 +++++++++++++
.../csharp/enum_thorough_simple_runme.cs | 39 +++++++++++++
.../csharp/enum_thorough_typesafe_runme.cs | 39 +++++++++++++
Examples/test-suite/enum_thorough.i | 45 ++++++++++++++
Examples/test-suite/enum_thorough_typesafe.i | 2 +
.../java/enum_thorough_proper_runme.java | 39 +++++++++++++
.../test-suite/java/enum_thorough_runme.java | 39 +++++++++++++
.../java/enum_thorough_simple_runme.java | 39 +++++++++++++
.../java/enum_thorough_typeunsafe_runme.java | 39 +++++++++++++
.../test-suite/perl5/enum_thorough_runme.pl | 47 +++++++++++++--
Source/Modules/csharp.cxx | 2 +-
Source/Modules/java.cxx | 2 +-
Source/Modules/typepass.cxx | 58 +++++++++++++++++--
14 files changed, 422 insertions(+), 12 deletions(-)
diff --git a/CHANGES.current b/CHANGES.current
index 7cf00afaa..a3b0bcd27 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,11 @@
Version 1.3.40 (in progress)
============================
+2009-06-16: wsfulton
+ [Java,C#] Fix enum marshalling when %ignore is used on one of the enum items reported
+ by Lubomir Konstantinov. Incorrect enum values were being passed to the C++ layer or
+ compilation errors resulted.
+
2009-06-02: talby
[Perl] Resolved reference.i overload support problem
identfied by John Potowsky.
diff --git a/Examples/test-suite/csharp/enum_thorough_runme.cs b/Examples/test-suite/csharp/enum_thorough_runme.cs
index 765347e4b..d68e2b5fa 100644
--- a/Examples/test-suite/csharp/enum_thorough_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_runme.cs
@@ -358,6 +358,45 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
+ if ((int)enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
+ if ((int)enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
+ if ((int)enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
+ if ((int)enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
+ if ((int)enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if ((int)enum_thorough.repeatTest(repeat.one) != 1) throw new Exception("repeatTest 1 failed");
if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
diff --git a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
index f8556ff37..4a2f240c1 100644
--- a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
@@ -358,6 +358,45 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new Exception("ignoreATest 0 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new Exception("ignoreATest 3 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new Exception("ignoreATest 10 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new Exception("ignoreATest 11 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new Exception("ignoreATest 13 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new Exception("ignoreATest 14 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new Exception("ignoreATest 20 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new Exception("ignoreATest 30 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new Exception("ignoreATest 32 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new Exception("ignoreBTest 11 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new Exception("ignoreBTest 12 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new Exception("ignoreBTest 31 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new Exception("ignoreBTest 32 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new Exception("ignoreBTest 41 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new Exception("ignoreCTest 10 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new Exception("ignoreCTest 12 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new Exception("ignoreCTest 30 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new Exception("ignoreCTest 32 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new Exception("ignoreCTest 40 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new Exception("ignoreDTest 21 failed");
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new Exception("ignoreETest 0 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new Exception("ignoreETest 21 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough_simple.repeatTest(enum_thorough_simple.one) != 1) throw new Exception("repeatTest 1 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
diff --git a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
index dc2a981de..638885c52 100644
--- a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
@@ -358,6 +358,45 @@ public class runme {
i.MemberInstance = Instances.memberinstance3;
if (i.MemberInstance != Instances.memberinstance3) throw new Exception("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue != 0) throw new Exception("ignoreATest 0 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue != 3) throw new Exception("ignoreATest 3 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue != 10) throw new Exception("ignoreATest 10 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue != 11) throw new Exception("ignoreATest 11 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue != 13) throw new Exception("ignoreATest 13 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue != 14) throw new Exception("ignoreATest 14 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue != 20) throw new Exception("ignoreATest 20 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue != 30) throw new Exception("ignoreATest 30 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue != 32) throw new Exception("ignoreATest 32 failed");
+ if (enum_thorough_typesafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue != 33) throw new Exception("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue != 11) throw new Exception("ignoreBTest 11 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue != 12) throw new Exception("ignoreBTest 12 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue != 31) throw new Exception("ignoreBTest 31 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue != 32) throw new Exception("ignoreBTest 32 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue != 41) throw new Exception("ignoreBTest 41 failed");
+ if (enum_thorough_typesafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue != 42) throw new Exception("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue != 10) throw new Exception("ignoreCTest 10 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue != 12) throw new Exception("ignoreCTest 12 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue != 30) throw new Exception("ignoreCTest 30 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue != 32) throw new Exception("ignoreCTest 32 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue != 40) throw new Exception("ignoreCTest 40 failed");
+ if (enum_thorough_typesafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue != 42) throw new Exception("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue != 21) throw new Exception("ignoreDTest 21 failed");
+ if (enum_thorough_typesafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue != 22) throw new Exception("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue != 0) throw new Exception("ignoreETest 0 failed");
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue != 21) throw new Exception("ignoreETest 21 failed");
+ if (enum_thorough_typesafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue != 22) throw new Exception("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough_typesafe.repeatTest(repeat.one).swigValue != 1) throw new Exception("repeatTest 1 failed");
if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i
index 31e3e2105..8de97decb 100644
--- a/Examples/test-suite/enum_thorough.i
+++ b/Examples/test-suite/enum_thorough.i
@@ -487,10 +487,55 @@ struct Instances {
// Repeated values
#if defined(SWIGJAVA)
%javaconst(1);
+// needed for typesafe and proper enums only
+%javaconst(0) ignoreA_three;
+%javaconst(0) ignoreA_thirteen;
#elif defined(SWIGCSHARP)
+// needed for typesafe enums only
+#ifdef SWIG_TEST_NOCSCONST
+ %csconst(0) ignoreA_three;
+ %csconst(0) ignoreA_thirteen;
+#endif
%csconst(1);
#endif
+%ignore ignoreA_one;
+%ignore ignoreA_two;
+%ignore ignoreA_twelve;
+%ignore ignoreA_thirty_one;
+
+%ignore ignoreB_ten;
+%ignore ignoreB_twenty;
+%ignore ignoreB_thirty;
+%ignore ignoreB_forty;
+
+%ignore ignoreC_eleven;
+%ignore ignoreC_thirty_one;
+%ignore ignoreC_forty_one;
+
+%ignore ignoreD_ten;
+%ignore ignoreD_twenty;
+
+%ignore ignoreE_twenty;
+
+%inline %{
+struct IgnoreTest {
+ enum IgnoreA { ignoreA_zero, ignoreA_one, ignoreA_two, ignoreA_three, ignoreA_ten=10, ignoreA_eleven, ignoreA_twelve, ignoreA_thirteen, ignoreA_fourteen, ignoreA_twenty=20, ignoreA_thirty=30, ignoreA_thirty_one, ignoreA_thirty_two, ignoreA_thirty_three };
+ enum IgnoreB { ignoreB_ten=10, ignoreB_eleven, ignoreB_twelve, ignoreB_twenty=20, ignoreB_thirty=30, ignoreB_thirty_one, ignoreB_thirty_two, ignoreB_forty=40, ignoreB_forty_one, ignoreB_forty_two };
+ enum IgnoreC { ignoreC_ten=10, ignoreC_eleven, ignoreC_twelve, ignoreC_twenty=20, ignoreC_thirty=30, ignoreC_thirty_one, ignoreC_thirty_two, ignoreC_forty=40, ignoreC_forty_one, ignoreC_forty_two };
+ enum IgnoreD { ignoreD_ten=10, ignoreD_twenty=20, ignoreD_twenty_one, ignoreD_twenty_two };
+ enum IgnoreE { ignoreE_zero, ignoreE_twenty=20, ignoreE_twenty_one, ignoreE_twenty_two };
+};
+
+IgnoreTest::IgnoreA ignoreATest(IgnoreTest::IgnoreA n) { return n; }
+IgnoreTest::IgnoreB ignoreBTest(IgnoreTest::IgnoreB n) { return n; }
+IgnoreTest::IgnoreC ignoreCTest(IgnoreTest::IgnoreC n) { return n; }
+IgnoreTest::IgnoreD ignoreDTest(IgnoreTest::IgnoreD n) { return n; }
+IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
+%}
+
+#warning TODO: remove SWIGPERL code - replace with portable symbols
+
#if defined(SWIGPERL)
%inline %{
diff --git a/Examples/test-suite/enum_thorough_typesafe.i b/Examples/test-suite/enum_thorough_typesafe.i
index 8bae5b07a..e205e8ad1 100644
--- a/Examples/test-suite/enum_thorough_typesafe.i
+++ b/Examples/test-suite/enum_thorough_typesafe.i
@@ -3,5 +3,7 @@
// Test enum wrapping using the typesafe enum pattern in the target language
%include "enumtypesafe.swg"
+#define SWIG_TEST_NOCSCONST // For C# typesafe enums
+
%include "enum_thorough.i"
diff --git a/Examples/test-suite/java/enum_thorough_proper_runme.java b/Examples/test-suite/java/enum_thorough_proper_runme.java
index 243d3bddd..39d50ea38 100644
--- a/Examples/test-suite/java/enum_thorough_proper_runme.java
+++ b/Examples/test-suite/java/enum_thorough_proper_runme.java
@@ -369,6 +369,45 @@ public class enum_thorough_proper_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
+ if (enum_thorough_proper.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
+ if (enum_thorough_proper.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
+ if (enum_thorough_proper.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
+ if (enum_thorough_proper.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
+ if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
+ if (enum_thorough_proper.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough_proper.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
diff --git a/Examples/test-suite/java/enum_thorough_runme.java b/Examples/test-suite/java/enum_thorough_runme.java
index 1cd02d38d..ce90ccb22 100644
--- a/Examples/test-suite/java/enum_thorough_runme.java
+++ b/Examples/test-suite/java/enum_thorough_runme.java
@@ -369,6 +369,45 @@ public class enum_thorough_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero).swigValue() != 0) throw new RuntimeException("ignoreATest 0 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three).swigValue() != 3) throw new RuntimeException("ignoreATest 3 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten).swigValue() != 10) throw new RuntimeException("ignoreATest 10 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven).swigValue() != 11) throw new RuntimeException("ignoreATest 11 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen).swigValue() != 13) throw new RuntimeException("ignoreATest 13 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen).swigValue() != 14) throw new RuntimeException("ignoreATest 14 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty).swigValue() != 20) throw new RuntimeException("ignoreATest 20 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty).swigValue() != 30) throw new RuntimeException("ignoreATest 30 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreATest 32 failed");
+ if (enum_thorough.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three).swigValue() != 33) throw new RuntimeException("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven).swigValue() != 11) throw new RuntimeException("ignoreBTest 11 failed");
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve).swigValue() != 12) throw new RuntimeException("ignoreBTest 12 failed");
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one).swigValue() != 31) throw new RuntimeException("ignoreBTest 31 failed");
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreBTest 32 failed");
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one).swigValue() != 41) throw new RuntimeException("ignoreBTest 41 failed");
+ if (enum_thorough.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two).swigValue() != 42) throw new RuntimeException("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten).swigValue() != 10) throw new RuntimeException("ignoreCTest 10 failed");
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve).swigValue() != 12) throw new RuntimeException("ignoreCTest 12 failed");
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty).swigValue() != 30) throw new RuntimeException("ignoreCTest 30 failed");
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two).swigValue() != 32) throw new RuntimeException("ignoreCTest 32 failed");
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty).swigValue() != 40) throw new RuntimeException("ignoreCTest 40 failed");
+ if (enum_thorough.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two).swigValue() != 42) throw new RuntimeException("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreDTest 21 failed");
+ if (enum_thorough.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero).swigValue() != 0) throw new RuntimeException("ignoreETest 0 failed");
+ if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one).swigValue() != 21) throw new RuntimeException("ignoreETest 21 failed");
+ if (enum_thorough.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two).swigValue() != 22) throw new RuntimeException("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough.repeatTest(repeat.one).swigValue() != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
diff --git a/Examples/test-suite/java/enum_thorough_simple_runme.java b/Examples/test-suite/java/enum_thorough_simple_runme.java
index 9bd56273e..bc3e3123d 100644
--- a/Examples/test-suite/java/enum_thorough_simple_runme.java
+++ b/Examples/test-suite/java/enum_thorough_simple_runme.java
@@ -369,6 +369,45 @@ public class enum_thorough_simple_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
+ if (enum_thorough_simple.ignoreATest(IgnoreTest.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
+ if (enum_thorough_simple.ignoreBTest(IgnoreTest.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
+ if (enum_thorough_simple.ignoreCTest(IgnoreTest.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
+ if (enum_thorough_simple.ignoreDTest(IgnoreTest.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
+ if (enum_thorough_simple.ignoreETest(IgnoreTest.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
diff --git a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
index 35d1a1937..27aba72d4 100644
--- a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
+++ b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
@@ -369,6 +369,45 @@ public class enum_thorough_typeunsafe_runme {
i.setMemberInstance(Instances.memberinstance3);
if (i.getMemberInstance() != Instances.memberinstance3) throw new RuntimeException("MemberInstance 1 failed");
}
+ // ignore enum item tests start
+ {
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_zero) != 0) throw new RuntimeException("ignoreATest 0 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_three) != 3) throw new RuntimeException("ignoreATest 3 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_ten) != 10) throw new RuntimeException("ignoreATest 10 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_eleven) != 11) throw new RuntimeException("ignoreATest 11 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirteen) != 13) throw new RuntimeException("ignoreATest 13 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_fourteen) != 14) throw new RuntimeException("ignoreATest 14 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_twenty) != 20) throw new RuntimeException("ignoreATest 20 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty) != 30) throw new RuntimeException("ignoreATest 30 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_two) != 32) throw new RuntimeException("ignoreATest 32 failed");
+ if (enum_thorough_typeunsafe.ignoreATest(IgnoreTest.IgnoreA.ignoreA_thirty_three) != 33) throw new RuntimeException("ignoreATest 33 failed");
+ }
+ {
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_eleven) != 11) throw new RuntimeException("ignoreBTest 11 failed");
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_twelve) != 12) throw new RuntimeException("ignoreBTest 12 failed");
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_one) != 31) throw new RuntimeException("ignoreBTest 31 failed");
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_thirty_two) != 32) throw new RuntimeException("ignoreBTest 32 failed");
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_one) != 41) throw new RuntimeException("ignoreBTest 41 failed");
+ if (enum_thorough_typeunsafe.ignoreBTest(IgnoreTest.IgnoreB.ignoreB_forty_two) != 42) throw new RuntimeException("ignoreBTest 42 failed");
+ }
+ {
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_ten) != 10) throw new RuntimeException("ignoreCTest 10 failed");
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_twelve) != 12) throw new RuntimeException("ignoreCTest 12 failed");
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty) != 30) throw new RuntimeException("ignoreCTest 30 failed");
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_thirty_two) != 32) throw new RuntimeException("ignoreCTest 32 failed");
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty) != 40) throw new RuntimeException("ignoreCTest 40 failed");
+ if (enum_thorough_typeunsafe.ignoreCTest(IgnoreTest.IgnoreC.ignoreC_forty_two) != 42) throw new RuntimeException("ignoreCTest 42 failed");
+ }
+ {
+ if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_one) != 21) throw new RuntimeException("ignoreDTest 21 failed");
+ if (enum_thorough_typeunsafe.ignoreDTest(IgnoreTest.IgnoreD.ignoreD_twenty_two) != 22) throw new RuntimeException("ignoreDTest 22 failed");
+ }
+ {
+ if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_zero) != 0) throw new RuntimeException("ignoreETest 0 failed");
+ if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_one) != 21) throw new RuntimeException("ignoreETest 21 failed");
+ if (enum_thorough_typeunsafe.ignoreETest(IgnoreTest.IgnoreE.ignoreE_twenty_two) != 22) throw new RuntimeException("ignoreETest 22 failed");
+ }
+ // ignore enum item tests end
{
if (enum_thorough_typeunsafe.repeatTest(repeat.one) != 1) throw new RuntimeException("repeatTest 1 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
diff --git a/Examples/test-suite/perl5/enum_thorough_runme.pl b/Examples/test-suite/perl5/enum_thorough_runme.pl
index 80a2ccae9..8be59364f 100644
--- a/Examples/test-suite/perl5/enum_thorough_runme.pl
+++ b/Examples/test-suite/perl5/enum_thorough_runme.pl
@@ -1,7 +1,7 @@
# an adaptation of ../java/enum_thorough_runme.java
use strict;
use warnings;
-use Test::More tests => 272;
+use Test::More tests => 299;
BEGIN { use_ok('enum_thorough') }
require_ok('enum_thorough');
@@ -348,6 +348,45 @@ SKIP: {
$i->{MemberInstance} = $enum_thorough::Instances::memberinstance3;
is($i->{MemberInstance}, $enum_thorough::Instances::memberinstance3, "MemberInstance 1");
}
+# ignore enum item tests start
+{
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_zero), 0, "ignoreATest 0");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_three), 3, "ignoreATest 3");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_ten), 10, "ignoreATest 10");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_eleven), 11, "ignoreATest 11");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_thirteen), 13, "ignoreATest 13");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_fourteen), 14, "ignoreATest 14");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_twenty), 20, "ignoreATest 20");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_thirty), 30, "ignoreATest 30");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_thirty_two), 32, "ignoreATest 32");
+ is(enum_thorough::ignoreATest($enum_thorough::IgnoreTest::ignoreA_thirty_three), 33, "ignoreATest 33");
+}
+{
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_eleven), 11, "ignoreBTest 11");
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_twelve), 12, "ignoreBTest 12");
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_thirty_one), 31, "ignoreBTest 31");
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_thirty_two), 32, "ignoreBTest 32");
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_forty_one), 41, "ignoreBTest 41");
+ is(enum_thorough::ignoreBTest($enum_thorough::IgnoreTest::ignoreB_forty_two), 42, "ignoreBTest 42");
+}
+{
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_ten), 10, "ignoreCTest 10");
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_twelve), 12, "ignoreCTest 12");
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_thirty), 30, "ignoreCTest 30");
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_thirty_two), 32, "ignoreCTest 32");
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_forty), 40, "ignoreCTest 40");
+ is(enum_thorough::ignoreCTest($enum_thorough::IgnoreTest::ignoreC_forty_two), 42, "ignoreCTest 42");
+}
+{
+ is(enum_thorough::ignoreDTest($enum_thorough::IgnoreTest::ignoreD_twenty_one), 21, "ignoreDTest 21");
+ is(enum_thorough::ignoreDTest($enum_thorough::IgnoreTest::ignoreD_twenty_two), 22, "ignoreDTest 22");
+}
+{
+ is(enum_thorough::ignoreETest($enum_thorough::IgnoreTest::ignoreE_zero), 0, "ignoreETest 0");
+ is(enum_thorough::ignoreETest($enum_thorough::IgnoreTest::ignoreE_twenty_one), 21, "ignoreETest 21");
+ is(enum_thorough::ignoreETest($enum_thorough::IgnoreTest::ignoreE_twenty_two), 22, "ignoreETest 22");
+}
+# ignore enum item tests end
{
is(enum_thorough::repeatTest($enum_thorough::one), 1, "repeatTest 1");
is(enum_thorough::repeatTest($enum_thorough::initial), 1, "repeatTest 2");
@@ -368,8 +407,8 @@ SKIP: {
is(enum_thorough::speedTest4($enum_thorough::SpeedClass::slow),
$enum_thorough::SpeedClass::slow, "speedTest Global 4");
is(enum_thorough::speedTest5($enum_thorough::SpeedClass::slow),
- $enum_thorough::SpeedClass::slow, "speedTest Global 5 failed");
+ $enum_thorough::SpeedClass::slow, "speedTest Global 5");
is(enum_thorough::speedTest4($enum_thorough::SpeedClass::fast),
- $enum_thorough::SpeedClass::fast, "speedTest Global 4 failed");
+ $enum_thorough::SpeedClass::fast, "speedTest Global 4");
is(enum_thorough::speedTest5($enum_thorough::SpeedClass::fast),
- $enum_thorough::SpeedClass::fast, "speedTest Global 5 failed");
+ $enum_thorough::SpeedClass::fast, "speedTest Global 5");
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 05d5c72e1..ad6830ec6 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -1227,7 +1227,7 @@ public:
if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) {
// Wrap (non-anonymous) C/C++ enum with a proper C# enum
// Emit the enum item.
- if (!Getattr(n, "_last")) // Only the first enum item has this attribute set
+ if (!GetFlag(n, "firstenumitem"))
Printf(enum_code, ",\n");
Printf(enum_code, " %s", symname);
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 72556a04b..50ef506ed 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1283,7 +1283,7 @@ public:
if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) {
// Wrap (non-anonymous) C/C++ enum with a proper Java enum
// Emit the enum item.
- if (!Getattr(n, "_last")) // Only the first enum item has this attribute set
+ if (!GetFlag(n, "firstenumitem"))
Printf(enum_code, ",\n");
Printf(enum_code, " %s", symname);
if (Getattr(n, "enumvalue")) {
diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx
index d663aed6e..9b42bc1a3 100644
--- a/Source/Modules/typepass.cxx
+++ b/Source/Modules/typepass.cxx
@@ -730,6 +730,49 @@ class TypePass:private Dispatcher {
}
Setattr(n, "enumtype", enumtype);
+ // This block of code is for dealing with %ignore on an enum item where the target language
+ // attempts to use the C enum value in the target language itself and expects the previous enum value
+ // to be one more than the previous value... the previous enum item might not exist if it is ignored!
+ // - It sets the first non-ignored enum item with the "firstenumitem" attribute.
+ // - It adds an enumvalue attribute if the previous enum item is ignored
+ {
+ Node *c;
+ int count = 0;
+ String *previous = 0;
+ bool previous_ignored = false;
+ bool firstenumitem = false;
+ for (c = firstChild(n); c; c = nextSibling(c)) {
+ assert(strcmp(Char(nodeType(c)), "enumitem") == 0);
+
+ bool reset;
+ String *enumvalue = Getattr(c, "enumvalue");
+ if (GetFlag(c, "feature:ignore")) {
+ reset = enumvalue ? true : false;
+ previous_ignored = true;
+ } else {
+ if (!enumvalue && previous_ignored) {
+ if (previous)
+ Setattr(c, "enumvalue", NewStringf("(%s) + %d", previous, count+1));
+ else
+ Setattr(c, "enumvalue", NewStringf("%d", count));
+ SetFlag(c, "virtenumvalue"); // identify enumvalue as virtual, ie not from the parsed source
+ }
+ if (!firstenumitem) {
+ SetFlag(c, "firstenumitem");
+ firstenumitem = true;
+ }
+ reset = true;
+ previous_ignored = false;
+ }
+ if (reset) {
+ previous = enumvalue ? enumvalue : Getattr(c, "name");
+ count = 0;
+ } else {
+ count++;
+ }
+ }
+ }
+
emit_children(n);
return SWIG_OK;
}
@@ -753,13 +796,16 @@ class TypePass:private Dispatcher {
Setattr(n, "value", new_value);
Delete(new_value);
}
- // Make up an enumvalue if one was not specified in the parsed code
- if (Getattr(n, "_last") && !Getattr(n, "enumvalue")) { // Only the first enum item has _last set
- Setattr(n, "enumvalueex", "0");
- }
Node *next = nextSibling(n);
- if (next && !Getattr(next, "enumvalue")) {
- Setattr(next, "enumvalueex", NewStringf("%s + 1", Getattr(n, "sym:name")));
+
+ // Make up an enumvalue if one was not specified in the parsed code (not designed to be used on enum items and %ignore - enumvalue will be set instead)
+ if (!GetFlag(n, "feature:ignore")) {
+ if (Getattr(n, "_last") && !Getattr(n, "enumvalue")) { // Only the first enum item has _last set (Note: first non-ignored enum item has firstenumitem set)
+ Setattr(n, "enumvalueex", "0");
+ }
+ if (next && !Getattr(next, "enumvalue")) {
+ Setattr(next, "enumvalueex", NewStringf("%s + 1", Getattr(n, "sym:name")));
+ }
}
return SWIG_OK;
From 222b9e4710891aac04073a43c08d839813805699 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Tue, 16 Jun 2009 20:26:28 +0000
Subject: [PATCH 006/352] remove perl specific modifications to the
enum_thorough test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11280 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
.../test-suite/csharp/enum_thorough_runme.cs | 2 +-
.../csharp/enum_thorough_simple_runme.cs | 2 +-
.../csharp/enum_thorough_typesafe_runme.cs | 2 +-
Examples/test-suite/enum_thorough.i | 24 -------------------
.../java/enum_thorough_proper_runme.java | 2 +-
.../test-suite/java/enum_thorough_runme.java | 2 +-
.../java/enum_thorough_simple_runme.java | 2 +-
.../java/enum_thorough_typeunsafe_runme.java | 2 +-
.../test-suite/perl5/enum_thorough_runme.pl | 9 ++-----
9 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/Examples/test-suite/csharp/enum_thorough_runme.cs b/Examples/test-suite/csharp/enum_thorough_runme.cs
index d68e2b5fa..144736f2b 100644
--- a/Examples/test-suite/csharp/enum_thorough_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_runme.cs
@@ -402,7 +402,7 @@ public class runme {
if ((int)enum_thorough.repeatTest(repeat.initial) != 1) throw new Exception("repeatTest 2 failed");
if ((int)enum_thorough.repeatTest(repeat.two) != 2) throw new Exception("repeatTest 3 failed");
if ((int)enum_thorough.repeatTest(repeat.three) != 3) throw new Exception("repeatTest 4 failed");
- if ((int)enum_thorough.repeatTest(repeat.last) != 3) throw new Exception("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
index 4a2f240c1..d5bba1b7d 100644
--- a/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_simple_runme.cs
@@ -402,7 +402,7 @@ public class runme {
if (enum_thorough_simple.repeatTest(enum_thorough_simple.initial) != 1) throw new Exception("repeatTest 2 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.two) != 2) throw new Exception("repeatTest 3 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simple.three) != 3) throw new Exception("repeatTest 4 failed");
- if (enum_thorough_simple.repeatTest(enum_thorough_simple.last) != 3) throw new Exception("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
index 638885c52..3606d1137 100644
--- a/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
+++ b/Examples/test-suite/csharp/enum_thorough_typesafe_runme.cs
@@ -402,7 +402,7 @@ public class runme {
if (enum_thorough_typesafe.repeatTest(repeat.initial).swigValue != 1) throw new Exception("repeatTest 2 failed");
if (enum_thorough_typesafe.repeatTest(repeat.two).swigValue != 2) throw new Exception("repeatTest 3 failed");
if (enum_thorough_typesafe.repeatTest(repeat.three).swigValue != 3) throw new Exception("repeatTest 4 failed");
- if (enum_thorough_typesafe.repeatTest(repeat.last).swigValue != 3) throw new Exception("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i
index 8de97decb..974227a01 100644
--- a/Examples/test-suite/enum_thorough.i
+++ b/Examples/test-suite/enum_thorough.i
@@ -534,9 +534,6 @@ IgnoreTest::IgnoreD ignoreDTest(IgnoreTest::IgnoreD n) { return n; }
IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
%}
-#warning TODO: remove SWIGPERL code - replace with portable symbols
-
-#if defined(SWIGPERL)
%inline %{
namespace RepeatSpace {
@@ -554,24 +551,3 @@ repeat repeatTest(repeat e) { return e; }
%}
-#else
-%inline %{
-
-namespace RepeatSpace {
-typedef enum
-{
- one = 1,
- initial = one,
- two,
- three,
- last = three,
- end = last
-} repeat;
-repeat repeatTest(repeat e) { return e; }
-}
-
-%}
-
-
-#endif
-
diff --git a/Examples/test-suite/java/enum_thorough_proper_runme.java b/Examples/test-suite/java/enum_thorough_proper_runme.java
index 39d50ea38..66968060d 100644
--- a/Examples/test-suite/java/enum_thorough_proper_runme.java
+++ b/Examples/test-suite/java/enum_thorough_proper_runme.java
@@ -413,7 +413,7 @@ public class enum_thorough_proper_runme {
if (enum_thorough_proper.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_proper.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_proper.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
- if (enum_thorough_proper.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/java/enum_thorough_runme.java b/Examples/test-suite/java/enum_thorough_runme.java
index ce90ccb22..79c902ccf 100644
--- a/Examples/test-suite/java/enum_thorough_runme.java
+++ b/Examples/test-suite/java/enum_thorough_runme.java
@@ -413,7 +413,7 @@ public class enum_thorough_runme {
if (enum_thorough.repeatTest(repeat.initial).swigValue() != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough.repeatTest(repeat.two).swigValue() != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough.repeatTest(repeat.three).swigValue() != 3) throw new RuntimeException("repeatTest 4 failed");
- if (enum_thorough.repeatTest(repeat.last).swigValue() != 3) throw new RuntimeException("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/java/enum_thorough_simple_runme.java b/Examples/test-suite/java/enum_thorough_simple_runme.java
index bc3e3123d..e54acda70 100644
--- a/Examples/test-suite/java/enum_thorough_simple_runme.java
+++ b/Examples/test-suite/java/enum_thorough_simple_runme.java
@@ -413,7 +413,7 @@ public class enum_thorough_simple_runme {
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.three) != 3) throw new RuntimeException("repeatTest 4 failed");
- if (enum_thorough_simple.repeatTest(enum_thorough_simpleConstants.last) != 3) throw new RuntimeException("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
index 27aba72d4..b00788911 100644
--- a/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
+++ b/Examples/test-suite/java/enum_thorough_typeunsafe_runme.java
@@ -413,7 +413,7 @@ public class enum_thorough_typeunsafe_runme {
if (enum_thorough_typeunsafe.repeatTest(repeat.initial) != 1) throw new RuntimeException("repeatTest 2 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.two) != 2) throw new RuntimeException("repeatTest 3 failed");
if (enum_thorough_typeunsafe.repeatTest(repeat.three) != 3) throw new RuntimeException("repeatTest 4 failed");
- if (enum_thorough_typeunsafe.repeatTest(repeat.last) != 3) throw new RuntimeException("repeatTest 5 failed");
+ 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");
}
}
diff --git a/Examples/test-suite/perl5/enum_thorough_runme.pl b/Examples/test-suite/perl5/enum_thorough_runme.pl
index 8be59364f..66e719275 100644
--- a/Examples/test-suite/perl5/enum_thorough_runme.pl
+++ b/Examples/test-suite/perl5/enum_thorough_runme.pl
@@ -1,7 +1,7 @@
# an adaptation of ../java/enum_thorough_runme.java
use strict;
use warnings;
-use Test::More tests => 299;
+use Test::More tests => 298;
BEGIN { use_ok('enum_thorough') }
require_ok('enum_thorough');
@@ -392,12 +392,7 @@ SKIP: {
is(enum_thorough::repeatTest($enum_thorough::initial), 1, "repeatTest 2");
is(enum_thorough::repeatTest($enum_thorough::two), 2, "repeatTest 3");
is(enum_thorough::repeatTest($enum_thorough::three), 3, "repeatTest 4");
-{ local $TODO = "overzealous keyword guarding";
- ok(defined($enum_thorough::last), "found enum value");
-SKIP: {
- skip "enum value not in expected package", 1 unless defined $enum_thorough::last;
- is(enum_thorough::repeatTest($enum_thorough::last), 3, "repeatTest 5");
-}}
+ is(enum_thorough::repeatTest($enum_thorough::llast), 3, "repeatTest 5");
is(enum_thorough::repeatTest($enum_thorough::end), 3, "repeatTest 6");
}
From d833dc83f06ede4fcf4c2a57677783e1f0990ad6 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Tue, 16 Jun 2009 20:39:53 +0000
Subject: [PATCH 007/352] fix error in bug reporter for enums and %ignore
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11281 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/CHANGES.current b/CHANGES.current
index a3b0bcd27..822d2feed 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -2,9 +2,8 @@ Version 1.3.40 (in progress)
============================
2009-06-16: wsfulton
- [Java,C#] Fix enum marshalling when %ignore is used on one of the enum items reported
- by Lubomir Konstantinov. Incorrect enum values were being passed to the C++ layer or
- compilation errors resulted.
+ [Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
+ Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
2009-06-02: talby
[Perl] Resolved reference.i overload support problem
From c3dba3315b45d128d7d24ae69e96a14130cc3ee5 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Wed, 17 Jun 2009 06:50:39 +0000
Subject: [PATCH 008/352] better clarification for %include and #include and
%module
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11282 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/CSharp.html | 3 ++-
Doc/Manual/Java.html | 6 ++++++
Doc/Manual/SWIG.html | 29 +++++++++++++++++++++--------
3 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index 3e17ee7f1..f747fc213 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -99,6 +99,7 @@ namespace com.bloggs.widget {
...
}
+Note that by default, the generated C# classes have no namespace and the module name is unrelated to namespaces. The module name is just like in Java and is merely used to name some of the generated classes.
@@ -131,7 +132,7 @@ If it was used, it would generate an illegal runtime initialisation via a PInvok
C# doesn't support the notion of throws clauses.
Therefore there is no 'throws' typemap attribute support for adding exception classes to a throws clause.
Likewise there is no need for an equivalent to %javaexception.
-In fact, throwing C# exceptions works quite differently, see C# Exceptions> below.
+In fact, throwing C# exceptions works quite differently, see C# Exceptions below.
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index a19cc5e84..2cde5ddab 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -253,6 +253,12 @@ To change this, you can use the -o option.
It is also possible to change the output directory that the Java files are generated into using -outdir.
+
+The module name, specified with %module, determines the name of various generated classes as discussed later.
+Note that the module name does not define a Java package and by default, the generated Java classes do not have a Java package.
+The -package option described below can specify a Java package name to use.
+
+
The following sections have further practical examples and details on how you might go about
compiling and using the generated files.
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index d52f0441c..3cbd3cf21 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -177,8 +177,10 @@ int bar(int x);
The name of the module is supplied using the special %module
directive (or the -module command line option). This
directive must appear at the beginning of the file and is used to name
-the resulting extension module (in addition, this name often defines
-a namespace in the target language). If the module name is supplied on the
+the resulting target language extension module. Exactly what this results
+in depends on the target language, eg the module name can define
+a target language namespace or merely be a useful name for naming files or helper classes.
+If the module name is supplied on the
command line, it overrides the name specified with the
%module directive.
@@ -2361,7 +2363,7 @@ You can make a Vector look a lot like a class by writing a SWIG interfa
#include "vector.h"
%}
-%include vector.h // Just grab original C header file
+%include "vector.h" // Just grab original C header file
%extend Vector { // Attach these functions to struct Vector
Vector(double x, double y, double z) {
Vector *v;
@@ -2883,10 +2885,16 @@ interface to your program.
SWIG's %include directive to process an entire C
source/header file.
-Make sure everything in the interface file uses ANSI C/C++syntax.
+Make sure everything in the interface file uses ANSI C/C++ syntax.
Make sure all necessary `typedef' declarations and
-type-information is available in the interface file.
+type-information is available in the interface file.
+In particular, ensure that the type information is specified in the correct order as required by a C compiler.
+In particular, define a type before it is used! A C compiler will tell you
+if the full type information is not available when it is needed, whereas
+SWIG will usually not warn or error out as it is designed to work without
+full type information. However, if type information is not specified
+correctly, the wrappers can be sub-optimal.
If your program has a main() function, you may need to rename it
(read on).
@@ -2945,16 +2953,21 @@ extern void dump(FILE *f);
Of course, in this case, our header file is pretty simple so we could
-have made an interface file like this as well:
+use a simpler approach and use an interface file like this:
/* File : interface.i */
%module mymodule
-%include header.h
+%{
+#include "header.h"
+%}
+%include "header.h"
-Naturally, your mileage may vary.
+The main advantage of this approach is minimal maintenance of an interface file for when the header file changes in the future.
+In more complex projects, an interface file containing numerous %include and #include statements like this is one of the most common approaches to interface file design due to lower maintenance overhead.
+
5.7.3 Why use separate interface files?
From 23a5f4f9558b685ab7b9fdd4e2c8710d58153164 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Wed, 17 Jun 2009 06:56:55 +0000
Subject: [PATCH 009/352] quote %include statements
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11283 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/Arguments.html | 2 +-
Doc/Manual/Ocaml.html | 4 ++--
Doc/Manual/Perl5.html | 4 ++--
Doc/Manual/Php.html | 6 +++---
Doc/Manual/Python.html | 2 +-
Doc/Manual/Ruby.html | 2 +-
Doc/Manual/Tcl.html | 4 ++--
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html
index af8780452..911e8548e 100644
--- a/Doc/Manual/Arguments.html
+++ b/Doc/Manual/Arguments.html
@@ -351,7 +351,7 @@ function like this in an interface file :
%module example
-%include typemaps.i
+%include "typemaps.i"
...
%{
extern void negate(double *);
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index 6dbf24c11..b65831192 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -634,13 +634,13 @@ length. Instead, use multiple returns, as in the argout_ref example.
#include "example.h"
%}
-%include stl.i
+%include <stl.i>
namespace std {
%template(StringVector) std::vector < string >;
};
-%include example.h
+%include "example.h"
| This example is in Examples/ocaml/stl
|
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index 1dc8e7d2f..f77dc2f01 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -264,7 +264,7 @@ extern int fact(int);
%}
// Include code for rebuilding Perl
-%include perlmain.i
+%include <perlmain.i>
@@ -1543,7 +1543,7 @@ example:
%module example
-%include typemaps.i
+%include "typemaps.i"
void add(int x, int y, int *REFERENCE);
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 6e87a29a2..ab2c73f6c 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -479,7 +479,7 @@ One can include
cpointer.i to generate PHP wrappers to
int
%module example
-%include cpointer.i
+%include "cpointer.i"
%pointer_functions(int,intp)
void add( int *in1, int *in2, int *result);
@@ -513,7 +513,7 @@ parameter names as appropriate.
%module example
-%include typemaps.i
+%include "typemaps.i"
void add( int *INPUT, int *INPUT, int *OUTPUT);
@@ -545,7 +545,7 @@ named typemap REFERENCE.
%module example
-%include phppointers.i
+%include "phppointers.i"
void add( int *REF, int *REF, int *REF);
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index f4867b69d..cfc035f00 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -433,7 +433,7 @@ extern int mod(int, int);
extern double My_variable;
%}
-%include embed.i // Include code for a static version of Python
+%include "embed.i" // Include code for a static version of Python
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index 2070db0c0..98fa315d0 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -2393,7 +2393,7 @@ intset;
-%include std_set.i
+%include <std_set.i>
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index b36395cab..04959de5f 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -190,7 +190,7 @@ extern int mod(int, int);
extern double My_variable;
%}
-%include tclsh.i // Include code for rebuilding tclsh
+%include "tclsh.i" // Include code for rebuilding tclsh
@@ -2822,7 +2822,7 @@ int print_args(char **argv) {
return i;
}
%}
-%include tclsh.i
+%include "tclsh.i"
From 1a2e3a6653e225e6dbddddf9c70e03b78020f032 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 18 Jun 2009 22:36:39 +0000
Subject: [PATCH 010/352] add further clarification about modules
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/Contents.html | 1 +
Doc/Manual/Modules.html | 55 ++++++++++++++++++++++++++++++++++------
Doc/Manual/SWIG.html | 19 +++++---------
3 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index c135b7c6f..e997e46cb 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -488,6 +488,7 @@
+- Modules Introduction
- Basics
- The SWIG runtime code
- External access to the runtime
diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html
index 5ac66dc2e..6e1592d16 100644
--- a/Doc/Manual/Modules.html
+++ b/Doc/Manual/Modules.html
@@ -10,6 +10,7 @@
+- Modules Introduction
- Basics
- The SWIG runtime code
- External access to the runtime
@@ -22,11 +23,48 @@
+
15.1 Modules Introduction
+
+
+
+Each invocation of SWIG requires a module name to be specified.
+The module name is used to name the resulting target language extension module.
+Exactly what this means and and what the name is used for
+depends on the target language, for example the name can define
+a target language namespace or merely be a useful name for naming files or helper classes.
+
+
+
+The module name can be supplied in one of two ways.
+The first is to specify it with the special %module
+directive. This directive must appear at the beginning of the interface file.
+The general form of this directive is:
+
+
+
+%module(option1="value1",option2="value2",...) modulename
+
+
+
+where the modulename is mandatory and the options add one or more optional additional features.
+Typically no options are specified, for example:
+
+
+
+
+
+The second way to specify the module name is with the -module command line option, for example -module mymodule.
+If the module name is supplied on the command line, it overrides the name specified by the
+%module directive.
+
+
When first working with SWIG, users commonly start by creating a
single module. That is, you might define a single SWIG interface that
wraps some set of C/C++ code. You then compile all of the generated
-wrapper code into a module and use it. For large applications, however,
+wrapper code together and use it. For large applications, however,
this approach is problematic---the size of the generated wrapper code
can be rather large. Moreover, it is probably easier to manage the
target language interface when it is broken up into smaller pieces.
@@ -34,10 +72,11 @@ target language interface when it is broken up into smaller pieces.
This chapter describes the problem of using SWIG in programs
-where you want to create a collection of modules.
+where you want to create a collection of modules.
+Each module in the collection is created via separate invocations of SWIG.
-15.1 Basics
+15.2 Basics
@@ -135,7 +174,7 @@ in parallel from multiple threads as SWIG provides no locking - for more on that
issue, read on.
-15.2 The SWIG runtime code
+15.3 The SWIG runtime code
@@ -201,7 +240,7 @@ can peacefully coexist. So the type structures are separated by the
is empty. Only modules compiled with the same pair will share type information.
-15.3 External access to the runtime
+15.4 External access to the runtime
As described in The run-time type checker,
@@ -238,7 +277,7 @@ SWIG_TYPE_TABLE to be the same as the module whose types you are trying to
access.
-15.4 A word of caution about static libraries
+15.5 A word of caution about static libraries
@@ -249,7 +288,7 @@ into it. This is very often NOT what you want and it can lead to unexpect
behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libraries.
-15.5 References
+15.6 References
@@ -257,7 +296,7 @@ Due to the complexity of working with shared libraries and multiple modules, it
an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
-15.6 Reducing the wrapper file size
+15.7 Reducing the wrapper file size
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index 3cbd3cf21..1bdc6b4d0 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -174,15 +174,8 @@ int bar(int x);
...
-The name of the module is supplied using the special %module
-directive (or the -module command line option). This
-directive must appear at the beginning of the file and is used to name
-the resulting target language extension module. Exactly what this results
-in depends on the target language, eg the module name can define
-a target language namespace or merely be a useful name for naming files or helper classes.
-If the module name is supplied on the
-command line, it overrides the name specified with the
-%module directive.
+The module name is supplied using the special %module
+directive. Modules are described further in the Modules Introduction section.
@@ -2889,12 +2882,12 @@ source/header file.
- Make sure all necessary `typedef' declarations and
type-information is available in the interface file.
-In particular, ensure that the type information is specified in the correct order as required by a C compiler.
-In particular, define a type before it is used! A C compiler will tell you
-if the full type information is not available when it is needed, whereas
+In particular, ensure that the type information is specified in the correct order as required by a C/C++ compiler.
+Most importantly, define a type before it is used! A C compiler will tell you
+if the full type information is not available if it is needed, whereas
SWIG will usually not warn or error out as it is designed to work without
full type information. However, if type information is not specified
-correctly, the wrappers can be sub-optimal.
+correctly, the wrappers can be sub-optimal and even result in uncompileable C/C++ code.
- If your program has a main() function, you may need to rename it
(read on).
From 421a4419f2463bdb7c79ae887ce760a44121ea8d Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Sat, 20 Jun 2009 00:32:49 +0000
Subject: [PATCH 011/352] a bit more on what is in a module
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11287 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/Modules.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html
index 6e1592d16..1b628f802 100644
--- a/Doc/Manual/Modules.html
+++ b/Doc/Manual/Modules.html
@@ -32,6 +32,7 @@ The module name is used to name the resulting target language extension module.
Exactly what this means and and what the name is used for
depends on the target language, for example the name can define
a target language namespace or merely be a useful name for naming files or helper classes.
+Essentially, a module comprises target language wrappers for a chosen collection of global variables/functions, structs/classes and other C/C++ types.
From 5d3deb2db19f23a0d37dc207bc983e4f37afbfc9 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Wed, 24 Jun 2009 17:20:17 +0000
Subject: [PATCH 012/352] Fixes for compactdefaultargs and pass by value where
the class being passed by value has no default constructor - previously it
used SwigValueWrapper
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11312 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 6 ++++++
Examples/test-suite/default_args.i | 2 ++
Source/Swig/cwrap.c | 6 +++++-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index 822d2feed..d5b0062be 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,12 @@
Version 1.3.40 (in progress)
============================
+2009-06-24: wsfulton
+ Fix wrapping methods with default arguments and the compactdefaultargs feature
+ where a class is passed by value and is assigned a default value. The SwigValueWrapper
+ template workaround for a missing default constructor is no longer used as the code
+ generated does not call the default constructor.
+
2009-06-16: wsfulton
[Java,C#] Fix enum marshalling when %ignore is used on one of the enum items.
Incorrect enum values were being passed to the C++ layer or compilation errors resulted.
diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i
index 69c90e2e6..839d28e3e 100644
--- a/Examples/test-suite/default_args.i
+++ b/Examples/test-suite/default_args.i
@@ -119,6 +119,7 @@
// tests valuewrapper
+%feature("compactdefaultargs") MyClass2::set;
%inline %{
enum MyType { Val1, Val2 };
@@ -134,6 +135,7 @@
void set(MyClass1 cl1 = Val1) {}
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
// But it works in C++ since there is a "conversion" constructor in MyClass1.
+ void set2(MyClass1 cl1 = Val1) {}
};
%}
diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c
index 7c6837a2b..121ea150a 100644
--- a/Source/Swig/cwrap.c
+++ b/Source/Swig/cwrap.c
@@ -195,7 +195,11 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
String *type = Getattr(p, "type");
/* default values only emitted if in compact default args mode */
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
- SwigType *altty = SwigType_alttype(type, 0);
+
+ /* When using compactdefaultargs, the code generated initialises a variable via a constructor call that accepts the
+ * default value as a parameter. The default constructor is not called and therefore SwigValueWrapper is not needed. */
+ SwigType *altty = pvalue ? 0 : SwigType_alttype(type, 0);
+
int tycode = SwigType_type(type);
if (tycode == T_REFERENCE) {
if (pvalue) {
From c7d90e58d80e0ad5efe9d6c5fac6d5b2d96a3ca7 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 25 Jun 2009 06:01:11 +0000
Subject: [PATCH 013/352] improve some director warning messages
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11316 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Source/Modules/csharp.cxx | 22 ++++++++++++++--------
Source/Modules/java.cxx | 38 ++++++++++++++++++++++++--------------
2 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index ad6830ec6..82abc4803 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -3332,7 +3332,8 @@ public:
Delete(jretval_decl);
}
} else {
- Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(returntype, 0));
+ Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3475,11 +3476,13 @@ public:
Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(pt, 0));
}
} else {
- Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, "No csdirectorin typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number, "No csdirectorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
} else {
- Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3489,11 +3492,13 @@ public:
} else {
if (!desc_tm) {
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap defined for %s\n", SwigType_str(c_param_type, 0));
+ "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p);
} else if (!tm) {
Swig_warning(WARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap defined for argument %s\n", SwigType_str(pt, 0));
+ "No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p);
}
@@ -3502,7 +3507,8 @@ public:
Delete(tp);
} else {
- Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No ctype typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
p = nextSibling(p);
}
@@ -3602,8 +3608,8 @@ public:
Printf(w->code, "%s\n", tm);
} else {
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
- "Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(returntype, 0),
- SwigType_namestr(c_classname), SwigType_namestr(name));
+ "Unable to use return type %s used in %s::%s (skipping director method)\n",
+ SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 50ef506ed..4f393b839 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -3387,7 +3387,8 @@ public:
Append(classret_desc, jnidesc_canon);
Delete(jnidesc_canon);
} else {
- Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "No or improper directorin typemap defined for %s\n", SwigType_str(returntype, 0));
+ Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number, "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3418,13 +3419,15 @@ public:
Delete(jnidesc_canon);
} else {
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap defined for %s\n", SwigType_str(c_ret_type, 0));
+ "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(c_ret_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
Delete(tp);
} else {
- Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s\n", SwigType_str(returntype, 0));
+ Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3508,8 +3511,8 @@ public:
Delete(tm);
} else {
Swig_warning(WARN_TYPEMAP_DIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap for type %s used in director method %s::%s\n", SwigType_str(type, 0), SwigType_namestr(c_classname),
- SwigType_namestr(name));
+ "No or improper directorin typemap for type %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3595,11 +3598,13 @@ public:
Append(classdesc, jni_canon);
Delete(jni_canon);
} else {
- Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, "No javadirectorin typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number, "No javadirectorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
} else {
- Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
@@ -3609,19 +3614,23 @@ public:
} else {
if (!desc_tm) {
Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap defined for %s\n", SwigType_str(c_param_type, 0));
+ "No or improper directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p);
} else if (!jdesc) {
Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number,
- "Missing JNI descriptor in directorin typemap defined for %s\n", SwigType_str(c_param_type, 0));
+ "Missing JNI descriptor in directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(c_param_type, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = Getattr(p, "tmap:directorin:next");
} else if (!tm) {
Swig_warning(WARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF, input_file, line_number,
- "No or improper directorin typemap defined for argument %s\n", SwigType_str(pt, 0));
+ "No or improper directorin typemap defined for argument %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = nextSibling(p);
} else if (!cdesc) {
Swig_warning(WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC, input_file, line_number,
- "Missing JNI descriptor in directorin typemap defined for %s\n", SwigType_str(pt, 0));
+ "Missing JNI descriptor in directorin typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
p = Getattr(p, "tmap:directorin:next");
}
@@ -3630,7 +3639,8 @@ public:
Delete(tp);
} else {
- Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s\n", SwigType_str(pt, 0));
+ Swig_warning(WARN_JAVA_TYPEMAP_JNI_UNDEF, input_file, line_number, "No jni typemap defined for %s for use in %s::%s (skipping director method)\n",
+ SwigType_str(pt, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
p = nextSibling(p);
}
@@ -3742,8 +3752,8 @@ public:
Printf(w->code, "%s\n", tm);
} else {
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
- "Unable to use return type %s in director method %s::%s (skipping method).\n", SwigType_str(returntype, 0),
- SwigType_namestr(c_classname), SwigType_namestr(name));
+ "Unable to use return type %s used in %s::%s (skipping director method)\n",
+ SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
output_director = false;
}
From 75198b86bf430b4f5a75bfe6189f41ed1af34e06 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 25 Jun 2009 06:05:06 +0000
Subject: [PATCH 014/352] update email address for Joseph Wang
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11317 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
README | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README b/README
index 3df9e506a..179b3ff56 100644
--- a/README
+++ b/README
@@ -20,7 +20,7 @@ Active Developers:
Olly Betts (olly@survex.com) (PHP)
John Lenz (Guile, MzScheme updates, Chicken module, runtime system)
Mark Gossage (mark@gossage.cjb.net) (Lua)
- Joseph Wang (joe@gnacademy.org) (R)
+ Joseph Wang (joequant@gmail.com) (R)
Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL)
Xavier Delacour (xavier.delacour@gmail.com) (Octave)
From 45611ebd57b4ada25dfe25f064393b32ea77c48c Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Fri, 26 Jun 2009 01:49:33 +0000
Subject: [PATCH 015/352] [Ruby] Fix to handle FIXNUM values greater than
MAXINT passed for a double parameter.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11320 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 4 ++++
Examples/test-suite/ruby/primitive_types_runme.rb | 3 +++
Lib/ruby/rubyprimtypes.swg | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index d5b0062be..609e04010 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,10 @@
Version 1.3.40 (in progress)
============================
+2009-06-26: olly
+ [Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
+ double parameter.
+
2009-06-24: wsfulton
Fix wrapping methods with default arguments and the compactdefaultargs feature
where a class is passed by value and is assigned a default value. The SwigValueWrapper
diff --git a/Examples/test-suite/ruby/primitive_types_runme.rb b/Examples/test-suite/ruby/primitive_types_runme.rb
index 9fde5b3dd..0024c9696 100644
--- a/Examples/test-suite/ruby/primitive_types_runme.rb
+++ b/Examples/test-suite/ruby/primitive_types_runme.rb
@@ -50,6 +50,9 @@ end
raise RuntimeError if fail != 1
+# Test a number which won't fit in a 32 bit integer and is represented
+# as a FIXNUM by Ruby.
+raise RuntimeError if val_double(51767811298) != 51767811298
raise RuntimeError if val_double_2(1.0) != 4.0
raise RuntimeError if val_double_2(1) != 4
diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg
index c2d577995..9e6c361ad 100644
--- a/Lib/ruby/rubyprimtypes.swg
+++ b/Lib/ruby/rubyprimtypes.swg
@@ -197,7 +197,7 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
}
%fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") {
-%ruby_aux_method(double, NUM2DBL, (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj))))
+%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj))
SWIGINTERN int
SWIG_AsVal_dec(double)(VALUE obj, double *val)
From db8d65240734286f0b0065a76abecb9a7dab3881 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Fri, 26 Jun 2009 23:11:27 +0000
Subject: [PATCH 016/352] remove junk from Octave C example compilation command
line options
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11324 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/Makefile.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index d6dbfdeeb..8fab7a25d 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -335,12 +335,13 @@ OCTAVE_SO = @OCTAVE_SO@
# ----------------------------------------------------------------
# Build a C dynamically loadable module
+# Note: Octave requires C++ compiler when compiling C wrappers
# ----------------------------------------------------------------
octave: $(SRCS)
$(SWIG) -octave $(SWIGOPT) $(INTERFACEPATH)
- $(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(CXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
- $(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES) $(OCTAVE_INCLUDE)
+ $(CXX) -g -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(INCLUDES) -I$(OCTAVE_INCLUDE)
+ $(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# -----------------------------------------------------------------
From 4e1763ba69b3e3b43ec09f99104e0f9a0a99b62e Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Tue, 30 Jun 2009 11:50:14 +0000
Subject: [PATCH 017/352] [Ruby] Undefine close and connect macros defined by
Ruby API headers as we don't need them and they can clash with C++ methods
being wrapped. Patch from Vit Ondruch in SF#2814430.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11333 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 7 ++++++-
Lib/ruby/rubyhead.swg | 6 ++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index 609e04010..730cefc04 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,11 @@
Version 1.3.40 (in progress)
============================
+2009-06-30: olly
+ [Ruby] Undefine close and connect macros defined by Ruby API
+ headers as we don't need them and they can clash with C++ methods
+ being wrapped. Patch from Vit Ondruch in SF#2814430.
+
2009-06-26: olly
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
double parameter.
@@ -17,7 +22,7 @@ Version 1.3.40 (in progress)
2009-06-02: talby
[Perl] Resolved reference.i overload support problem
- identfied by John Potowsky.
+ identified by John Potowsky.
2009-05-26: wsfulton
[C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy
diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg
index d17fdbaae..4b425dfd8 100644
--- a/Lib/ruby/rubyhead.swg
+++ b/Lib/ruby/rubyhead.swg
@@ -10,6 +10,12 @@
#ifdef bind
# undef bind
#endif
+#ifdef close
+# undef close
+#endif
+#ifdef connect
+# undef connect
+#endif
/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
From 3c39833584964091c6611c2fcd29ab88cd2360e2 Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Tue, 30 Jun 2009 12:24:49 +0000
Subject: [PATCH 018/352] Use -O2 in the GCC examples as GCC defaults to not
optimising at all.
Document using GCC's -fPIC option as the standard approach - x86 is the oddity
here and most architectures require it (or are always PIC), and on x86 it's
better to use it or else code pages from the library need relocations and can't
be shared.
Use "python2.5" rather than "python2.0" in paths in example commands.
Fix a typo.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11334 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/Python.html | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index cfc035f00..8b359bda9 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -339,7 +339,7 @@ python that you run the command with. Taking apart the command line:
setup.py is the tradition)
- build_ext -- telling distutils to build extensions
- --inplace -- this tells distutils to put the extension lib in the current dir.
- Other wise, it will put it inside a build hierarchy, and you'd have to move it to use it.
+ Otherwise, it will put it inside a build hierarchy, and you'd have to move it to use it.
@@ -363,8 +363,8 @@ program using commands like this (shown for Linux):
$ swig -python example.i
-$ gcc -c -fPIC example.c
-$ gcc -c -fPIC example_wrap.c -I/usr/local/include/python2.0
+$ gcc -O2 -fPIC -c example.c
+$ gcc -O2 -fPIC -c example_wrap.c -I/usr/local/include/python2.5
$ gcc -shared example.o example_wrap.o -o _example.so
@@ -654,26 +654,19 @@ compiler. For example:
$ swig -c++ -python example.i
-$ g++ -c example.cxx
-$ g++ -c example_wrap.cxx -I/usr/local/include/python2.0
+$ g++ -O2 -fPIC -c example.cxx
+$ g++ -O2 -fPIC -c example_wrap.cxx -I/usr/local/include/python2.5
$ g++ -shared example.o example_wrap.o -o _example.so
-On some platforms, you could also need to generate
-position-independent code (PIC), by using a compiler option such as -fPIC.
-Notably, the x86_64 (Opteron and EM64T) platform requires it, and when
-using the GNU Compiler Suite, you will need to modify the previous example
-as follows:
+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.
-
-$ swig -c++ -python example.i
-$ g++ -fPIC -c example.cxx
-$ g++ -fPIC -c example_wrap.cxx -I/usr/local/include/python2.0
-$ g++ -shared example.o example_wrap.o -o _example.so
-
-
In addition to this, you may need to include additional library
files to make it work. For example, if you are using the Sun C++ compiler on
@@ -683,7 +676,7 @@ Solaris, you often need to add an extra library -lCrun like this:
$ swig -c++ -python example.i
$ CC -c example.cxx
-$ CC -c example_wrap.cxx -I/usr/local/include/python2.0
+$ CC -c example_wrap.cxx -I/usr/local/include/python2.5
$ CC -G example.o example_wrap.o -L/opt/SUNWspro/lib -o _example.so -lCrun
From 06346ca98b2f8b3bcaf74c24eff1476549762bc5 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 06:37:43 +0000
Subject: [PATCH 019/352] Update a few APIs which have changed over time
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11341 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Doc/Manual/Extending.html | 59 ++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 26 deletions(-)
diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html
index 73f1a6673..0ebaeaa04 100644
--- a/Doc/Manual/Extending.html
+++ b/Doc/Manual/Extending.html
@@ -1025,7 +1025,7 @@ Deletes s.
-int Len(String_or_char *s)
+int Len(const String_or_char *s)
@@ -1033,7 +1033,7 @@ Returns the length of the string.
-char *Char(String_or_char *s)
+char *Char(const String_or_char *s)
@@ -1041,7 +1041,7 @@ Returns a pointer to the first character in a string.
-void Append(String *s, String_or_char *t)
+void Append(String *s, const String_or_char *t)
@@ -1049,7 +1049,7 @@ Appends t to the end of string s.
-void Insert(String *s, int pos, String_or_char *t)
+void Insert(String *s, int pos, const String_or_char *t)
@@ -1162,7 +1162,7 @@ Returns the number of items in h.
-Object *Getattr(Hash *h, String_or_char *key)
+Object *Getattr(Hash *h, const String_or_char *key)
@@ -1171,7 +1171,7 @@ a simple char * string. Returns NULL if not found.
-int Setattr(Hash *h, String_or_char *key, Object_or_char *val)
+int Setattr(Hash *h, const String_or_char *key, const Object_or_char *val)
@@ -1185,7 +1185,7 @@ of val. Returns 1 if this operation replaced an existing hash entry,
-int Delattr(Hash *h, String_or_char *key)
+int Delattr(Hash *h, const String_or_char *key)
@@ -1249,7 +1249,7 @@ negative, the first item is returned.
-int *Setitem(List *x, int n, Object_or_char *val)
+int *Setitem(List *x, int n, const Object_or_char *val)
@@ -1271,7 +1271,7 @@ for n.
-void Append(List *x, Object_or_char *t)
+void Append(List *x, const Object_or_char *t)
@@ -1281,7 +1281,7 @@ used to create a String object.
-void Insert(String *s, int pos, Object_or_char *t)
+void Insert(String *s, int pos, const Object_or_char *t)
@@ -1479,13 +1479,14 @@ Same as the C tell() function.
-File *NewFile(const char *filename, const char *mode)
+File *NewFile(const char *filename, const char *mode, List *newfiles)
Create a File object using the fopen() library call. This
file differs from FILE * in that it can be placed in the standard
-SWIG containers (lists, hashes, etc.).
+SWIG containers (lists, hashes, etc.). The filename is added to the
+newfiles list if newfiles is non-zero and the file was created successfully.
@@ -1922,7 +1923,7 @@ Adds a reference to ty.
-void SwigType_add_array(SwigType *ty, String_or_char *dim)
+void SwigType_add_array(SwigType *ty, const String_or_char *size)
@@ -1962,7 +1963,7 @@ Sets nth array dimensions of ty to rep.
-void SwigType_add_qualifier(SwigType *ty, String_or_char *q)
+void SwigType_add_qualifier(SwigType *ty, const String_or_char *q)
@@ -1971,7 +1972,7 @@ Adds a type qualifier q to ty. q is typically
-void SwigType_add_memberpointer(SwigType *ty, String_or_char *cls)
+void SwigType_add_memberpointer(SwigType *ty, const String_or_char *cls)
@@ -2292,7 +2293,7 @@ The following functions produce strings that are suitable for output.
-String *SwigType_str(SwigType *ty, String_or_char *id = 0)
+String *SwigType_str(SwigType *ty, const String_or_char *id = 0)
@@ -2303,7 +2304,7 @@ used to convert string-encoded types back into a form that is valid C syntax.
-String *SwigType_lstr(SwigType *ty, String_or_char *id = 0)
+String *SwigType_lstr(SwigType *ty, const String_or_char *id = 0)
@@ -2312,7 +2313,7 @@ is generated from the type's lvalue (as generated from SwigType_ltype).
-String *SwigType_lcaststr(SwigType *ty, String_or_char *id = 0)
+String *SwigType_lcaststr(SwigType *ty, const String_or_char *id = 0)
@@ -2323,7 +2324,7 @@ this function produces the string "(char *) foo".
-String *SwigType_rcaststr(SwigType *ty, String_or_char *id = 0)
+String *SwigType_rcaststr(SwigType *ty, const String_or_char *id = 0)
@@ -2776,6 +2777,7 @@ such as:
class PYTHON : public Language {
protected:
/* General DOH objects used for holding the strings */
+ File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
@@ -2791,22 +2793,25 @@ int Python::top(Node *n) {
...
/* Initialize I/O */
- f_runtime = NewFile(outfile, "w");
- if (!f_runtime) {
+ f_begin = NewFile(outfile, "w", SWIG_output_files());
+ if (!f_begin) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
+ f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
/* Register file targets with the SWIG file handler */
+ Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
/* Output module initialization code */
+ Swig_banner(f_begin);
...
/* Emit code for children */
@@ -2814,16 +2819,18 @@ int Python::top(Node *n) {
...
/* Write all to the file */
- Dump(f_header, f_runtime);
- Dump(f_wrappers, f_runtime);
- Wrapper_pretty_print(f_init, f_runtime);
+ Dump(f_runtime, f_begin);
+ Dump(f_header, f_begin);
+ Dump(f_wrappers, f_begin);
+ Wrapper_pretty_print(f_init, f_begin);
/* Cleanup files */
+ Delete(f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
- Close(f_runtime);
- Delete(f_runtime);
+ Close(f_begin);
+ Delete(f_begin);
return SWIG_OK;
}
From 3dbca3bd05c779ec9d46f2141142d6be07468af8 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 18:25:04 +0000
Subject: [PATCH 020/352] Fix syntax error when a nested struct contains a
comment containing a * followed eventually by a /
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11344 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 4 ++++
Examples/test-suite/nested_comment.i | 2 +-
Source/CParse/parser.y | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index 730cefc04..de8203538 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,10 @@
Version 1.3.40 (in progress)
============================
+2009-07-02: wsfulton
+ Fix syntax error when a nested struct contains a comment containing a * followed eventually by a /.
+ Regression from 1.3.37, reported by Solomon Gibbs.
+
2009-06-30: olly
[Ruby] Undefine close and connect macros defined by Ruby API
headers as we don't need them and they can clash with C++ methods
diff --git a/Examples/test-suite/nested_comment.i b/Examples/test-suite/nested_comment.i
index ea365a6fe..a9948eb0f 100644
--- a/Examples/test-suite/nested_comment.i
+++ b/Examples/test-suite/nested_comment.i
@@ -27,7 +27,7 @@ struct a
struct {
/*struct*/
struct {
- int b;
+ int b; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
} c;
} d;
};
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 0babfbbb8..11232fd78 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -1054,6 +1054,8 @@ static void strip_comments(char *string) {
case 5:
if (*c == '/')
state = 0;
+ else
+ state = 1;
*c = ' ';
break;
case 6:
From 481fead9fc1ad89d679f6ffc4d4ffce9f1729f29 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 18:28:50 +0000
Subject: [PATCH 021/352] Fix -Wallkw commandline option
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11345 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 3 +++
Lib/allkw.swg | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index de8203538..8661489a0 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,9 @@
Version 1.3.40 (in progress)
============================
+2009-07-02: wsfulton
+ Fix -Wallkw option as reported by Solomon Gibbs.
+
2009-07-02: wsfulton
Fix syntax error when a nested struct contains a comment containing a * followed eventually by a /.
Regression from 1.3.37, reported by Solomon Gibbs.
diff --git a/Lib/allkw.swg b/Lib/allkw.swg
index 2a2fe18d8..fb76ff287 100644
--- a/Lib/allkw.swg
+++ b/Lib/allkw.swg
@@ -19,7 +19,7 @@
%include
%include
%include
-%include
+%include
%include
%include
%include
From 7db0c01af04a5b2bf6a92c2425feede2293f161f Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 20:32:51 +0000
Subject: [PATCH 022/352] rename byreference testcase to li_reference to follow
normal test naming conventions of library files. Remove ability to add
testcases into subdirectories (again) - not wanted
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11346 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 2 +-
.../{perl5/byreference.i => li_reference.i} | 2 +-
Examples/test-suite/perl5/Makefile.in | 2 +-
.../test-suite/perl5/byreference_runme.pl | 36 -------------------
.../test-suite/perl5/li_reference_runme.pl | 36 +++++++++++++++++++
5 files changed, 39 insertions(+), 39 deletions(-)
rename Examples/test-suite/{perl5/byreference.i => li_reference.i} (99%)
delete mode 100644 Examples/test-suite/perl5/byreference_runme.pl
create mode 100644 Examples/test-suite/perl5/li_reference_runme.pl
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 753c5fbdf..5c6a332a4 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -64,7 +64,7 @@ INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
LIBS = -L.
LIBPREFIX = lib
ACTION = check
-INTERFACEDIR = $(if $(wildcard $*.i), ./, ../)
+INTERFACEDIR = ../
#
# Please keep test cases in alphabetical order.
diff --git a/Examples/test-suite/perl5/byreference.i b/Examples/test-suite/li_reference.i
similarity index 99%
rename from Examples/test-suite/perl5/byreference.i
rename to Examples/test-suite/li_reference.i
index 43215f1cc..d021e807f 100644
--- a/Examples/test-suite/perl5/byreference.i
+++ b/Examples/test-suite/li_reference.i
@@ -1,4 +1,4 @@
-%module byreference
+%module li_reference
%include "reference.i"
diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in
index 518d341b2..97079fa75 100644
--- a/Examples/test-suite/perl5/Makefile.in
+++ b/Examples/test-suite/perl5/Makefile.in
@@ -15,7 +15,7 @@ CPP_TEST_CASES += \
li_cdata \
li_cstring \
li_cdata_carrays \
- byreference \
+ li_reference \
C_TEST_CASES += \
li_cdata \
diff --git a/Examples/test-suite/perl5/byreference_runme.pl b/Examples/test-suite/perl5/byreference_runme.pl
deleted file mode 100644
index 845d870cd..000000000
--- a/Examples/test-suite/perl5/byreference_runme.pl
+++ /dev/null
@@ -1,36 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 68;
-BEGIN { use_ok('byreference') }
-require_ok('byreference');
-
-sub chk { my($type, $call, $v1, $v2) = @_;
- $byreference::FrVal = $v1;
- my $v = $v2;
- eval { $call->(\$v) };
- is($@, '', "$type check");
- is($byreference::ToVal, $v2, "$type out");
- is($v, $v1, "$type in");
-}
-chk("double*", \&byreference::PDouble, 12.2, 18.6);
-chk("double&", \&byreference::RDouble, 32.5, 64.8);
-chk("float*", \&byreference::PFloat, 64.5, 96.0);
-chk("float&", \&byreference::RFloat, 98.5, 6.25);
-chk("int*", \&byreference::PInt, 1887, 3356);
-chk("int&", \&byreference::RInt, 2622, 9867);
-chk("short*", \&byreference::PShort, 4752, 3254);
-chk("short&", \&byreference::RShort, 1898, 5757);
-chk("long*", \&byreference::PLong, 6687, 7132);
-chk("long&", \&byreference::RLong, 8346, 4398);
-chk("uint*", \&byreference::PUInt, 6853, 5529);
-chk("uint&", \&byreference::RUInt, 5483, 7135);
-chk("ushort*", \&byreference::PUShort, 9960, 9930);
-chk("ushort&", \&byreference::RUShort, 1193, 4178);
-chk("ulong*", \&byreference::PULong, 7960, 4788);
-chk("ulong&", \&byreference::RULong, 8829, 1603);
-chk("uchar*", \&byreference::PUChar, 110, 239);
-chk("uchar&", \&byreference::RUChar, 15, 97);
-chk("char*", \&byreference::PChar, -7, 118);
-chk("char&", \&byreference::RChar, -3, -107);
-chk("bool*", \&byreference::PBool, 0, 1);
-chk("bool&", \&byreference::RBool, 1, 0);
diff --git a/Examples/test-suite/perl5/li_reference_runme.pl b/Examples/test-suite/perl5/li_reference_runme.pl
new file mode 100644
index 000000000..afbd9e088
--- /dev/null
+++ b/Examples/test-suite/perl5/li_reference_runme.pl
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+use Test::More tests => 68;
+BEGIN { use_ok('li_reference') }
+require_ok('li_reference');
+
+sub chk { my($type, $call, $v1, $v2) = @_;
+ $li_reference::FrVal = $v1;
+ my $v = $v2;
+ eval { $call->(\$v) };
+ is($@, '', "$type check");
+ is($li_reference::ToVal, $v2, "$type out");
+ is($v, $v1, "$type in");
+}
+chk("double*", \&li_reference::PDouble, 12.2, 18.6);
+chk("double&", \&li_reference::RDouble, 32.5, 64.8);
+chk("float*", \&li_reference::PFloat, 64.5, 96.0);
+chk("float&", \&li_reference::RFloat, 98.5, 6.25);
+chk("int*", \&li_reference::PInt, 1887, 3356);
+chk("int&", \&li_reference::RInt, 2622, 9867);
+chk("short*", \&li_reference::PShort, 4752, 3254);
+chk("short&", \&li_reference::RShort, 1898, 5757);
+chk("long*", \&li_reference::PLong, 6687, 7132);
+chk("long&", \&li_reference::RLong, 8346, 4398);
+chk("uint*", \&li_reference::PUInt, 6853, 5529);
+chk("uint&", \&li_reference::RUInt, 5483, 7135);
+chk("ushort*", \&li_reference::PUShort, 9960, 9930);
+chk("ushort&", \&li_reference::RUShort, 1193, 4178);
+chk("ulong*", \&li_reference::PULong, 7960, 4788);
+chk("ulong&", \&li_reference::RULong, 8829, 1603);
+chk("uchar*", \&li_reference::PUChar, 110, 239);
+chk("uchar&", \&li_reference::RUChar, 15, 97);
+chk("char*", \&li_reference::PChar, -7, 118);
+chk("char&", \&li_reference::RChar, -3, -107);
+chk("bool*", \&li_reference::PBool, 0, 1);
+chk("bool&", \&li_reference::RBool, 1, 0);
From 134610e55dadf3f9b4789e39caea4d61f9b6ddde Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 21:35:41 +0000
Subject: [PATCH 023/352] Add a test for the -Wallkw commandline option. Also
refine general framework for using custom commandline options for individual
test cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11347 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 19 +++++++++++---
Examples/test-suite/csharp/Makefile.in | 6 ++---
.../test-suite/java/custom_wallkw_runme.java | 25 +++++++++++++++++++
3 files changed, 43 insertions(+), 7 deletions(-)
create mode 100644 Examples/test-suite/java/custom_wallkw_runme.java
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 5c6a332a4..9b54765ef 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -60,6 +60,7 @@ CSRCS =
TARGETPREFIX =
TARGETSUFFIX =
SWIGOPT = -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
+SWIGOPTCUSTOM =
INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
LIBS = -L.
LIBPREFIX = lib
@@ -468,6 +469,16 @@ MULTI_CPP_TEST_CASES += \
template_typedef_import \
multi_import
+# Non standard testcases, usually using custom commandline options
+# Testcase names are prefixed with custom_ and can be run individually using make testcase.customtest
+CUSTOM_TEST_CASES = \
+ custom_allkw \
+
+# individual custom tests - any kind of customisation allowed here
+# Note: $(basename $@) strips everything after and including the . in the target name
+custom_wallkw.customtest:
+ $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-Wallkw"
+
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
$(C_TEST_CASES:=.ctest) \
$(MULTI_CPP_TEST_CASES:=.multicpptest) \
@@ -500,14 +511,14 @@ broken: $(BROKEN_TEST_CASES)
swig_and_compile_cpp = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)_cpp
swig_and_compile_c = \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)
@@ -515,7 +526,7 @@ swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \
TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
@@ -527,7 +538,7 @@ swig_and_compile_external = \
$(LANGUAGE)$(VARIANT)_externalhdr; \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \
SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
+ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT) $(SWIGOPTCUSTOM)" NOLINK=true \
TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
$(LANGUAGE)$(VARIANT)_cpp
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 5fb547f3f..df5f1a7fd 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -28,7 +28,7 @@ CUSTOM_TEST_CASES = \
include $(srcdir)/../common.mk
# Overridden variables here
-SWIGOPT += -namespace $*Namespace $(SWIGOPTSPECIAL)
+SWIGOPT += -namespace $*Namespace
INTERFACEDIR = ../../
CSHARPFLAGSSPECIAL =
@@ -51,9 +51,9 @@ CSHARPFLAGSSPECIAL =
# Rules for custom tests
intermediary_classname.customtest:
- $(MAKE) intermediary_classname.cpptest SWIGOPTSPECIAL="-dllimport intermediary_classname"
+ $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport intermediary_classname"
csharp_lib_arrays.customtest:
- $(MAKE) csharp_lib_arrays.cpptest CSHARPFLAGSSPECIAL="-unsafe"
+ $(MAKE) $(basename $@).cpptest CSHARPFLAGSSPECIAL="-unsafe"
# Makes a directory for the testcase if it does not exist
setup = \
diff --git a/Examples/test-suite/java/custom_wallkw_runme.java b/Examples/test-suite/java/custom_wallkw_runme.java
new file mode 100644
index 000000000..08d9539bd
--- /dev/null
+++ b/Examples/test-suite/java/custom_wallkw_runme.java
@@ -0,0 +1,25 @@
+
+import custom_wallkw.*;
+
+public class custom_wallkw_runme {
+
+ static {
+ try {
+ System.loadLibrary("custom_wallkw");
+ } 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[]) {
+ if (!custom_wallkw.c_clone().equals("clone"))
+ throw new RuntimeException("clone_c keyword fail");
+ if (!custom_wallkw._delegate().equals("delegate"))
+ throw new RuntimeException("delegate keyword fail");
+ if (!custom_wallkw._pass().equals("pass"))
+ throw new RuntimeException("pass keyword fail");
+ if (!custom_wallkw.C_alias().equals("alias"))
+ throw new RuntimeException("alias keyword fail");
+ }
+}
From 1adaae5780b5e3c264870f2977808f129d9ec605 Mon Sep 17 00:00:00 2001
From: William S Fulton
Date: Thu, 2 Jul 2009 21:59:29 +0000
Subject: [PATCH 024/352] rename custom testcases with a custom_ prefix
(intermediary_classname.i and lib_arrays.i). Also some typo fixes for custom
testcases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11348 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 7 ++++---
Examples/test-suite/csharp/Makefile.in | 10 +++++-----
...ys_runme.cs => custom_csharp_lib_arrays_runme.cs} | 10 +++++-----
...nme.cs => custom_intermediary_classname_runme.cs} | 10 +++++-----
...sharp_lib_arrays.i => custom_csharp_lib_arrays.i} | 2 +-
...y_classname.i => custom_intermediary_classname.i} | 2 +-
Examples/test-suite/java/Makefile.in | 2 +-
...java => custom_intermediary_classname_runme.java} | 12 ++++++------
8 files changed, 28 insertions(+), 27 deletions(-)
rename Examples/test-suite/csharp/{csharp_lib_arrays_runme.cs => custom_csharp_lib_arrays_runme.cs} (77%)
rename Examples/test-suite/csharp/{intermediary_classname_runme.cs => custom_intermediary_classname_runme.cs} (60%)
rename Examples/test-suite/{csharp_lib_arrays.i => custom_csharp_lib_arrays.i} (97%)
rename Examples/test-suite/{intermediary_classname.i => custom_intermediary_classname.i} (94%)
rename Examples/test-suite/java/{intermediary_classname_runme.java => custom_intermediary_classname_runme.java} (58%)
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 9b54765ef..744ffc1c3 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -9,7 +9,8 @@
# then builds the object code for use by the language.
# To complete a test in a language follow these guidelines:
# 1) Add testcases to CPP_TEST_CASES (c++) or C_TEST_CASES (c) or
-# MULTI_CPP_TEST_CASES (multi-module c++ tests)
+# MULTI_CPP_TEST_CASES (multi-module c++ tests) or
+# CUSTOM_TEST_CASES (mainly for customised SWIG comandline options)
# 2) If not already done, create a makefile which:
# a) Defines LANGUAGE matching a language rule in Examples/Makefile,
# for example LANGUAGE = java
@@ -471,8 +472,8 @@ MULTI_CPP_TEST_CASES += \
# Non standard testcases, usually using custom commandline options
# Testcase names are prefixed with custom_ and can be run individually using make testcase.customtest
-CUSTOM_TEST_CASES = \
- custom_allkw \
+CUSTOM_TEST_CASES += \
+ custom_wallkw \
# individual custom tests - any kind of customisation allowed here
# Note: $(basename $@) strips everything after and including the . in the target name
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index df5f1a7fd..0c5ff5520 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -22,8 +22,8 @@ CPP_TEST_CASES = \
exception_partial_info
CUSTOM_TEST_CASES = \
- csharp_lib_arrays \
- intermediary_classname
+ custom_csharp_lib_arrays \
+ custom_intermediary_classname
include $(srcdir)/../common.mk
@@ -50,9 +50,9 @@ CSHARPFLAGSSPECIAL =
+$(run_testcase)
# Rules for custom tests
-intermediary_classname.customtest:
- $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport intermediary_classname"
-csharp_lib_arrays.customtest:
+custom_intermediary_classname.customtest:
+ $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport custom_intermediary_classname"
+custom_csharp_lib_arrays.customtest:
$(MAKE) $(basename $@).cpptest CSHARPFLAGSSPECIAL="-unsafe"
# Makes a directory for the testcase if it does not exist
diff --git a/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs b/Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs
similarity index 77%
rename from Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
rename to Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs
index 9f3ea6b88..aa0cd0ede 100644
--- a/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
+++ b/Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs
@@ -1,5 +1,5 @@
using System;
-using csharp_lib_arraysNamespace;
+using custom_csharp_lib_arraysNamespace;
public class runme
{
@@ -9,7 +9,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[ source.Length ];
- csharp_lib_arrays.myArrayCopy( source, target, target.Length );
+ custom_csharp_lib_arrays.myArrayCopy( source, target, target.Length );
CompareArrays(source, target);
}
@@ -17,7 +17,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[ source.Length ];
- csharp_lib_arrays.myArrayCopyUsingFixedArrays( source, target, target.Length );
+ custom_csharp_lib_arrays.myArrayCopyUsingFixedArrays( source, target, target.Length );
CompareArrays(source, target);
}
@@ -25,7 +25,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[] { 6, 7, 8, 9, 10 };
- csharp_lib_arrays.myArraySwap( source, target, target.Length );
+ custom_csharp_lib_arrays.myArraySwap( source, target, target.Length );
for (int i=0; i
Date: Thu, 2 Jul 2009 22:40:49 +0000
Subject: [PATCH 025/352] reverse merge last commit - 11348
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11349 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 7 +++----
Examples/test-suite/csharp/Makefile.in | 10 +++++-----
...ib_arrays_runme.cs => csharp_lib_arrays_runme.cs} | 10 +++++-----
...name_runme.cs => intermediary_classname_runme.cs} | 10 +++++-----
...ustom_csharp_lib_arrays.i => csharp_lib_arrays.i} | 2 +-
...rmediary_classname.i => intermediary_classname.i} | 2 +-
Examples/test-suite/java/Makefile.in | 2 +-
..._runme.java => intermediary_classname_runme.java} | 12 ++++++------
8 files changed, 27 insertions(+), 28 deletions(-)
rename Examples/test-suite/csharp/{custom_csharp_lib_arrays_runme.cs => csharp_lib_arrays_runme.cs} (77%)
rename Examples/test-suite/csharp/{custom_intermediary_classname_runme.cs => intermediary_classname_runme.cs} (60%)
rename Examples/test-suite/{custom_csharp_lib_arrays.i => csharp_lib_arrays.i} (97%)
rename Examples/test-suite/{custom_intermediary_classname.i => intermediary_classname.i} (94%)
rename Examples/test-suite/java/{custom_intermediary_classname_runme.java => intermediary_classname_runme.java} (58%)
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 744ffc1c3..9b54765ef 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -9,8 +9,7 @@
# then builds the object code for use by the language.
# To complete a test in a language follow these guidelines:
# 1) Add testcases to CPP_TEST_CASES (c++) or C_TEST_CASES (c) or
-# MULTI_CPP_TEST_CASES (multi-module c++ tests) or
-# CUSTOM_TEST_CASES (mainly for customised SWIG comandline options)
+# MULTI_CPP_TEST_CASES (multi-module c++ tests)
# 2) If not already done, create a makefile which:
# a) Defines LANGUAGE matching a language rule in Examples/Makefile,
# for example LANGUAGE = java
@@ -472,8 +471,8 @@ MULTI_CPP_TEST_CASES += \
# Non standard testcases, usually using custom commandline options
# Testcase names are prefixed with custom_ and can be run individually using make testcase.customtest
-CUSTOM_TEST_CASES += \
- custom_wallkw \
+CUSTOM_TEST_CASES = \
+ custom_allkw \
# individual custom tests - any kind of customisation allowed here
# Note: $(basename $@) strips everything after and including the . in the target name
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 0c5ff5520..df5f1a7fd 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -22,8 +22,8 @@ CPP_TEST_CASES = \
exception_partial_info
CUSTOM_TEST_CASES = \
- custom_csharp_lib_arrays \
- custom_intermediary_classname
+ csharp_lib_arrays \
+ intermediary_classname
include $(srcdir)/../common.mk
@@ -50,9 +50,9 @@ CSHARPFLAGSSPECIAL =
+$(run_testcase)
# Rules for custom tests
-custom_intermediary_classname.customtest:
- $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport custom_intermediary_classname"
-custom_csharp_lib_arrays.customtest:
+intermediary_classname.customtest:
+ $(MAKE) $(basename $@).cpptest SWIGOPTCUSTOM="-dllimport intermediary_classname"
+csharp_lib_arrays.customtest:
$(MAKE) $(basename $@).cpptest CSHARPFLAGSSPECIAL="-unsafe"
# Makes a directory for the testcase if it does not exist
diff --git a/Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs b/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
similarity index 77%
rename from Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs
rename to Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
index aa0cd0ede..9f3ea6b88 100644
--- a/Examples/test-suite/csharp/custom_csharp_lib_arrays_runme.cs
+++ b/Examples/test-suite/csharp/csharp_lib_arrays_runme.cs
@@ -1,5 +1,5 @@
using System;
-using custom_csharp_lib_arraysNamespace;
+using csharp_lib_arraysNamespace;
public class runme
{
@@ -9,7 +9,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[ source.Length ];
- custom_csharp_lib_arrays.myArrayCopy( source, target, target.Length );
+ csharp_lib_arrays.myArrayCopy( source, target, target.Length );
CompareArrays(source, target);
}
@@ -17,7 +17,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[ source.Length ];
- custom_csharp_lib_arrays.myArrayCopyUsingFixedArrays( source, target, target.Length );
+ csharp_lib_arrays.myArrayCopyUsingFixedArrays( source, target, target.Length );
CompareArrays(source, target);
}
@@ -25,7 +25,7 @@ public class runme
int[] source = { 1, 2, 3, 4, 5 };
int[] target = new int[] { 6, 7, 8, 9, 10 };
- custom_csharp_lib_arrays.myArraySwap( source, target, target.Length );
+ csharp_lib_arrays.myArraySwap( source, target, target.Length );
for (int i=0; i
Date: Thu, 2 Jul 2009 22:42:45 +0000
Subject: [PATCH 026/352] fix typo in custom_wallkw testcase name
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11350 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Examples/test-suite/common.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 9b54765ef..f60da6cc6 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -472,7 +472,7 @@ MULTI_CPP_TEST_CASES += \
# Non standard testcases, usually using custom commandline options
# Testcase names are prefixed with custom_ and can be run individually using make testcase.customtest
CUSTOM_TEST_CASES = \
- custom_allkw \
+ custom_wallkw \
# individual custom tests - any kind of customisation allowed here
# Note: $(basename $@) strips everything after and including the . in the target name
From 734dafd405a337d0ed7e134ccef1037732d61ad5 Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Fri, 3 Jul 2009 11:58:37 +0000
Subject: [PATCH 027/352] Fix grammar in comment and error message.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11352 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
Lib/python/std_map.i | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i
index c93ffe61b..efe0e5e4c 100644
--- a/Lib/python/std_map.i
+++ b/Lib/python/std_map.i
@@ -23,8 +23,8 @@
if (PyDict_Check(obj)) {
SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL);
%#if PY_VERSION_HEX >= 0x03000000
- /* In Python 3.x the ".items()" method return a dict_items object */
- items = PySequence_Fast(items, ".items() havn't returned a sequence!");
+ /* In Python 3.x the ".items()" method returns a dict_items object */
+ items = PySequence_Fast(items, ".items() didn't return a sequence!");
%#endif
res = traits_asptr_stdseq, std::pair >::asptr(items, val);
} else {
From 7f5586a370cd4a80a9990b4642f446023d31e2fe Mon Sep 17 00:00:00 2001
From: Olly Betts
Date: Fri, 3 Jul 2009 14:17:03 +0000
Subject: [PATCH 028/352] [Tcl] To complement USE_TCL_STUBS, add support for
USE_TK_STUBS and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl
chapter of the manual. Based on patch from SF#2810380 by Christian
Gollwitzer.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11353 626c5289-ae23-0410-ae9c-e8d60b6d4f22
---
CHANGES.current | 6 ++++++
Doc/Manual/Tcl.html | 22 ++++++++++++++++++++++
Lib/tcl/tclinit.swg | 15 ++++++++++++++-
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/CHANGES.current b/CHANGES.current
index 8661489a0..f6906e0a3 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,12 @@
Version 1.3.40 (in progress)
============================
+2009-07-03: olly
+ [Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS
+ and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter
+ of the manual. Based on patch from SF#2810380 by Christian
+ Gollwitzer.
+
2009-07-02: wsfulton
Fix -Wallkw option as reported by Solomon Gibbs.
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index 04959de5f..2c02a9b34 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -66,6 +66,7 @@
+Tcl/Tk Stubs
@@ -3409,5 +3410,26 @@ short, but clever Tcl script can be combined with SWIG to do many
interesting things.
+
33.10 Tcl/Tk Stubs
+
+
+For background information about the Tcl Stubs feature, see
+http://www.tcl.tk/doc/howto/stubs.html.
+
+
+
+As of SWIG 1.3.10, the generated C/C++ wrapper will use the Tcl Stubs
+feature if compiled with -DUSE_TCL_STUBS.
+
+
+
+As of SWIG 1.3.40, the generated C/C++ wrapper will use the Tk Stubs
+feature if compiled with -DUSE_TK_STUBS. Also, you can override
+the minimum version to support which is passed to Tcl_InitStubs()
+and Tk_InitStubs() with -DSWIG_TCL_STUBS_VERSION="8.3"
+or the version being compiled with using
+-DSWIG_TCL_STUBS_VERSION=TCL_VERSION.
+
+