From 4e9ee78d3eace3f234a3fd5e08e410bb3ca092a5 Mon Sep 17 00:00:00 2001 From: Atri Date: Tue, 1 Oct 2013 01:28:26 +0530 Subject: [PATCH 01/18] Lua: Fix void return for non-void functions Commit #c3f3880d caused the functions SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns) and SWIGINTERN int SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns) to return void when int returns were expected resulting in the build failures for plplot's lua bindings for example. This commit fixes the issue. Closes #92 --- Lib/lua/luarun.swg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg index 4d851bdb1..8485ed499 100644 --- a/Lib/lua/luarun.swg +++ b/Lib/lua/luarun.swg @@ -524,7 +524,7 @@ SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* /* clear stack - remove metatble */ lua_pop(L,1); - + return 0; } /* helper function. creates namespace table and add it to module table */ @@ -555,6 +555,7 @@ SWIGINTERN int SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns) lua_setmetatable(L,-2); /* set metatable */ lua_rawset(L,-3); /* add namespace to module table */ + return 0; } /* ----------------------------------------------------------------------------- * global variable support code: classes From f0b60d0ec9fc46cdb17c1f84b2d42231a7313572 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Feb 2014 14:36:10 +0000 Subject: [PATCH 02/18] Bump version to 2.0.12 --- ANNOUNCE | 8 +-- CHANGES | 137 ++++++++++++++++++++++++++++++++++++++ CHANGES.current | 138 +-------------------------------------- Doc/Manual/Sections.html | 2 +- README | 2 +- configure.ac | 2 +- 6 files changed, 146 insertions(+), 143 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index caaa55d8c..06a24ccb7 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,8 +1,8 @@ -*** ANNOUNCE: SWIG 2.0.11 (15 Sep 2013) *** +*** ANNOUNCE: SWIG 2.0.12 (9 Feb 2014) *** http://www.swig.org -We're pleased to announce SWIG-2.0.11, the latest SWIG release. +We're pleased to announce SWIG-2.0.12, the latest SWIG release. What is SWIG? ============= @@ -21,11 +21,11 @@ Availability ============ The release is available for download on Sourceforge at - http://prdownloads.sourceforge.net/swig/swig-2.0.11.tar.gz + http://prdownloads.sourceforge.net/swig/swig-2.0.12.tar.gz A Windows version is also available at - http://prdownloads.sourceforge.net/swig/swigwin-2.0.11.zip + http://prdownloads.sourceforge.net/swig/swigwin-2.0.12.zip Please report problems with this release to the swig-devel mailing list, details at http://www.swig.org/mail.html. diff --git a/CHANGES b/CHANGES index 488bf7286..b40597e26 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,143 @@ SWIG (Simplified Wrapper and Interface Generator) See the CHANGES.current file for changes in the current version. See the RELEASENOTES file for a summary of changes in each release. +Version 2.0.11 (15 Sep 2013) +============================ + +2013-09-15: wsfulton + [R] Fix attempt to free a non-heap object in OUTPUT typemaps for: + unsigned short *OUTPUT + unsigned long *OUTPUT + signed long long *OUTPUT + char *OUTPUT + signed char*OUTPUT + unsigned char*OUTPUT + +2013-09-12: wsfulton + [Lua] Pull Git patch #62. + 1) Static members and static functions inside class can be accessed as + ModuleName.ClassName.FunctionName (MemberName respectively). Old way such as + ModuleName.ClassName_FunctionName still works. + 2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc. + +2013-09-12: wsfulton + [UTL] Infinity is now by default an acceptable value for type 'float'. This fix makes + the handling of type 'float' and 'double' the same. The implementation requires the + C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available. + + Users requiring the old behaviour of not accepting infinity, can define a 'check' typemap + wherever a float is used, such as: + + %typemap(check,fragment="") float, const float & %{ + if ($1 < -FLT_MAX || $1 > FLT_MAX) { + SWIG_exception_fail(SWIG_TypeError, "Overflow in type float"); + } + %} + + *** POTENTIAL INCOMPATIBILITY *** + +2013-08-30: wsfulton + [Lua] Pull Git patch #81: Include Lua error locus in SWIG error messages. + This is standard information in Lua error messages, and makes it much + easier to find bugs. + +2013-08-29: wsfulton + Pull Git patch #75: Handle UTF-8 files with BOM at beginning of file. Was giving an + 'Illegal token' syntax error. + +2013-08-29: wsfulton + [C#] Pull Git patch #77: Allow exporting std::map using non-default comparison function. + +2013-08-28: wsfulton + [Python] %implicitconv is improved for overloaded functions. Like in C++, the methods + with the actual types are considered before trying implicit conversions. Example: + + %implicitconv A; + struct A { + A(int i); + }; + class CCC { + public: + int xx(int i) { return 11; } + int xx(const A& i) { return 22; } + }; + + The following python code: + + CCC().xx(-1) + + will now return 11 instead of 22 - the implicit conversion is not done. + +2013-08-23: olly + [Python] Fix clang++ warning in generated wrapper code. + +2013-08-16: wsfulton + [Python] %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer. + Problem highlighted by Bo Peng. Closes SF patch #230. + +2013-08-07: wsfulton + [Python] SF Patch #326 from Kris Thielemans - Remove SwigPyObject_print and SwigPyObject_str and + make the generated wrapper use the default python implementations, which will fall back to repr + (for -builtin option). + + Advantages: + - it avoids the swig user having to jump through hoops to get print to work as expected when + redefining repr/str slots. + - typing the name of a variable on the python prompt now prints the result of a (possibly redefined) + repr, without the swig user having to do any extra work. + - when redefining repr, the swig user doesn't necessarily have to redefine str as it will call the + redefined repr + - the behaviour is exactly the same as without the -builtin option while requiring no extra work + by the user (aside from adding the %feature("python:slot...) statements of course) + + Disadvantage: + - default str() will give different (but clearer?) output on swigged classes + +2013-07-30: wsfulton + [Python, Ruby] Fix #64 #65: Missing code in std::multimap wrappers. Previously an instantiation + of a std::map was erroneously required in addition to an instantiation of std::multimap with the + same template parameters to prevent compilation errors for the wrappers of a std::multimap. + +2013-07-14: joequant + [R] Change types file to allow for SEXP return values + +2013-07-05: wsfulton + [Python] Add %pythonbegin directive which works like %pythoncode, except the specified code is + added at the beginning of the generated .py file. This is primarily needed for importing from + __future__ statements required to be at the very beginning of the file. Example: + + %pythonbegin %{ + from __future__ import print_function + print("Loading", "Whizz", "Bang", sep=' ... ') + %} + +2013-07-01: wsfulton + [Python] Apply SF patch #340 - Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr + when using -builtin. + +2013-07-01: wsfulton + [Python, Ruby, Ocaml] Apply SF patch #341 - fix a const_cast in generated code that was generating + a <:: digraph when using the unary scope operator (::) (global scope) in a template type. + +2013-07-01: wsfulton + [Python] Add SF patch #342 from Christian Delbaere to fix some director classes crashing on + object deletion when using -builtin. Fixes SF bug #1301. + +2013-06-11: wsfulton + [Python] Add SWIG_PYTHON_INTERPRETER_NO_DEBUG macro which can be defined to use the Release version + of the Python interpreter in Debug builds of the wrappers. The Visual Studio .dsp example + files have been modified to use this so that Debug builds will now work without having + to install or build a Debug build of the interpreter. + +2013-06-07: wsfulton + [Ruby] Git issue #52. Fix regression with missing rb_complex_new function for Ruby + versions prior to 1.9 using std::complex wrappers if just using std::complex as an output type. + Also fix the Complex helper functions external visibility (to static by default). + +2013-06-04: olly + [PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL + if the type lookup fails. + Version 2.0.10 (27 May 2013) ============================ diff --git a/CHANGES.current b/CHANGES.current index 1727ecb2c..f2dfaea26 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -2,140 +2,6 @@ Below are the changes for the current release. See the CHANGES file for changes in older releases. See the RELEASENOTES file for a summary of changes in each release. -Version 2.0.11 (15 Sep 2013) -============================ - -2013-09-15: wsfulton - [R] Fix attempt to free a non-heap object in OUTPUT typemaps for: - unsigned short *OUTPUT - unsigned long *OUTPUT - signed long long *OUTPUT - char *OUTPUT - signed char*OUTPUT - unsigned char*OUTPUT - -2013-09-12: wsfulton - [Lua] Pull Git patch #62. - 1) Static members and static functions inside class can be accessed as - ModuleName.ClassName.FunctionName (MemberName respectively). Old way such as - ModuleName.ClassName_FunctionName still works. - 2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc. - -2013-09-12: wsfulton - [UTL] Infinity is now by default an acceptable value for type 'float'. This fix makes - the handling of type 'float' and 'double' the same. The implementation requires the - C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available. - - Users requiring the old behaviour of not accepting infinity, can define a 'check' typemap - wherever a float is used, such as: - - %typemap(check,fragment="") float, const float & %{ - if ($1 < -FLT_MAX || $1 > FLT_MAX) { - SWIG_exception_fail(SWIG_TypeError, "Overflow in type float"); - } - %} - - *** POTENTIAL INCOMPATIBILITY *** - -2013-08-30: wsfulton - [Lua] Pull Git patch #81: Include Lua error locus in SWIG error messages. - This is standard information in Lua error messages, and makes it much - easier to find bugs. - -2013-08-29: wsfulton - Pull Git patch #75: Handle UTF-8 files with BOM at beginning of file. Was giving an - 'Illegal token' syntax error. - -2013-08-29: wsfulton - [C#] Pull Git patch #77: Allow exporting std::map using non-default comparison function. - -2013-08-28: wsfulton - [Python] %implicitconv is improved for overloaded functions. Like in C++, the methods - with the actual types are considered before trying implicit conversions. Example: - - %implicitconv A; - struct A { - A(int i); - }; - class CCC { - public: - int xx(int i) { return 11; } - int xx(const A& i) { return 22; } - }; - - The following python code: - - CCC().xx(-1) - - will now return 11 instead of 22 - the implicit conversion is not done. - -2013-08-23: olly - [Python] Fix clang++ warning in generated wrapper code. - -2013-08-16: wsfulton - [Python] %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer. - Problem highlighted by Bo Peng. Closes SF patch #230. - -2013-08-07: wsfulton - [Python] SF Patch #326 from Kris Thielemans - Remove SwigPyObject_print and SwigPyObject_str and - make the generated wrapper use the default python implementations, which will fall back to repr - (for -builtin option). - - Advantages: - - it avoids the swig user having to jump through hoops to get print to work as expected when - redefining repr/str slots. - - typing the name of a variable on the python prompt now prints the result of a (possibly redefined) - repr, without the swig user having to do any extra work. - - when redefining repr, the swig user doesn't necessarily have to redefine str as it will call the - redefined repr - - the behaviour is exactly the same as without the -builtin option while requiring no extra work - by the user (aside from adding the %feature("python:slot...) statements of course) - - Disadvantage: - - default str() will give different (but clearer?) output on swigged classes - -2013-07-30: wsfulton - [Python, Ruby] Fix #64 #65: Missing code in std::multimap wrappers. Previously an instantiation - of a std::map was erroneously required in addition to an instantiation of std::multimap with the - same template parameters to prevent compilation errors for the wrappers of a std::multimap. - -2013-07-14: joequant - [R] Change types file to allow for SEXP return values - -2013-07-05: wsfulton - [Python] Add %pythonbegin directive which works like %pythoncode, except the specified code is - added at the beginning of the generated .py file. This is primarily needed for importing from - __future__ statements required to be at the very beginning of the file. Example: - - %pythonbegin %{ - from __future__ import print_function - print("Loading", "Whizz", "Bang", sep=' ... ') - %} - -2013-07-01: wsfulton - [Python] Apply SF patch #340 - Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr - when using -builtin. - -2013-07-01: wsfulton - [Python, Ruby, Ocaml] Apply SF patch #341 - fix a const_cast in generated code that was generating - a <:: digraph when using the unary scope operator (::) (global scope) in a template type. - -2013-07-01: wsfulton - [Python] Add SF patch #342 from Christian Delbaere to fix some director classes crashing on - object deletion when using -builtin. Fixes SF bug #1301. - -2013-06-11: wsfulton - [Python] Add SWIG_PYTHON_INTERPRETER_NO_DEBUG macro which can be defined to use the Release version - of the Python interpreter in Debug builds of the wrappers. The Visual Studio .dsp example - files have been modified to use this so that Debug builds will now work without having - to install or build a Debug build of the interpreter. - -2013-06-07: wsfulton - [Ruby] Git issue #52. Fix regression with missing rb_complex_new function for Ruby - versions prior to 1.9 using std::complex wrappers if just using std::complex as an output type. - Also fix the Complex helper functions external visibility (to static by default). - -2013-06-04: olly - [PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL - if the type lookup fails. +Version 2.0.12 (9 Feb 2014) +=========================== diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html index 2dfb438f8..9a9c0cc68 100644 --- a/Doc/Manual/Sections.html +++ b/Doc/Manual/Sections.html @@ -6,7 +6,7 @@

