Merge branch 'master' into gsoc2012-scilab

This commit is contained in:
Simon Marchetto 2014-03-11 10:24:09 +01:00
commit 013b9f9769
36 changed files with 285 additions and 303 deletions

View file

@ -1,8 +1,8 @@
*** ANNOUNCE: SWIG 2.0.10 (in progress) ***
*** ANNOUNCE: SWIG 3.0.0 (in progress) ***
http://www.swig.org
We're pleased to announce SWIG-2.0.10, the latest SWIG release.
We're pleased to announce SWIG-3.0.0, 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.10.tar.gz
http://prdownloads.sourceforge.net/swig/swig-3.0.0.tar.gz
A Windows version is also available at
http://prdownloads.sourceforge.net/swig/swigwin-2.0.10.zip
http://prdownloads.sourceforge.net/swig/swigwin-3.0.0.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.

View file

@ -200,6 +200,8 @@ typedef int (*COMPAR_FN_T)(const void *, const void *);
/* mkstemp() on some versions of cygwin don't handle binary files, so
override */
/* Seems okay in Cygwin 1.7.0
#ifdef __CYGWIN__
#undef HAVE_MKSTEMP
#endif
*/

View file

@ -82,7 +82,7 @@ void copy_fd(int fd_in, int fd_out)
#ifndef HAVE_MKSTEMP
/* cheap and nasty mkstemp replacement */
static int mkstemp(char *template)
int mkstemp(char *template)
{
mktemp(template);
return open(template, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);

142
CHANGES
View file

@ -3,6 +3,144 @@ 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.h>") 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)
============================
@ -3165,8 +3303,8 @@ Version 1.3.36 (24 June 2008)
Makefile target being generated when generating makefiles with the -M family
of options. For example:
$ swig -java -MM -MT overiddenname -c++ example.i
overiddenname: \
$ swig -java -MM -MT overriddenname -c++ example.i
overriddenname: \
example.i \
example.h

View file

@ -2,131 +2,13 @@ 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 (in progress)
Version 3.0.0 (in progress)
============================
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-10-04: wsfulton
Fix %naturalvar not having any affect on templated classes instantiated with an
enum as the template parameter type. Problem reported by Vadim Zeitlin.
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.h>") 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.
2013-09-20: wsfulton
[Java] Fix a memory leak for the java char **STRING_ARRAY typemaps.

View file

@ -7886,7 +7886,7 @@ where it is possible to step from Java code into a JNI method within one environ
<p>
Alternatively, debugging can involve placing debug printout statements in the JNI layer using the <tt>%exception</tt> directive.
See the <a href="Customization.html#Customization_exception_special_variables">special variables for %exception</a> section.
Many of the default typemaps can also be overidden and modified for adding in extra logging/debug display information.
Many of the default typemaps can also be overridden and modified for adding in extra logging/debug display information.
</p>
<p>

View file

@ -258,7 +258,7 @@ this option the default output directory is the path to the input file.
If <tt>-o</tt> and
<tt>-outcurrentdir</tt> are used together, <tt>-outcurrentdir</tt> is effectively ignored
as the output directory for the language files is the same directory as the
generated C/C++ file if not overidden with <tt>-outdir</tt>.
generated C/C++ file if not overridden with <tt>-outdir</tt>.
</p>
<H3><a name="SWIG_nn5"></a>5.1.3 Comments</H3>

View file

@ -1,12 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SWIG-2.0 Documentation</title>
<title>SWIG-3.0 Documentation</title>
</head>
<body bgcolor="#ffffff">
<H1><a name="Sections"></a>SWIG-2.0 Documentation</H1>
<H1><a name="Sections"></a>SWIG-3.0 Documentation</H1>
Last update : SWIG-2.0.10 (in progress)
Last update : SWIG-3.0.0 (in progress)
<H2>Sections</H2>

View file

@ -51,11 +51,6 @@ RUNPIPE=
RUNME = runme
# X11 options
XLIB = @XLIBSW@
XINCLUDE = @XINCLUDES@
IWRAP = $(INTERFACE:.i=_wrap.i)
ISRCS = $(IWRAP:.i=.c)
ICXXSRCS = $(IWRAP:.i=.cxx)
@ -136,7 +131,6 @@ TCL_SCRIPT = $(RUNME).tcl
# Build a new version of the tclsh shell
# -----------------------------------------------------------
tclsh: $(SRCS)
$(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i $(INTERFACEPATH)
$(CC) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \
@ -147,21 +141,6 @@ tclsh_cpp: $(SRCS)
$(CXX) $(CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \
$(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET)
# -----------------------------------------------------------
# Build a new copy of wish
# -----------------------------------------------------------
wish: $(SRCS)
$(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -lwish.i $(INTERFACEPATH)
$(CC) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \
$(XINCLUDE) $(TCL_LIB) $(TK_OPTS) $(XLIB) $(LIBS) $(SYSLIBS) -o $(TARGET)
wish_cpp: $(SRCS)
$(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -lwish.i $(INTERFACEPATH)
$(CXX) $(CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \
$(XINCLUDE) $(TCL_LIB) $(TK_OPTS) $(XLIB) $(LIBS) $(SYSLIBS) -o $(TARGET)
# -----------------------------------------------------------
# Build a Tcl dynamic loadable module (you might need to tweak this)
# -----------------------------------------------------------
@ -913,6 +892,7 @@ RUBY_INCLUDE= @RUBYINCLUDE@
RUBY_LIB = @RUBYLIB@
RUBY_DLNK = @RUBYDYNAMICLINKING@
RUBY_LIBOPTS = @RUBYLINK@ @LIBS@ $(SYSLIBS)
RUBY_SO = @RUBYSO@
RUBY = @RUBY@
RUBY_SCRIPT = $(RUNME).rb
@ -924,7 +904,7 @@ RUBY_SCRIPT = $(RUNME).rb
ruby: $(SRCS)
$(SWIG) -ruby $(SWIGOPT) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CFLAGS) $(RUBY_CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(RUBY_INCLUDE)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO)
# -----------------------------------------------------------------
# Build a C++ dynamically loadable module
@ -933,7 +913,7 @@ ruby: $(SRCS)
ruby_cpp: $(SRCS)
$(SWIG) -c++ -ruby $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(RUBY_INCLUDE)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO)
# -----------------------------------------------------------------
# Build statically linked Ruby interpreter

View file

@ -96,7 +96,7 @@ public class SwigExtend extends Activity
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in Java. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// slightly different, however, because of the overridden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, Java resolved the call
// immediately in CEO, but now Java thinks the object is an instance of

View file

@ -45,7 +45,7 @@ public class runme
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in C#. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// slightly different, however, because of the overridden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, C# resolved the call
// immediately in CEO, but now C# thinks the object is an instance of

View file

@ -46,7 +46,7 @@ void main() {
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in D. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// slightly different, however, because of the overridden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, D resolved the call
// immediately in CEO, but now D thinks the object is an instance of

View file

@ -46,7 +46,7 @@ void main() {
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in D. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// slightly different, however, because of the overridden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, D resolved the call
// immediately in CEO, but now D thinks the object is an instance of

View file

@ -42,7 +42,7 @@ func main() {
// treated the same. For items 0, 1, and 2, all methods
// resolve in C++. For item 3, our CEO, GetTitle calls
// GetPosition which resolves in Go. The call to GetPosition
// is slightly different, however, because of the overidden
// is slightly different, however, because of the overridden
// GetPosition() call, since now the object reference has been
// "laundered" by passing through EmployeeList as an
// Employee*. Previously, Go resolved the call immediately in

View file

@ -55,7 +55,7 @@ public class runme {
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in Java. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// slightly different, however, because of the overridden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, Java resolved the call
// immediately in CEO, but now Java thinks the object is an instance of

View file

@ -274,6 +274,7 @@ CPP_TEST_CASES += \
nspace \
nspace_extend \
naturalvar \
naturalvar_more \
nested_class \
nested_comment \
nested_workaround \

View file

@ -4,6 +4,12 @@
%{
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
// Fix Tcl.h and Windows.h cat and mouse over definition of VOID
#if defined(_TCL) && defined(__CYGWIN__)
#ifdef VOID
#undef VOID
#endif
#endif
#include <windows.h>
#else
// Use equivalent types for non-windows systems

View file

@ -0,0 +1,53 @@
%module naturalvar_more
// The instantiation of a template using an enum in the template parameter was not picking up %naturalvar.
// These typemaps will be used if %naturalvar is not working
%typemap(out) T<Space::E> *te, T<Space::E> *const_te "_should_not_use_this_out_typemap_"
%typemap(varout) T<Space::E> *te, T<Space::E> *const_te "_should_not_use_this_varout_typemap_"
%typemap(out) Hidden *hidden "_should_not_use_this_out_typemap_"
%typemap(varout) Hidden *hidden "_should_not_use_this_varout_typemap_"
%naturalvar T<Space::E>;
%naturalvar Hidden;
%inline %{
template <typename X> struct T {};
struct K {};
struct Hidden;
namespace Ace {
int glob;
}
%}
%{
struct Hidden {};
namespace Ace {
template<typename> struct NoIdea {};
}
%}
%inline %{
namespace Space {
enum E { E1, E2, E3 };
}
%}
%template(TE) T<Space::E>;
%include <std_string.i>
%include <std_vector.i>
%template(VectorString) std::vector<std::string>;
%inline {
using namespace Space;
struct S {
T<E> te;
const T<E> const_te;
const std::vector<std::string>::value_type const_string_member; // check this resolves to std::string which has a naturalvar
std::vector<std::string>::value_type string_member; // check this resolves to std::string which has a naturalvar
Hidden hidden;
Ace::NoIdea<Hidden> noidea;
S() : const_te(), const_string_member("initial string value") {}
};
}

View file

@ -1,5 +1,9 @@
%module typemap_qualifier_strip
%typemap(freearg) int *ptr ""
%typemap(freearg) int *const ptrConst ""
%typemap(freearg) int const* constPtr ""
%typemap(in) int *ptr {
int temp = 1234;
$1 = &temp;

View file

@ -431,7 +431,7 @@
%}
/* Typecheck typemaps. The purpose of these is merely to issue a
warning for overloaded C++ functions * that cannot be overloaded in
warning for overloaded C++ functions that cannot be overloaded in
Go as more than one C++ type maps to a single Go type. */
%typecheck(SWIG_TYPECHECK_BOOL) /* Go bool */

View file

@ -52,7 +52,7 @@
%typemap(freearg) char **STRING_ARRAY {
int i;
for (i=0; i<size$argnum-1; i++)
for (i=0; i<size$argnum; i++)
#ifdef __cplusplus
delete[] $1[i];
delete[] $1;

View file

@ -47,7 +47,7 @@ SWIGOPT = -perl5
SWIGCC = $(CC)
# SWIG Library files. Uncomment this to staticly rebuild Perl
#SWIGLIB = -static -lperlmain.i
#SWIGLIBS = -static -lperlmain.i
# Rules for creating .o files from source.
@ -69,33 +69,21 @@ BUILD = @LDSHARED@
#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
-L/usr/local/lib -lg++ -lstdc++ -lgcc
# X11 installation (possibly needed if using Perl-Tk)
XLIB = @XLIBSW@
XINCLUDE = @XINCLUDES@
# Perl installation
PERL_INCLUDE = -I@PERL5EXT@
PERL_LIB = -L@PERL5EXT@ -lperl
PERL_FLAGS = -Dbool=char -Dexplicit=
# Tcl installation. If using Tk you might need this
TCL_INCLUDE = @TCLINCLUDE@
TCL_LIB = @TCLLIB@
# Build libraries (needed for static builds)
LIBM = @LIBM@
LIBC = @LIBC@
SYSLIBS = $(LIBM) $(LIBC) @LIBS@
# Build options (uncomment only one these)
# Build options
#TK_LIB = $(TCL_LIB) -ltcl -ltk $(XLIB)
BUILD_LIBS = $(LIBS) # Dynamic loading
#BUILD_LIBS = $(PERL_LIB) $(TK_LIB) $(LIBS) $(SYSLIBS) # Static linking
# Compilation rules for non-SWIG components
@ -123,7 +111,7 @@ $(WRAPOBJ) : $(WRAPFILE)
$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(PERL_INCLUDE) $(PERL_FLAGS) $(WRAPFILE)
$(WRAPFILE) : $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIBS) $(INTERFACE)
$(TARGET): $(WRAPOBJ) $(ALLOBJS)
$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)

View file

@ -47,7 +47,7 @@ SWIGOPT = -python
SWIGCC = $(CC)
# SWIG Library files. Uncomment if rebuilding the Python interpreter
#SWIGLIB = -lembed.i
#SWIGLIBS = -lembed.i
# Rules for creating .o files from source.
@ -69,32 +69,20 @@ BUILD = @LDSHARED@
#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
-L/usr/local/lib -lg++ -lstdc++ -lgcc
# X11 installation (needed if rebuilding Python + tkinter)
XLIB = @XLIBSW@
XINCLUDE = @XINCLUDES@
# Python installation
PY_INCLUDE = -DHAVE_CONFIG_H @PYINCLUDE@
PY_LIB = @PYLIB@
# Tcl installation. Needed if rebuilding Python with tkinter.
TCL_INCLUDE = @TCLINCLUDE@
TCL_LIB = @TCLLIB@
# Build libraries (needed for static builds)
LIBM = @LIBM@
LIBC = @LIBC@
SYSLIBS = $(LIBM) $(LIBC) @LIBS@
# Build options (uncomment only one these)
# Build options
#TKINTER = $(TCL_LIB) -ltk -ltcl $(XLIB)
BUILD_LIBS = $(LIBS) # Dynamic loading
#BUILD_LIBS = $(PY_LIB) @PYLINK@ $(TKINTER) $(LIBS) $(SYSLIBS)
# Compilation rules for non-SWIG components
@ -122,7 +110,7 @@ $(WRAPOBJ) : $(WRAPFILE)
$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(PY_INCLUDE)
$(WRAPFILE) : $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIBS) $(INTERFACE)
$(TARGET): $(WRAPOBJ) $(ALLOBJS)
$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)

View file

@ -114,12 +114,19 @@ signed int *OUTPUT,
unsigned int *OUTPUT,
short *OUTPUT,
signed short *OUTPUT,
unsigned short *OUTPUT,
long *OUTPUT,
signed long *OUTPUT,
unsigned long *OUTPUT,
long long *OUTPUT,
signed long long *OUTPUT,
unsigned long long *OUTPUT,
float *OUTPUT,
double *OUTPUT {}
double *OUTPUT,
char *OUTPUT,
signed char *OUTPUT,
unsigned char *OUTPUT
{}

View file

@ -1,5 +1,5 @@
# ---------------------------------------------------------------
# SWIG Tcl/Tk Makefile
# SWIG Tcl Makefile
#
# This file can be used to build various Tcl extensions with SWIG.
# By default this file is set up for dynamic loading, but it can
@ -48,9 +48,8 @@ SWIG = $(exec_prefix)/bin/swig
SWIGOPT = -tcl # use -tcl8 for Tcl 8.0
SWIGCC = $(CC)
# SWIG Library files. Uncomment one of these for rebuilding tclsh or wish
#SWIGLIB = -ltclsh.i
#SWIGLIB = -lwish.i
# SWIG Library files. Uncomment if rebuilding tclsh
#SWIGLIBS = -ltclsh.i
# Rules for creating .o files from source.
@ -72,12 +71,7 @@ BUILD = @LDSHARED@
#DLL_LIBS = -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \
-L/usr/local/lib -lg++ -lstdc++ -lgcc
# X11 installation (needed to rebuild Tk extensions)
XLIB = @XLIBSW@
XINCLUDE = @XINCLUDES@
# Tcl installation (where is Tcl/Tk located)
# Tcl installation (where is Tcl located)
TCL_INCLUDE = @TCLINCLUDE@
TCL_LIB = @TCLLIB@
@ -88,11 +82,10 @@ LIBM = @LIBM@
LIBC = @LIBC@
SYSLIBS = $(LIBM) $(LIBC) @LIBS@
# Build options (uncomment only one these)
# Build options (uncomment only one of these)
BUILD_LIBS = $(LIBS) # Dynamic loading
#BUILD_LIBS = $(TCL_LIB) -ltcl $(LIBS) $(SYSLIBS) # tclsh
#BUILD_LIBS = $(TCL_LIB) -ltk -ltcl $(XLIB) $(LIBS) $(SYSLIBS) # wish
# Compilation rules for non-SWIG components
@ -120,7 +113,7 @@ $(WRAPOBJ) : $(WRAPFILE)
$(SWIGCC) -c $(CCSHARED) $(CFLAGS) $(WRAPFILE) $(INCLUDES) $(TCL_INCLUDE)
$(WRAPFILE) : $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIB) $(INTERFACE)
$(SWIG) $(SWIGOPT) -o $(WRAPFILE) $(SWIGLIBS) $(INTERFACE)
$(TARGET): $(WRAPOBJ) $(ALLOBJS)
$(BUILD) $(WRAPOBJ) $(ALLOBJS) $(BUILD_LIBS) -o $(TARGET)

View file

@ -441,7 +441,7 @@ maintainer-clean:
$(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
mkdir -p Lib
echo "/* SWIG warning codes */" > $@
cat $? | grep "^#define WARN\|/\*.*\*/\|^[ \t]*$$" | sed 's/^#define \(WARN.*[0-9]\+\)\(.*\)$$/%define SWIG\1 %enddef\2/' >> $@
cat $? | grep "^#define WARN\|/\*.*\*/\|^[ \t]*$$" | sed 's/^#define \(WARN.*[0-9][0-9]*\)\(.*\)$$/%define SWIG\1 %enddef\2/' >> $@
#####################################################################
# TARGETS: install & friends

2
README
View file

@ -1,6 +1,6 @@
SWIG (Simplified Wrapper and Interface Generator)
Version: 2.0.10 (in progress)
Version: 3.0.0 (in progress)
Tagline: SWIG is a compiler that integrates C and C++ with languages
including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua,

View file

@ -4,6 +4,10 @@ and CHANGES files.
Release Notes
=============
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.
SWIG-2.0.10 summary:
- Ruby 1.9 support is now complete.
- Add support for Guile 2.0 and Guile 1.6 support (GH interface) has

View file

@ -141,8 +141,6 @@ beautify-file:
test -n "$(INDENTFILE)" || (echo INDENTFILE not defined && exit 1;)
test -e $(INDENTFILE) || (echo File does not exist: $(INDENTFILE) && exit 1;)
cp $(INDENTFILE) $(INDENTBAKSDIR)/$(INDENTFILE);
unix2dos $(INDENTFILE)
dos2unix $(INDENTFILE)
indent -kr --honour-newlines --line-length160 --indent-level2 --braces-on-func-def-line --leave-optional-blank-lines $(SWIGTYPEDEFS) $(INDENTFILE) -o $(INDENTFILE).tmp;
cat $(INDENTFILE).tmp | sed -e 's/const const /const /' > $(INDENTFILE);
rm $(INDENTFILE).tmp;

View file

@ -467,9 +467,9 @@ void swig_pragma(char *lang, char *name, char *value) {
}
/* --------------------------------------------------------------------------
* use_naturalvar_mode()
* Language::use_naturalvar_mode()
* -------------------------------------------------------------------------- */
int use_naturalvar_mode(Node *n) {
int Language::use_naturalvar_mode(Node *n) const {
if (Getattr(n, "unnamed"))
return 0;
int nvar = naturalvar_mode || GetFlag(n, "feature:naturalvar");
@ -478,12 +478,16 @@ int use_naturalvar_mode(Node *n) {
SwigType *ty = Getattr(n, "type");
SwigType *fullty = SwigType_typedef_resolve_all(ty);
if (SwigType_isclass(fullty)) {
Node *m = Copy(n);
SwigType *tys = SwigType_strip_qualifiers(fullty);
Swig_features_get(Swig_cparse_features(), 0, tys, 0, m);
nvar = GetFlag(m, "feature:naturalvar");
if (!CPlusPlus) {
Replaceall(tys, "struct ", "");
Replaceall(tys, "union ", "");
Replaceall(tys, "class ", "");
}
Node *typenode = Swig_symbol_clookup(tys, 0);
if (typenode)
nvar = GetFlag(typenode, "feature:naturalvar");
Delete(tys);
Delete(m);
}
Delete(fullty);
}
@ -1441,6 +1445,7 @@ int Language::membervariableHandler(Node *n) {
tm = Swig_typemap_lookup("memberin", nin, target, 0);
Delete(nin);
}
int flags = Extend | SmartPointer | use_naturalvar_mode(n);
if (isNonVirtualProtectedAccess(n))
flags = flags | CWRAP_ALL_PROTECTED_ACCESS;
@ -2513,7 +2518,7 @@ int Language::classHandler(Node *n) {
Setattr(m, "parentNode", n);
/*
* There is a bug that needs fixing still...
* This area of code is creating methods which have not been overidden in a derived class (director methods that are protected in the base)
* This area of code is creating methods which have not been overridden in a derived class (director methods that are protected in the base)
* If the method is overloaded, then Swig_overload_dispatch() incorrectly generates a call to the base wrapper, _wrap_xxx method
* See director_protected_overloaded.i - Possibly sym:overname needs correcting here.
Printf(stdout, "new method: %s::%s(%s)\n", Getattr(parentNode(m), "name"), Getattr(m, "name"), ParmList_str_defaultargs(Getattr(m, "parms")));
@ -3091,7 +3096,7 @@ Node *Language::symbolLookup(String *s, const_String_or_char_ptr scope) {
* Tries to locate a class from a type definition
* ----------------------------------------------------------------------------- */
Node *Language::classLookup(const SwigType *s) {
Node *Language::classLookup(const SwigType *s) const {
Node *n = 0;
/* Look in hash of cached values */

View file

@ -2606,8 +2606,8 @@ done:
/* wrap complex arguments to zvals */
Printv(w->code, wrap_args, NIL);
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,\n");
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,");
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
if (tm) {
Printv(w->code, Str(tm), "\n", NIL);

View file

@ -3728,7 +3728,7 @@ public:
if (builtin)
builtin_pre_decl(n);
/* Overide the shadow file so we can capture its methods */
/* Override the shadow file so we can capture its methods */
f_shadow = NewString("");
// Set up type check for director class constructor

View file

@ -215,7 +215,7 @@ public:
virtual int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */
virtual void dumpSymbols();
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
virtual Node *classLookup(const SwigType *s); /* Class lookup */
virtual Node *classLookup(const SwigType *s) const; /* Class lookup */
virtual Node *enumLookup(SwigType *s); /* Enum lookup */
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
virtual int is_assignable(Node *n); /* Is variable assignable? */
@ -300,6 +300,9 @@ protected:
This does not include protected virtual methods as they are turned on with the dirprot option. */
bool isNonVirtualProtectedAccess(Node *n) const;
/* Identify if a wrapped global or member variable n should use the naturalvar feature */
int use_naturalvar_mode(Node *n) const;
/* Director subclass comparison test */
String *none_comparison;
@ -380,7 +383,6 @@ int is_protected(Node *n);
int is_member_director(Node *parentnode, Node *member);
int is_member_director(Node *member);
int is_non_virtual_protected_access(Node *n); /* Check if the non-virtual protected members are required (for directors) */
int use_naturalvar_mode(Node *n);
void Wrapper_virtual_elimination_mode_set(int);
void Wrapper_fast_dispatch_mode_set(int);

View file

@ -4,7 +4,7 @@ dnl Set the maximum warning verbosity according to C and C++ compiler used.
dnl Currently supports g++ and gcc.
dnl
dnl The compiler options are always added CFLAGS and CXXFLAGS even if
dnl these are overidden at configure time. Removing the maximum warning
dnl these are overridden at configure time. Removing the maximum warning
dnl flags can be removed with --without-maximum-compile-warnings. For example:
dnl
dnl ./configure --without-maximum-compile-warnings CFLAGS= CXXFLAGS=

View file

@ -45,4 +45,4 @@ os.system("rsync --archive --verbose -P --times -e ssh " + "swigwin-" + version
print "Finished"
print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push'."
print "Now log in to SourceForge and set the operating systems applicable to the newly uploaded tarball and zip file. Also remember to do a 'git push --tags'."

View file

@ -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],[3.0.0],[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
@ -418,80 +418,9 @@ else AC_MSG_ERROR([proper usage is --with-libc=STRING])
fi])
#--------------------------------------------------------------------
# Locate the X11 header files and the X11 library archive. Try
# the ac_path_x macro first, but if it doesn't find the X stuff
# (e.g. because there's no xmkmf program) then check through
# a list of possible directories. Under some conditions the
# autoconf macro will return an include directory that contains
# no include files, so double-check its result just to be safe.
# Target languages
#--------------------------------------------------------------------
AC_PATH_X
not_really_there=""
if test "$no_x" = ""; then
if test "$x_includes" = ""; then
AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
else
if test ! -r $x_includes/X11/Intrinsic.h; then
not_really_there="yes"
fi
fi
fi
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
AC_MSG_CHECKING(for X11 header files)
XINCLUDES="# no special path needed"
AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="")
if test -z "$XINCLUDES"; then
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include /usr/X11R6/include /usr/include/X11R6"
for i in $dirs ; do
if test -r $i/X11/Intrinsic.h; then
XINCLUDES=" -I$i"
break
fi
done
fi
AC_MSG_RESULT($XINCLUDES)
else
if test "$x_includes" != ""; then
XINCLUDES=-I$x_includes
else
XINCLUDES="# no special path needed"
fi
fi
if test -z "$XINCLUDES"; then
AC_MSG_RESULT(couldn't find any!)
XINCLUDES="# no include files found"
fi
if test "$no_x" = yes; then
AC_MSG_CHECKING(for X11 libraries)
XLIBSW=
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/X11R6/lib /usr/lib/X11R6 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
for i in $dirs ; do
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
AC_MSG_RESULT($i)
XLIBSW="-L$i -lX11"
break
fi
done
else
if test "$x_libraries" = ""; then
XLIBSW=-lX11
else
XLIBSW="-L$x_libraries -lX11"
fi
fi
if test -z "$XLIBSW" ; then
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
fi
if test -z "$XLIBSW" ; then
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_ARG_WITH(alllang, AS_HELP_STRING([--without-alllang], [Disable all languages]), with_alllang="$withval")
#--------------------------------------------------------------------
@ -1476,6 +1405,7 @@ if test -n "$RUBY"; then
esac
RUBYCCDLFLAGS=`($RUBY -rrbconfig -e 'print Config::CONFIG[["CCDLFLAGS"]]') 2>/dev/null`
RUBYSO=.`($RUBY -rrbconfig -e 'print Config::CONFIG[["DLEXT"]]') 2>/dev/null`
else
AC_MSG_RESULT(could not figure out how to run ruby)
RUBYINCLUDE="-I/usr/local/lib/ruby/1.4/arch"
@ -1493,6 +1423,7 @@ AC_SUBST(RUBYINCLUDE)
AC_SUBST(RUBYLIB)
AC_SUBST(RUBYLINK)
AC_SUBST(RUBYCCDLFLAGS)
AC_SUBST(RUBYSO)
AC_SUBST(RUBYDYNAMICLINKING)
#-------------------------------------------------------------------------