Commit 50349b0e authored by Torsten Landschoff's avatar Torsten Landschoff

Import upstream release 3.0.5 from swig-3.0.5.tar.gz

parent ecf48a2c
......@@ -50,14 +50,21 @@ matrix:
env: SWIGLANG=python SWIG_FEATURES=-builtin
- compiler: gcc
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3
- compiler: gcc
env: SWIGLANG=python SWIG_FEATURES=-classic
- compiler: gcc
env: SWIGLANG=ruby
- compiler: gcc
env: SWIGLANG=scilab
- compiler: gcc
env: SWIGLANG=tcl
allow_failures:
# Occasional gcc internal compiler error
- compiler: gcc
env: SWIGLANG=octave SWIGJOBS=-j3 VER=3.8
# Not quite working yet
- compiler: gcc
env: SWIGLANG=python SWIG_FEATURES=-classic
before_install:
- date -u
- uname -a
......@@ -79,6 +86,7 @@ before_install:
- if test "$SWIGLANG" = "python"; then git clone https://github.com/jcrocholl/pep8.git && pushd pep8 && git checkout tags/1.5.7 && python ./setup.py build && sudo python ./setup.py install && popd; fi
- if test "$SWIGLANG" = "python" -a "$PY3" -a -z "$VER"; then sudo apt-get install -qq python3-dev; fi
- if test "$SWIGLANG" = "python" -a "$VER"; then sudo add-apt-repository -y ppa:fkrull/deadsnakes && sudo apt-get -qq update && sudo apt-get -qq install python${VER}-dev && export CONFIGOPTS="--with-python${PY3}=python${VER}"; fi
- if test "$SWIGLANG" = "scilab"; then sudo apt-get -qq install scilab; fi
- if test "$SWIGLANG" = "tcl"; then sudo apt-get -qq install tcl8.4-dev; fi
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
- declare -A CFLAGS_EXAMPLES && CFLAGS_EXAMPLES=(
......@@ -95,6 +103,7 @@ before_install:
["python"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
["ruby"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
["tcl"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
["scilab"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
)
- declare -A CXXFLAGS_EXAMPLES && CXXFLAGS_EXAMPLES=(
["csharp"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
......@@ -110,6 +119,7 @@ before_install:
["python"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
["ruby"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
["tcl"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
["scilab"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
)
- $CC --version
- $CXX --version
......
*** ANNOUNCE: SWIG 3.0.4 (14 Jan 2015) ***
*** ANNOUNCE: SWIG 3.0.5 (31 Jan 2015) ***
http://www.swig.org
We're pleased to announce SWIG-3.0.4, the latest SWIG release.
We're pleased to announce SWIG-3.0.5, 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-3.0.4.tar.gz
http://prdownloads.sourceforge.net/swig/swig-3.0.5.tar.gz
A Windows version is also available at
http://prdownloads.sourceforge.net/swig/swigwin-3.0.4.zip
http://prdownloads.sourceforge.net/swig/swigwin-3.0.5.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.
......
......@@ -3,6 +3,41 @@ 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 3.0.4 (14 Jan 2015)
===========================
2015-01-12: olly
[PHP] Fix segfault in director upcall check when using PHP built with
ZTS enabled. Fixes #155, reported by Pierre Labastie.
2015-01-12: vadz
[Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments. Invalid or missing default
arguments were sometimes being generated into the python layer.
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue #284 reported
by Pawel Tomulik. Also handle "constexpr explicit" and "constexpr
static".
2015-01-08: olly
When reporting an error for a construct which hasn't been
terminated when the end of the file is reached, report it at the
start line rather than "EOF" as then tools like editors and IDEs
will take you to a generally more useful place for fixing the
problem.
2015-01-08: olly
Improve error messages for a few cases which previously gave the
one of the cryptic catch-all errors "Syntax error in input".
2015-01-08: olly
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
Version 3.0.3 (30 Dec 2014)
===========================
......
......@@ -2,37 +2,33 @@ 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 3.0.4 (14 Jan 2015)
Version 3.0.5 (31 Jan 2015)
===========================
2015-01-12: olly
[PHP] Fix segfault in director upcall check when using PHP built with
ZTS enabled. Fixes #155, reported by Pierre Labastie.
2015-01-12: vadz
[Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments. Invalid or missing default
arguments were sometimes being generated into the python layer.
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue #284 reported
by Paweł Tomulik. Also handle "constexpr explicit" and "constexpr
static".
2015-01-08: olly
When reporting an error for a construct which hasn't been
terminated when the end of the file is reached, report it at the
start line rather than "EOF" as then tools like editors and IDEs
will take you to a generally more useful place for fixing the
problem.
2015-01-08: olly
Improve error messages for a few cases which previously gave the
one of the cryptic catch-all errors "Syntax error in input".
2015-01-08: olly
Provide -cppext as a general command line option for setting the
extension used for generated C++ files (previously it was specific
to the PHP backend). Deprecate the equivalent -suffix option
provided by the Ocaml backend, but continue to support that for
now.
2015-01-30: wsfulton
[Python] Fix Python -classic and property setting. Setting properties on classic classes
was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now
by using __dict__ again when using -classic.
Fixes patch #232.
2015-01-27: smarchetto
[Scilab] Support for the Scilab language has been added
2015-01-23: olly
[PHP] When wrapping a returned resource as an object, check if all
cases wrap it in the same class, and if so eliminate the pointless
switch statement wrapper we previously generated.
2015-01-22: wsfulton
[Octave] Merge patch #297 for SF bug #1277 - Octave shared_ptr support
2015-01-15: wsfulton
[Python] Merge patch #250 - Fixes for using %constant and objects (non-primitive types)
2015-01-15: wsfulton
[C# Go] Merge patch #308 and fix #307 - C++11 strongly typed enum support
in directors
2015-01-15: wsfulton
[Python] Second fix for #294 #296 - Regression introduced in SWIG-3.0.3 when
wrapping functions with default arguments, this time when using kwargs.
......@@ -18,6 +18,7 @@ Active SWIG Developers:
David Nadlinger (code@klickverbot.at) (D)
Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
Neha Narang (narangneha03@gmail.com) (Javascript)
Simon Marchetto (simon.marchetto@scilab-enterprises.com) (Scilab)
Past SWIG developers and major contributors include:
Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
......@@ -59,9 +60,13 @@ Past SWIG developers and major contributors include:
Raman Gopalan (ramangopalan@gmail.com) (eLua)
Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL)
John Lenz (Guile, MzScheme updates, Chicken module, runtime system)
Baozeng Ding <sploving1@163.com> (Scilab)
Ian Lance Taylor (Go)
Vadim Zeitlin (PCRE)
Stefan Zager (szager@gmail.com) (Python)
Vincent Couvert (Scilab)
Sylvestre Ledru (Scilab)
Wolfgang Frisch (Scilab)
Past contributors include:
James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran
......
This diff is collapsed.
......@@ -1727,7 +1727,76 @@
</div>
<!-- INDEX -->
<h3><a href="Tcl.html#Tcl">39 SWIG and Tcl</a></h3>
<h3><a href="Scilab.html#Scilab">39 SWIG and Scilab</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="Scilab.html#Scilab_preliminaries">Preliminaries</a>
<li><a href="Scilab.html#Scilab_running_swig">Running SWIG</a>
<ul>
<li><a href="Scilab.html#Scilab_running_swig_generating_module">Generating the module</a>
<li><a href="Scilab.html#Scilab_running_swig_building_module">Building the module</a>
<li><a href="Scilab.html#Scilab_running_swig_loading_module">Loading the module</a>
<li><a href="Scilab.html#Scilab_running_swig_using_module">Using the module</a>
<li><a href="Scilab.html#Scilab_running_swig_options">Scilab command line options</a>
</ul>
<li><a href="Scilab.html#Scilab_wrapping">A basic tour of C/C++ wrapping</a>
<ul>
<li><a href="Scilab.html#Scilab_wrapping_overview">Overview</a>
<li><a href="Scilab.html#Scilab_wrapping_identifiers">Identifiers</a>
<li><a href="Scilab.html#Scilab_wrapping_functions">Functions</a>
<ul>
<li><a href="Scilab.html#Scilab_nn13">Argument passing</a>
<li><a href="Scilab.html#Scilab_nn14">Multiple output arguments</a>
</ul>
<li><a href="Scilab.html#Scilab_wrapping_global_variables">Global variables</a>
<li><a href="Scilab.html#Scilab_wrapping_constants_and_enums">Constants and enumerations</a>
<ul>
<li><a href="Scilab.html#Scilab_wrapping_constants">Constants</a>
<li><a href="Scilab.html#Scilab_wrapping_enums">Enumerations</a>
</ul>
<li><a href="Scilab.html#Scilab_wrapping_pointers">Pointers</a>
<ul>
<li><a href="Scilab.html#Scilab_wrapping_pointers_pointer_adresses">Utility functions</a>
<li><a href="Scilab.html#Scilab_wrapping_pointers_null_pointers">Null pointers</a>
</ul>
<li><a href="Scilab.html#Scilab_wrapping_structs">Structures</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_classes">C++ Classes</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_inheritance">C++ inheritance</a>
<li><a href="Scilab.html#Scilab_wrapping_pointers_references_values_arrays">Pointers, references, values, and arrays</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_templates">C++ templates</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_operators">C++ operators</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_namespaces">C++ namespaces</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_exceptions">C++ exceptions</a>
<li><a href="Scilab.html#Scilab_wrapping_cpp_stl">C++ STL</a>
</ul>
<li><a href="Scilab.html#Scilab_typemaps">Type mappings and libraries</a>
<ul>
<li><a href="Scilab.html#Scilab_typemaps_primitive_types">Default primitive type mappings</a>
<li><a href="Scilab.html#Scilab_typemaps_non-primitive_types">Default type mappings for non-primitive types</a>
<li><a href="Scilab.html#Scilab_typemaps_arrays">Arrays</a>
<li><a href="Scilab.html#Scilab_typemaps_pointer-to-pointers">Pointer-to-pointers</a>
<li><a href="Scilab.html#Scilab_typemaps_matrices">Matrices</a>
<li><a href="Scilab.html#Scilab_typemaps_stl">STL</a>
</ul>
<li><a href="Scilab.html#Scilab_module_initialization">Module initialization</a>
<li><a href="Scilab.html#Scilab_building_modes">Building modes</a>
<ul>
<li><a href="Scilab.html#Scilab_building_modes_nobuilder_mode">No-builder mode</a>
<li><a href="Scilab.html#Scilab_building_modes_builder_mode">Builder mode</a>
</ul>
<li><a href="Scilab.html#Scilab_generated_scripts">Generated scripts</a>
<ul>
<li><a href="Scilab.html#Scilab_generated_scripts_builder_script">Builder script</a>
<li><a href="Scilab.html#Scilab_generated_scripts_loader_script">Loader script</a>
</ul>
<li><a href="Scilab.html#Scilab_other_resources">Other resources</a>
</ul>
</div>
<!-- INDEX -->
<h3><a href="Tcl.html#Tcl">40 SWIG and Tcl</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
......@@ -1793,7 +1862,7 @@
</div>
<!-- INDEX -->
<h3><a href="Extending.html#Extending">40 Extending SWIG to support new languages</a></h3>
<h3><a href="Extending.html#Extending">41 Extending SWIG to support new languages</a></h3>
<!-- INDEX -->
<div class="sectiontoc">
......
This diff is collapsed.
......@@ -334,8 +334,7 @@ major features include:
</ul>
<p>
Currently, the only major C++ feature not supported is nested classes--a limitation
that should be removed in a future release, but has some workarounds for the moment.
Most of C++11 is also supported. Details are in the <a href="CPlusPlus11.html">C++11</a> section.
</p>
<p>
......
......@@ -129,6 +129,7 @@ SWIGPIKE Defined when using Pike
SWIGPYTHON Defined when using Python
SWIGR Defined when using R
SWIGRUBY Defined when using Ruby
SWIGSCILAB Defined when using Scilab
SWIGSEXP Defined when using S-expressions
SWIGTCL Defined when using Tcl
SWIGXML Defined when using XML
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3614,18 +3614,52 @@ and the second will take two integer arguments.
</p>
<p>
Needless to say, SWIG's template support provides plenty of
opportunities to break the universe. That said, an important final
point is that <b>SWIG does not perform extensive error checking of
templates!</b> Specifically, SWIG does not perform type checking nor
does it check to see if the actual contents of the template
declaration make any sense. Since the C++ compiler will hopefully
check this when it compiles the resulting wrapper file, there is no
practical reason for SWIG to duplicate this functionality (besides,
none of the SWIG developers are masochistic enough to want to
implement this right now).
Needless to say, SWIG's template support provides plenty of opportunities to
break the universe. That said, an important final point is that <b>SWIG does
not perform extensive error checking of templates!</b> Specifically, SWIG does
not perform type checking nor does it check to see if the actual contents of the
template declaration make any sense. Since the C++ compiler checks this when it
compiles the resulting wrapper file, there is no practical reason for SWIG to
duplicate this functionality.
</p>
<a name="SWIGPlus_template_nested_class_example"></a>
<p>
As SWIG's template support does not perform type checking <tt>%template</tt>
can be used as early as after a template declaration. You can, and rarely have
to, use <tt>%template</tt> before the template parameters have been declared.
For example:
</p>
<div class="code">
<pre>
template &lt;class T&gt; class OuterTemplateClass {};
// The nested class OuterClass::InnerClass inherits from the template class
// OuterTemplateClass&lt;OuterClass::InnerStruct&gt; and thus the template needs
// to be expanded with %template before the OuterClass declaration.
%template(OuterTemplateClass_OuterClass__InnerStruct)
OuterTemplateClass&lt;OuterClass::InnerStruct&gt;
// Don't forget to use %feature("flatnested") for OuterClass::InnerStruct and
// OuterClass::InnerClass if the target language doesn't support nested classes.
class OuterClass {
public:
// Forward declarations:
struct InnerStruct;
class InnerClass;
};
struct OuterClass::InnerStruct {};
// Expanding the template at this point with %template is too late as the
// OuterClass::InnerClass declaration is processed inside OuterClass.
class OuterClass::InnerClass : public OuterTemplateClass&lt;InnerStruct&gt; {};
</pre>
</div>
<p>
<b>Compatibility Note</b>: The first implementation of template support relied heavily on
macro expansion in the preprocessor. Templates have been more tightly integrated into
......@@ -5000,6 +5034,12 @@ class Bar {
</pre>
</div>
<p>
If a nested class, within an outer class, has to be used as a template parameter within the outer class, then the template will
have to be instantiated with <tt>%template</tt> before the beginning of the outer class.
An example can be found in the
<a href="#SWIGPlus_template_nested_class_example">Templates</a> section.
</p>
<p>
<b>Compatibility Note:</b>
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
<body bgcolor="#ffffff">
<H1><a name="Sections"></a>SWIG-3.0 Documentation</H1>
Last update : SWIG-3.0.4 (14 Jan 2015)
Last update : SWIG-3.0.5 (31 Jan 2015)
<H2>Sections</H2>
......@@ -55,6 +55,7 @@ Last update : SWIG-3.0.4 (14 Jan 2015)
<li><a href="Python.html#Python">Python support</a></li>
<li><a href="R.html#R">R support</a></li>
<li><a href="Ruby.html#Ruby">Ruby support</a></li>
<li><a href="Scilab.html#Scilab">Scilab support</a></li>
<li><a href="Tcl.html#Tcl">Tcl support</a></li>
</ul>
......
This diff is collapsed.
......@@ -349,9 +349,9 @@ These can be overridden using command line options, for example:
<div class="shell"><pre>
$ swig -python -Fstandard example.i
example.i:4: Syntax error in input.
example.i:4: Syntax error in input(1).
$ swig -python -Fmicrosoft example.i
example.i(4) : Syntax error in input.
example.i(4) : Syntax error in input(1).
</pre></div>
<H2><a name="Warnings_nn9"></a>15.9 Warning number reference</H2>
......
......@@ -36,5 +36,6 @@ Pike.html
Python.html
R.html
Ruby.html
Scilab.html
Tcl.html
Extending.html
......@@ -596,7 +596,7 @@ java_cpp: $(SRCDIR_SRCS)
# ----------------------------------------------------------------
java_compile: $(SRCDIR_SRCS)
$(COMPILETOOL) $(JAVAC) $(JAVACFLAGS) $(addprefix $(SRCDIR),$(JAVASRCS))
$(COMPILETOOL) $(JAVAC) $(addprefix $(SRCDIR),$(JAVASRCS))
# -----------------------------------------------------------------
# Run java example
......@@ -1665,7 +1665,6 @@ endif
# ----------------------------------------------------------------
# Build a R dynamically loadable module (C++)
# ----------------------------------------------------------------
r_cpp: $(SRCDIR_CXXSRCS)
$(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH)
ifneq ($(SRCDIR_CXXSRCS),)
......@@ -1697,6 +1696,57 @@ r_clean:
rm -f *.@OBJEXT@ *@SO@ NAMESPACE
rm -f $(RRSRC) $(RUNME).Rout .RData
##################################################################
##### SCILAB ######
##################################################################
SCILAB = @SCILAB@
SCILAB_INC= @SCILABINCLUDE@
SCILAB_OPT = @SCILABOPT@
SCILAB_LIBPREFIX = lib
# ----------------------------------------------------------------
# Build a C dynamically loadable module
# ----------------------------------------------------------------
scilab:
$(SWIG) -scilab $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SCILAB_INC) $(INCLUDES) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)
# ----------------------------------------------------------------
# Build a C++ dynamically loadable module
# ----------------------------------------------------------------
scilab_cpp:
$(SWIG) -c++ -scilab $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SCILAB_INC) $(INCLUDES) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(IOBJS) $(OBJS) $(LIBS) $(CPP_DLLIBS) -o $(SCILAB_LIBPREFIX)$(TARGET)$(SO)
# -----------------------------------------------------------------
# Running a Scilab example
# -----------------------------------------------------------------
scilab_run:
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(SCILAB) $(SCILAB_OPT) -f $(SRCDIR)$(RUNME).sci $(RUNPIPE)
# -----------------------------------------------------------------
# Scilab version
# -----------------------------------------------------------------
scilab_version:
echo `$(SCILAB) -version | head -1`
# -----------------------------------------------------------------
# Cleaning the scilab examples
# -----------------------------------------------------------------
scilab_clean:
rm -f *_wrap* *~ .~*
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@SO@
rm -f *.sce
##################################################################
##### Go ######
##################################################################
......
# see top-level Makefile.in
class
constants
contract
enum
funcptr
matrix
matrix2
pointer
simple
std_list
std_vector
struct
template
variables
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
build:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
/* File : example.cxx */
#include "example.h"
#define M_PI 3.14159265358979323846
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area() {
return M_PI*radius*radius;
}
double Circle::perimeter() {
return 2*M_PI*radius;
}
double Square::area() {
return width*width;
}
double Square::perimeter() {
return 4*width;
}
/* File : example.h */
class Shape {
public:
Shape() {
nshapes++;
}
virtual ~Shape() {
nshapes--;
}
double x, y;
void move(double dx, double dy);
virtual double area() = 0;
virtual double perimeter() = 0;
static int nshapes;
};
class Circle : public Shape {
private:
double radius;
public:
Circle(double r) : radius(r) { }
virtual double area();
virtual double perimeter();
};
class Square : public Shape {
private:
double width;
public:
Square(double w) : width(w) { }
virtual double area();
virtual double perimeter();
};
/* File : example.i */
%module example