SWIG-2.0 Documentation

-Last update : SWIG-2.0.11 (15 Sep 2013) +Last update : SWIG-2.0.12 (9 Feb 2014)

Sections

diff --git a/README b/README index 946bd9a8f..664e78046 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ SWIG (Simplified Wrapper and Interface Generator) -Version: 2.0.11 (15 Sep 2013) +Version: 2.0.12 (9 Feb 2014) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua, diff --git a/configure.ac b/configure.ac index c4db3ce98..0c984b70b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl The macros which aren't shipped with the autotools are stored in the dnl Tools/config directory in .m4 files. -AC_INIT([swig],[2.0.11],[http://www.swig.org]) +AC_INIT([swig],[2.0.12],[http://www.swig.org]) dnl NB: When this requirement is increased to 2.60 or later, AC_PROG_SED dnl definition below can be removed From d94924a5c45237ce6cfa1104538f3cdd837680bd Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 12 Oct 2013 17:50:29 +0100 Subject: [PATCH 03/18] Add change note for missing Lua return statements Conflicts: CHANGES.current --- CHANGES.current | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index f2dfaea26..41d02270c 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,3 +5,7 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2013-10-12: wsfulton + [Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details() + and SWIG_Lua_namespace_register(). + From c2f5813ffaf92e098b4fbc980b3e102744fcd4b9 Mon Sep 17 00:00:00 2001 From: Robert Stone Date: Thu, 14 Nov 2013 11:19:11 -0800 Subject: [PATCH 04/18] fix "long long" tests for perl v5.6 --- Examples/test-suite/perl5/li_typemaps_runme.pl | 18 +++++++++++------- .../perl5/reference_global_vars_runme.pl | 11 ++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Examples/test-suite/perl5/li_typemaps_runme.pl b/Examples/test-suite/perl5/li_typemaps_runme.pl index c182cdbb1..a573b89a0 100644 --- a/Examples/test-suite/perl5/li_typemaps_runme.pl +++ b/Examples/test-suite/perl5/li_typemaps_runme.pl @@ -41,8 +41,8 @@ batch('schar', -0x80, 0, 1, 12, 0x7f); use Math::BigInt qw(); # the pack dance is to get plain old NVs out of the # Math::BigInt objects. - my $inf = unpack 'd', pack 'd', Math::BigInt->binf(); - my $nan = unpack 'd', pack 'd', Math::BigInt->bnan(); + my $inf = unpack 'd', pack 'd', Math::BigInt->new('Inf'); + my $nan = unpack 'd', pack 'd', Math::BigInt->new('NaN'); batch('float', -(2 - 2 ** -23) * 2 ** 127, -1, -2 ** -149, 0, 2 ** -149, 1, @@ -63,12 +63,16 @@ batch('schar', -0x80, 0, 1, 12, 0x7f); batch('longlong', -1, 0, 1, 12); batch('ulonglong', 0, 1, 12); SKIP: { - my $a = "8000000000000000"; - my $b = "7fffffffffffffff"; - my $c = "ffffffffffffffff"; + use Math::BigInt qw(); skip "not a 64bit Perl", 18 unless eval { pack 'q', 1 }; - batch('longlong', -hex($a), hex($b)); - batch('ulonglong', hex($c)); + my $a = unpack 'q', pack 'q', + Math::BigInt->new('-9223372036854775808'); + my $b = unpack 'q', pack 'q', + Math::BigInt->new('9223372036854775807'); + my $c = unpack 'Q', pack 'Q', + Math::BigInt->new('18446744073709551615'); + batch('longlong', $a, $b); + batch('ulonglong', $c); } my($foo, $int) = li_typemaps::out_foo(10); diff --git a/Examples/test-suite/perl5/reference_global_vars_runme.pl b/Examples/test-suite/perl5/reference_global_vars_runme.pl index dfbcf15bb..89d73b03d 100755 --- a/Examples/test-suite/perl5/reference_global_vars_runme.pl +++ b/Examples/test-suite/perl5/reference_global_vars_runme.pl @@ -53,12 +53,13 @@ $cvar->{var_unsigned_long} = createref_unsigned_long(10); is(value_unsigned_long($cvar->{var_unsigned_long}), 10); SKIP: { - my $a = "6FFFFFFFFFFFFFF8"; + use Math::BigInt qw(); skip "64 bit int support", 1 unless eval { pack 'q', 1 }; - # using hex() here instead of a literal because non 64bit Perls will - # be noisy about big constants. - $cvar->{var_long_long} = createref_long_long(hex $a); - is(value_long_long($cvar->{var_long_long}), hex $a); + # the pack dance is to get plain old IVs out of the + # Math::BigInt objects. + my $a = unpack 'q', pack 'q', Math::BigInt->new('8070450532247928824'); + $cvar->{var_long_long} = createref_long_long($a); + is(value_long_long($cvar->{var_long_long}), $a); } #ull = abs(0xFFFFFFF2FFFFFFF0) From 5602a61bb6fa2b6de419c251fceb2e5cd499893d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 17 Oct 2013 19:56:18 +0100 Subject: [PATCH 05/18] Add missing #include for offsetof when using -builtin. Fixes SF #1345 Conflicts: CHANGES.current --- CHANGES.current | 3 +++ Lib/python/pyinit.swg | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index 41d02270c..bde32009e 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2013-10-17: wsfulton + [Python] Fix SF #1345 - Missing #include for offsetof when using -builtin. + 2013-10-12: wsfulton [Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details() and SWIG_Lua_namespace_register(). diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index 6a6de0963..79df023de 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -4,6 +4,10 @@ %insert(init) "swiginit.swg" +#if defined(SWIGPYTHON_BUILTIN) +%fragment(""); // For offsetof +#endif + %init %{ #ifdef __cplusplus From 122f61cb0bcedb15db0612f9519de4d396f75efc Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 17 Oct 2013 21:54:58 +0100 Subject: [PATCH 06/18] Fix Visual Studio compile error in C++ wrappers due to #include within extern "C" block. Fixes SF #1340 --- CHANGES.current | 4 ++++ Lib/r/rrun.swg | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.current b/CHANGES.current index bde32009e..0507350cd 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2013-10-17: wsfulton + [R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include + within extern "C" block. + 2013-10-17: wsfulton [Python] Fix SF #1345 - Missing #include for offsetof when using -builtin. diff --git a/Lib/r/rrun.swg b/Lib/r/rrun.swg index f8bc9f497..990443e23 100644 --- a/Lib/r/rrun.swg +++ b/Lib/r/rrun.swg @@ -1,5 +1,6 @@ #ifdef __cplusplus +#include extern "C" { #endif @@ -369,7 +370,6 @@ SWIG_R_ConvertPacked(SEXP obj, void *ptr, size_t sz, swig_type_info *ty) { } #ifdef __cplusplus -#include #define SWIG_exception_noreturn(code, msg) do { throw std::runtime_error(msg); } while(0) #else #define SWIG_exception_noreturn(code, msg) do { return result; } while(0) From 7b5eb19ca98be89440c661944b53211096542bda Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 18 Oct 2013 06:49:20 +0100 Subject: [PATCH 07/18] Fix unused variable warning in Ruby wrappers when using gcc -Wall --- Lib/ruby/rubyprimtypes.swg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg index df72e97f4..aa4f7ad37 100644 --- a/Lib/ruby/rubyprimtypes.swg +++ b/Lib/ruby/rubyprimtypes.swg @@ -193,7 +193,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, NUM2DBL(obj)) +%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj); (void)type) SWIGINTERN int SWIG_AsVal_dec(double)(VALUE obj, double *val) From acc5a5eb2d9ba7ab95cf5bb22221ba503c249de1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 22 Dec 2013 19:39:21 +0000 Subject: [PATCH 08/18] C++11 support for new versions of erase and insert in the STL containers. The erase and insert methods in the containers use const_iterator instead of iterator in C++11. There are times when the methods wrapped must match the parameters exactly. Specifically when full type information for template types is missing or SWIG fails to look up the type correctly, for example: %include typedef float Real; %template(RealVector) std::vector; SWIG does not find std::vector::iterator because %template using typedefs does not always work and so SWIG doesn't know if the type is copyable and so uses SwigValueWrapper which does not support conversion to another type (const_iterator). This resulted in compilation errors when using the C++11 version of the containers. Closes #73 Conflicts: CHANGES.current Lib/std/std_unordered_map.i Lib/std/std_unordered_set.i --- CHANGES.current | 21 +++++++++++++++++++++ Lib/std/std_container.i | 21 +++++++++++++++------ Lib/std/std_map.i | 8 +++++--- Lib/std/std_set.i | 7 +++++-- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 0507350cd..d23246f6c 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,27 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2013-12-22: wsfulton + C++11 support for new versions of erase and insert in the STL containers. + + The erase and insert methods in the containers use const_iterator instead + of iterator in C++11. There are times when the methods wrapped must match + the parameters exactly. Specifically when full type information for + template types is missing or SWIG fails to look up the type correctly, + for example: + + %include + typedef float Real; + %template(RealVector) std::vector; + + SWIG does not find std::vector::iterator because %template using + typedefs does not always work and so SWIG doesn't know if the type is + copyable and so uses SwigValueWrapper which does + not support conversion to another type (const_iterator). This resulted + in compilation errors when using the C++11 version of the containers. + + Closes #73 + 2013-10-17: wsfulton [R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include within extern "C" block. diff --git a/Lib/std/std_container.i b/Lib/std/std_container.i index 73d0c6ad9..8ed327bbe 100644 --- a/Lib/std/std_container.i +++ b/Lib/std/std_container.i @@ -46,8 +46,11 @@ void resize(size_type new_size); #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator erase(iterator pos); - iterator erase(iterator first, iterator last); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator erase(iterator pos) { return $self->erase(pos); } + iterator erase(iterator first, iterator last) { return $self->erase(first, last); } +} #endif %enddef @@ -68,8 +71,11 @@ void resize(size_type new_size, const value_type& x); #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator insert(iterator pos, const value_type& x); - void insert(iterator pos, size_type n, const value_type& x); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator insert(iterator pos, const value_type& x) { return $self->insert(pos, x); } + void insert(iterator pos, size_type n, const value_type& x) { $self->insert(pos, n, x); } +} #endif %enddef @@ -89,8 +95,11 @@ void resize(size_type new_size, value_type x); #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator insert(iterator pos, value_type x); - void insert(iterator pos, size_type n, value_type x); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator insert(iterator pos, value_type x) { return $self->insert(pos, x); } + void insert(iterator pos, size_type n, value_type x) { $self->insert(pos, n, x); } +} #endif %enddef diff --git a/Lib/std/std_map.i b/Lib/std/std_map.i index 05208418f..e523c3deb 100644 --- a/Lib/std/std_map.i +++ b/Lib/std/std_map.i @@ -12,9 +12,11 @@ size_type count(const key_type& x) const; #ifdef SWIG_EXPORT_ITERATOR_METHODS -// iterator insert(iterator position, const value_type& x); - void erase(iterator position); - void erase(iterator first, iterator last); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator position) { $self->erase(position); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} iterator find(const key_type& x); iterator lower_bound(const key_type& x); diff --git a/Lib/std/std_set.i b/Lib/std/std_set.i index 16f0f1482..f96ddd9f1 100644 --- a/Lib/std/std_set.i +++ b/Lib/std/std_set.i @@ -29,8 +29,11 @@ reverse_iterator rbegin(); reverse_iterator rend(); - void erase(iterator pos); - void erase(iterator first, iterator last); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator pos) { $self->erase(pos); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} iterator find(const key_type& x); iterator lower_bound(const key_type& x); From 78f92962e207c152a40783181aaf0c77e506cb3b Mon Sep 17 00:00:00 2001 From: Karl Wette Date: Mon, 13 Jan 2014 18:24:17 +1300 Subject: [PATCH 09/18] octave: update support to Octave version 3.8.0 Conflicts: CHANGES.current --- CHANGES.current | 26 ++++++++++ Doc/Manual/Octave.html | 7 +-- Lib/octave/octrun.swg | 102 ++++++++++++++++++++++++++++++++------ Lib/octave/octruntime.swg | 14 +++--- 4 files changed, 121 insertions(+), 28 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index d23246f6c..28b403a6d 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,32 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2014-01-13: kwwette + [Octave] update support to Octave version 3.8.0 + + - Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1 + will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see + http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e + So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to + enable features requiring Octave version major.minor.patch or later. + + For Octave versions prior to 3.8.1, we reconstruct values for + OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER, + extracted from Octave's ChangeLogs. An additional hack is needed to + distinguish between Octave <= 3.2.x and 3.8.0, neither of which define + OCTAVE_API_VERSION_NUMBER. + + - Octave 3.8.0 deprecates symbol_table::varref(), so remove its use + for this and future versions of Octave. + + - Octave 3.8.0 removes octave_value::is_real_nd_array(), used in + octave_swig_type::dims(). Its use is not required here, so remove it. + + - Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0. + + - Updated Octave documentation with tested Octave versions, and added a + warning against using versions <= 3.x.x, which are no longer tested. + 2013-12-22: wsfulton C++11 support for new versions of erase and insert in the STL containers. diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html index 84c0a0f46..3e12ce668 100644 --- a/Doc/Manual/Octave.html +++ b/Doc/Manual/Octave.html @@ -59,11 +59,8 @@ Also, there are a dozen or so examples in the Examples/octave directory, and hun

-The SWIG implemention was first based on Octave 2.9.12, so this is the minimum version required. Testing has only been done on Linux. -

- -

-As of SWIG 2.0.7, the Octave module has been tested with Octave versions 3.0.5, 3.2.4, 3.4.3, and 3.6.1. +As of SWIG 3.0.0, the Octave module has been tested with Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0. +Use of Octave versions older than 3.x.x is not recommended, as these versions are no longer tested with SWIG.

30.2 Running SWIG

diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg index 41d1c7afa..2174a0f7f 100644 --- a/Lib/octave/octrun.swg +++ b/Lib/octave/octrun.swg @@ -1,20 +1,88 @@ #include -#ifndef OCTAVE_API_VERSION_NUMBER - // Hack to distinguish between Octave 3.2 and earlier versions before OCTAVE_API_VERSION_NUMBER existed - #define ComplexLU __ignore - #include - #undef ComplexLU - #ifdef octave_Complex_LU_h - # define OCTAVE_API_VERSION_NUMBER 36 - #else - # define OCTAVE_API_VERSION_NUMBER 37 - #endif +// Macro for enabling features which require Octave version >= major.minor.patch +#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ + ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + OCTAVE_PATCH_VERSION >= ((major)<<16) + ((minor)<<8) + (patch) ) -#endif +// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 +#if !defined(OCTAVE_MAJOR_VERSION) -#if OCTAVE_API_VERSION_NUMBER < 37 +# if !defined(OCTAVE_API_VERSION_NUMBER) + +// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet +// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER +# include +# if defined(octave_ov_h) +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 8 +# define OCTAVE_PATCH_VERSION 0 +# else + +// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed +# define ComplexLU __ignore +# include +# undef ComplexLU +# if defined(octave_Complex_LU_h) + +// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 1 +# define OCTAVE_PATCH_VERSION 99 + +# else + +// OCTAVE_API_VERSION_NUMBER == 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 2 +# define OCTAVE_PATCH_VERSION 0 + +# endif // defined(octave_Complex_LU_h) + +# endif // defined(octave_ov_h) + +// Correlation between Octave API and version numbers extracted from Octave's +// ChangeLogs; version is the *earliest* released Octave with that API number +# elif OCTAVE_API_VERSION_NUMBER >= 48 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 6 +# define OCTAVE_PATCH_VERSION 0 + +# elif OCTAVE_API_VERSION_NUMBER >= 45 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 4 +# define OCTAVE_PATCH_VERSION 1 + +# elif OCTAVE_API_VERSION_NUMBER >= 42 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 54 + +# elif OCTAVE_API_VERSION_NUMBER >= 41 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 53 + +# elif OCTAVE_API_VERSION_NUMBER >= 40 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 52 + +# elif OCTAVE_API_VERSION_NUMBER >= 39 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 51 + +# else // OCTAVE_API_VERSION_NUMBER == 38 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 50 + +# endif // !defined(OCTAVE_API_VERSION_NUMBER) + +#endif // !defined(OCTAVE_MAJOR_VERSION) + +#if !SWIG_OCTAVE_PREREQ(3,2,0) #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, FS ## cname, args, nargout, doc) #else #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, G ## cname, args, nargout, doc) @@ -427,7 +495,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); if (error_state) return dim_vector(1,1); } return d; - } else if (out.is_matrix_type() || out.is_real_nd_array() || out.is_numeric_type() ) { + } else if (out.is_matrix_type() || out.is_numeric_type() ) { if (out.rows()==1 || out.columns()==1) { Array a = out.int_vector_value(); if (error_state) return dim_vector(1,1); @@ -746,7 +814,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); return outarg(0).string_value(); } -#if OCTAVE_API_VERSION_NUMBER >= 40 +#if SWIG_OCTAVE_PREREQ(3,3,52) virtual octave_map map_value() const { return octave_map(); } @@ -982,7 +1050,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own); virtual std::string string_value(bool force = false) const { return ptr->string_value(force); } -#if OCTAVE_API_VERSION_NUMBER >= 40 +#if SWIG_OCTAVE_PREREQ(3,3,52) virtual octave_map map_value() const { return ptr->map_value(); } #else @@ -1293,10 +1361,12 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value } SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) { -#if OCTAVE_API_VERSION_NUMBER < 37 +#if !SWIG_OCTAVE_PREREQ(3,2,0) link_to_global_variable(curr_sym_tab->lookup(name, true)); #else +#if !SWIG_OCTAVE_PREREQ(3,8,0) symbol_table::varref(name); +#endif symbol_table::mark_global(name); #endif } diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg index 43313c3d4..fbf2007f6 100644 --- a/Lib/octave/octruntime.swg +++ b/Lib/octave/octruntime.swg @@ -25,7 +25,7 @@ static bool SWIG_init_user(octave_swig_type* module_ns); SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { bool retn; { -#if OCTAVE_API_VERSION_NUMBER < 38 +#if !SWIG_OCTAVE_PREREQ(3,3,50) unwind_protect::begin_frame("SWIG_Octave_LoadModule"); unwind_protect_int(error_state); unwind_protect_int(warning_state); @@ -44,7 +44,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { discard_warning_messages = true; feval(name, octave_value_list(), 0); retn = (error_state == 0); -#if OCTAVE_API_VERSION_NUMBER < 38 +#if !SWIG_OCTAVE_PREREQ(3,3,50) unwind_protect::run_frame("SWIG_Octave_LoadModule"); #endif } @@ -57,7 +57,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) { bool retn; { -#if OCTAVE_API_VERSION_NUMBER < 38 +#if !SWIG_OCTAVE_PREREQ(3,3,50) unwind_protect::begin_frame("SWIG_Octave_InstallFunction"); unwind_protect_int(error_state); unwind_protect_int(warning_state); @@ -80,7 +80,7 @@ SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::st error_state = 0; feval("autoload", args, 0); retn = (error_state == 0); -#if OCTAVE_API_VERSION_NUMBER < 38 +#if !SWIG_OCTAVE_PREREQ(3,3,50) unwind_protect::run_frame("SWIG_Octave_InstallFunction"); #endif } @@ -196,7 +196,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { // definitely affects version 3.2.*, not sure about 3.3.*, seems to be fixed in // version 3.4.* and above. can be turned off with macro definition. #ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK -#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45 +#if SWIG_OCTAVE_PREREQ(3,2,0) && !SWIG_OCTAVE_PREREQ(3,4,1) octave_exit = ::_Exit; #endif #endif @@ -212,7 +212,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { // workaround bug in octave where installing global variable of custom type and then // exiting without explicitly clearing the variable causes octave to segfault. -#if OCTAVE_API_VERSION_NUMBER > 36 +#if SWIG_OCTAVE_PREREQ(3,2,0) octave_value_list eval_args; eval_args.append("base"); eval_args.append("function __swig_atexit__; " @@ -297,7 +297,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { } } -#if OCTAVE_API_VERSION_NUMBER < 37 +#if !SWIG_OCTAVE_PREREQ(3,2,0) mlock(me->name()); #else mlock(); From c569210dd59e252be5176cb3224cc7e354bb97c1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 16 Jan 2014 06:42:34 +0000 Subject: [PATCH 10/18] Fix PHP compilation error in ZTS mode (64 bit windows) due to TSRMLS_FETCH() expansion Conflicts: CHANGES.current --- CHANGES.current | 4 ++++ Lib/php/phprun.swg | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 28b403a6d..d55bb9716 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.12 (9 Feb 2014) =========================== +2014-01-16: wsfulton + [PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement + of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth. + 2014-01-13: kwwette [Octave] update support to Octave version 3.8.0 diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg index a4188cc7c..063b84227 100644 --- a/Lib/php/phprun.swg +++ b/Lib/php/phprun.swg @@ -255,11 +255,10 @@ static char const_name[] = "swig_runtime_data_type_pointer"; static swig_module_info *SWIG_Php_GetModule(void *SWIGUNUSEDPARM(clientdata)) { zval *pointer; swig_module_info *ret = 0; + TSRMLS_FETCH(); MAKE_STD_ZVAL(pointer); - TSRMLS_FETCH(); - if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) { if (pointer->type == IS_LONG) { ret = (swig_module_info *) pointer->value.lval; From 36f5117b25fd6689e76bb0e2854e9df696631a2c Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 13 Dec 2013 17:48:26 +0100 Subject: [PATCH 11/18] Guile: make scm to string conversion work with non-ascii strings --- .../test-suite/guile/li_std_string_runme.scm | 4 ++++ Lib/guile/guile_scm_run.swg | 22 ++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Examples/test-suite/guile/li_std_string_runme.scm b/Examples/test-suite/guile/li_std_string_runme.scm index 5dde68f8d..5b5563281 100644 --- a/Examples/test-suite/guile/li_std_string_runme.scm +++ b/Examples/test-suite/guile/li_std_string_runme.scm @@ -2,4 +2,8 @@ ;; Guile modules (namespaces) but simply put all the bindings into the ;; current module. That's enough for such a simple test. (dynamic-call "scm_init_li_std_string_module" (dynamic-link "./libli_std_string")) +; Note: when working with non-ascii strings in guile 2 +; locale must be set explicitly +; The setlocale call below takes care of that +(setlocale LC_ALL "") (load "../schemerunme/li_std_string.scm") diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg index 0ac51f919..4978ab114 100644 --- a/Lib/guile/guile_scm_run.swg +++ b/Lib/guile/guile_scm_run.swg @@ -41,10 +41,14 @@ typedef struct swig_guile_clientdata { SCM goops_class; } swig_guile_clientdata; +#if SCM_MAJOR_VERSION <= 2 +#define scm_to_utf8_string scm_to_locale_string +#define scm_from_utf8_string scm_from_locale_string +#endif #define SWIG_scm2str(s) \ SWIG_Guile_scm2newstr(s, NULL) #define SWIG_str02scm(str) \ - str ? scm_from_locale_string(str) : SCM_BOOL_F + str ? scm_from_utf8_string(str) : SCM_BOOL_F # define SWIG_malloc(size) \ scm_malloc(size) # define SWIG_free(mem) \ @@ -84,21 +88,13 @@ SWIGINTERN char * SWIG_Guile_scm2newstr(SCM str, size_t *len) { #define FUNC_NAME "SWIG_Guile_scm2newstr" char *ret; - char *tmp; - size_t l; SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME); - l = scm_c_string_length(str); - ret = (char *) SWIG_malloc( (l + 1) * sizeof(char)); + ret = scm_to_utf8_string(str); if (!ret) return NULL; - tmp = scm_to_locale_string(str); - memcpy(ret, tmp, l); - free(tmp); - - ret[l] = '\0'; - if (len) *len = l; + if (len) *len = strlen(ret) - 1; return ret; #undef FUNC_NAME } @@ -482,7 +478,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest, int num_args_passed = 0; for (i = 0; i Date: Wed, 5 Feb 2014 11:52:26 +0100 Subject: [PATCH 12/18] Guile: illustrate bug in non-ascii string handling --- Examples/test-suite/schemerunme/li_std_string.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/schemerunme/li_std_string.scm b/Examples/test-suite/schemerunme/li_std_string.scm index e77c32870..343b9b8e8 100644 --- a/Examples/test-suite/schemerunme/li_std_string.scm +++ b/Examples/test-suite/schemerunme/li_std_string.scm @@ -1,4 +1,6 @@ -(define x "hello") +; The test string has some non-ascii characters added +; because our guile wrappers had bugs in that area +(define x "hello - æææ") (if (not (string=? (test-value x) x)) (begin (error "Error 1") (exit 1))) From 7f8cb93092640ead96b3da60a6fb8c42eb0c13d9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Feb 2014 11:08:56 +0000 Subject: [PATCH 13/18] mkdist script tweaks to support releasing from any named branch --- Tools/mkdist.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Tools/mkdist.py b/Tools/mkdist.py index 234c768f2..2e69dbece 100755 --- a/Tools/mkdist.py +++ b/Tools/mkdist.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # This script builds a swig-x.y.z distribution. -# Usage : mkdist.py version, where version should be x.y.z +# Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master' import sys import string @@ -16,10 +16,16 @@ def failed(): try: version = sys.argv[1] dirname = "swig-" + version + branch = sys.argv[2] except: - print "Usage: mkdist.py version, where version should be x.y.z" + print "Usage: mkdist.py version branch, where version should be x.y.z and branch is normally 'master'" sys.exit(1) +if sys.version_info[0:2] < (2, 7): + print "Error: Python 2.7 is required" + sys.exit(3) + + # Check name matches normal unix conventions if string.lower(dirname) != dirname: print "directory name ("+dirname+") should be in lowercase" @@ -38,7 +44,7 @@ os.system("rm -f "+dirname+".tar") # Grab the code from git print "Checking git repository is in sync with remote repository" -os.system("git remote update") == 0 or failed() +os.system("git remote update origin") == 0 or failed() command = ["git", "status", "--porcelain", "-uno"] out = subprocess.check_output(command) if out.strip() != "": @@ -47,7 +53,7 @@ if out.strip() != "": print out sys.exit(3) -command = ["git", "log", "--oneline", "master..origin/master"] +command = ["git", "log", "--oneline", branch + "..origin/" + branch] out = subprocess.check_output(command) if out.strip() != "": print "Remote repository has additional modifications to local repository" @@ -55,7 +61,7 @@ if out.strip() != "": print out sys.exit(3) -command = ["git", "log", "--oneline", "origin/master..master"] +command = ["git", "log", "--oneline", "origin/" + branch + ".." + branch] out = subprocess.check_output(command) if out.strip() != "": print "Local repository has modifications not pushed to the remote repository" From 3cd7055895c396701ca574de7cd46329728c26a5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Feb 2014 16:24:15 +0000 Subject: [PATCH 14/18] Temporary workaround for bug in Travis build environment --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 26758304f..e3d345972 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ before_install: - if test "$SWIGLANG" = "python" -a "$PY3"; then sudo apt-get install python3-dev; fi - if test "$SWIGLANG" = "tcl"; then sudo apt-get -qq install tcl8.4-dev; fi script: + - export PS4="+ " #Temporary workaround bug in Travis build environment - ./autogen.sh && ./configure - make -s $SWIGJOBS - if test -z "$SWIGLANG"; then make -s check-ccache; fi From 3c5de3457341f5eba0ddfc462df066c7974593e2 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 8 Feb 2014 19:13:43 +0000 Subject: [PATCH 15/18] Turn on Travis testing for maintenance-2.0 branch --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e3d345972..50fd3b66b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,3 +57,4 @@ script: branches: only: - master + - maintenance-2.0 From 885a7002835f447e87350e7601ea1518e31c8759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= Date: Fri, 29 Nov 2013 13:48:07 +0100 Subject: [PATCH 16/18] Make string encoding explitic Ruby 2.0 enforces explicit string encodings. The char_constant testcase fails because the internal (SWIG_FromCharPtrAndSize, using rb_str_new) defaults to ASCII-8BIT while the test-suite file defaults to the current shell LOCALE setting. This patch sets the char_constant_runme.rb encoding to ASCII-8BIT. --- Examples/test-suite/ruby/char_constant_runme.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/test-suite/ruby/char_constant_runme.rb b/Examples/test-suite/ruby/char_constant_runme.rb index 4e9d9d59c..4c56ecbf7 100644 --- a/Examples/test-suite/ruby/char_constant_runme.rb +++ b/Examples/test-suite/ruby/char_constant_runme.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -# +#Encoding: ASCII-8BIT # Put description here # # From 08639f7f248c5e0a7621750452ef53a6f6834378 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 9 Feb 2014 09:34:18 +0000 Subject: [PATCH 17/18] Add release summary for 2.0.12 --- RELEASENOTES | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASENOTES b/RELEASENOTES index 720dc9d34..756df81ff 100644 --- a/RELEASENOTES +++ b/RELEASENOTES @@ -4,6 +4,14 @@ and CHANGES files. Release Notes ============= +SWIG-2.0.12 summary: +- This is a maintenance release backporting some fixes from the pending + 3.0.0 release. +- Octave 3.8 support added. +- C++11 support for new versions of erase/insert in the STL containers. +- Compilation fixes on some systems for the generated Lua, PHP, Python + and R wrappers. + SWIG-2.0.11 summary: - Minor bug fixes and enhancements mostly in Python, but also C#, Lua, Ocaml, Octave, Perl, PHP, Python, R, Ruby, Tcl. From 1c4213594a6d12484553506b1f81c67e5a84d904 Mon Sep 17 00:00:00 2001 From: William Fulton Date: Sun, 9 Feb 2014 22:09:05 +0000 Subject: [PATCH 18/18] Release scripts to release from any branch --- Tools/mkrelease.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tools/mkrelease.py b/Tools/mkrelease.py index 9eceba07e..3f49ffd9d 100755 --- a/Tools/mkrelease.py +++ b/Tools/mkrelease.py @@ -15,9 +15,10 @@ def failed(message): try: version = sys.argv[1] - username = sys.argv[2] + branch = sys.argv[2] + username = sys.argv[3] except: - print "Usage: python mkrelease.py version username" + print "Usage: python mkrelease.py version branch username" print "where version should be x.y.z and username is your SF username" sys.exit(1) @@ -25,7 +26,7 @@ print "Looking for rsync" os.system("which rsync") and failed("rsync not installed/found. Please install.") print "Making source tarball" -os.system("python ./mkdist.py " + version) and failed("") +os.system("python ./mkdist.py " + version + " " + branch) and failed("") print "Build Windows package" os.system("./mkwindows.sh " + version) and failed("")