diff --git a/.gitignore b/.gitignore
index c29287f6caa..bd8a875355c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,7 +47,6 @@ CCache/autom4te.cache/
CCache/config.h.in
CCache/configure
Source/Include/swigconfig.h.in
-Source/Include/swigconfig.h.in~
Source/Makefile.in
Tools/config/compile
Tools/config/config.guess
@@ -85,8 +84,6 @@ swig.spec
# Build Artifacts
.dirstamp
CCache/ccache-swig
-CCache/ccache-swig.1
-CCache/web/ccache-man.html
Lib/swigwarn.swg
Source/CParse/parser.c
Source/CParse/parser.h
@@ -96,46 +93,67 @@ swig
Tools/javascript/javascript
# Generated documentation
-Doc/Manual/CCache.html
Doc/Manual/SWIGDocumentation.html
Doc/Manual/SWIGDocumentation.pdf
Doc/Manual/*.book
-# Test Suite Generated Files
-Examples/test-suite/allegrocl/*/
-Examples/test-suite/cffi/*/
-Examples/test-suite/chicken/*/
-Examples/test-suite/clisp/*/
-Examples/test-suite/csharp/*/
-Examples/test-suite/d/*/
-Examples/test-suite/go/*/
-Examples/test-suite/guile/*/
-Examples/test-suite/java/*/
-Examples/test-suite/javascript/*/
-Examples/test-suite/lua/*/
-Examples/test-suite/mzscheme/*/
-Examples/test-suite/ocaml/*/
-Examples/test-suite/octave/*/
-Examples/test-suite/perl5/*/
-Examples/test-suite/php/*/
-Examples/test-suite/pike/*/
-Examples/test-suite/python/*/
-Examples/test-suite/r/*/
-Examples/test-suite/ruby/*/
-Examples/test-suite/tcl/*/
-Examples/test-suite/uffi/*/
+# SWIG common generated files
*_wrap.c
+*_wrap.cpp
*_wrap.cxx
+*_wrap.h
*-gypcopy.cxx
-# C# generated files
-*_runme.exe.mdb
-*_runme.exe
+# Scratch directories
+Examples/scratch
+
+# Out of source tree build directories
+*build*/
+
+# errors test-suite
+Examples/test-suite/errors/*.newerr
+Examples/test-suite/errors/*.py
+
+########## Language specific files ##########
+
+# C#
+Examples/test-suite/csharp/*/
+*runme.exe.mdb
+*runme.exe
+Examples/csharp/*/*.cs
+!Examples/csharp/*/runme.cs
+
+# D
+Examples/test-suite/d/*/
+Examples/d/**/example.d
+Examples/d/**/example_im.d
+Examples/d/**/runme
+
+# Go
+*.[5689]
+*_gc.c
+Examples/test-suite/go/*.go
+!Examples/test-suite/go/*runme.go
+Examples/test-suite/go/*runme
+Examples/test-suite/go/gopath
+Examples/test-suite/go/testdir
+Examples/go/*/gopath
+Examples/go/*/example.go
+Examples/go/*/runme
+
+# Guile
+Examples/guile/*/my-guile
+
+# Java
+Examples/test-suite/java/*/
+Examples/java/*/*.java
+!Examples/java/*/runme.java
-# Javascript generated files
+# Javascript
+Examples/test-suite/javascript/*/
*.gyp
-# Matlab generated files
+# Matlab
*.mex*
# module directories
[+]*/
@@ -143,22 +161,44 @@ Examples/test-suite/uffi/*/
SwigRef.m
SwigMem.m
-# Octave generated files
+# Octave
swigexample*.oct
Examples/test-suite/octave/*.oct
-# Python generated files, based on:
-# https://github.com/github/gitignore/blob/master/Python.gitignore
+# Perl5
+Examples/test-suite/perl5/*.pm
+Examples/perl5/*/*.pm
+
+# PHP
+Examples/test-suite/php/php_*.h
+Examples/test-suite/php/*.php
+!Examples/test-suite/php/*runme.php
+!Examples/test-suite/php/skel.php
+Examples/php/*/php_*.h
+Examples/php/*/example.php
+
+# Python
+# Based on https://github.com/github/gitignore/blob/master/Python.gitignore
*.py[cod]
*/__pycache__/
/__pycache__/
+Examples/test-suite/python/*.py
+!Examples/test-suite/python/*runme.py
+Examples/python/*/example.py
+Examples/python/**/bar.py
+Examples/python/**/base.py
+Examples/python/**/foo.py
+Examples/python/**/spam.py
+
+# R
+Examples/test-suite/r/*.R
+Examples/test-suite/r/*.Rout
+!Examples/test-suite/r/*runme.R
+Examples/r/*/example.R
+Examples/r/*/*.Rout
+Examples/r/*/.RData
+
+# Scilab
+Examples/test-suite/scilab/*/
+loader.sce
-# Go generated files
-*.[5689]
-*_gc.c
-
-# Scratch directories
-Examples/scratch
-
-# Out of source tree build directories
-*build*/
diff --git a/.travis.yml b/.travis.yml
index 3a726db3e77..6bf3e3c372c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,121 +1,188 @@
language: cpp
-compiler:
- - clang
- - gcc
-env:
- - SWIGLANG=
matrix:
include:
- - compiler: gcc
+ - compiler: clang
+ os: linux
+ env: SWIGLANG=
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=
+ - os: linux
+ env: SWIGLANG= SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ - os: linux
+ env: SWIGLANG= SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP14=1
+ - compiler: gcc
+ os: linux
env: SWIGLANG=csharp
- compiler: gcc
+ os: linux
env: SWIGLANG=d
- compiler: gcc
+ os: linux
env: SWIGLANG=go
- compiler: gcc
+ os: linux
env: SWIGLANG=guile
- compiler: gcc
+ os: linux
env: SWIGLANG=java
- compiler: gcc
+ os: linux
env: SWIGLANG=javascript ENGINE=node
- compiler: gcc
+ os: linux
env: SWIGLANG=javascript ENGINE=jsc
- compiler: gcc
+ os: linux
env: SWIGLANG=javascript ENGINE=v8
- compiler: gcc
+ os: linux
env: SWIGLANG=lua
- compiler: gcc
- env: SWIGLANG=octave SWIGJOBS=-j3 # 3.2
+ os: linux
+ env: SWIGLANG=octave SWIGJOBS=-j2 # 3.2
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=octave SWIGJOBS=-j2 VER=3.8
- compiler: gcc
- env: SWIGLANG=octave SWIGJOBS=-j3 VER=3.8
+ os: linux
+ env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.0
- compiler: gcc
+ os: linux
env: SWIGLANG=perl5
- compiler: gcc
+ os: linux
env: SWIGLANG=php
- compiler: gcc
+ os: linux
env: SWIGLANG=python VER=2.4
- compiler: gcc
+ os: linux
env: SWIGLANG=python VER=2.5
- compiler: gcc
+ os: linux
env: SWIGLANG=python VER=2.6
- compiler: gcc
+ os: linux
env: SWIGLANG=python # 2.7
- compiler: gcc
+ os: linux
env: SWIGLANG=python PY3=3 # 3.2
- compiler: gcc
+ os: linux
env: SWIGLANG=python PY3=3 VER=3.3
- compiler: gcc
+ os: linux
env: SWIGLANG=python PY3=3 VER=3.4
- compiler: gcc
+ os: linux
+ env: SWIGLANG=python PY3=3 VER=3.5
+ - compiler: gcc
+ os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin
- compiler: gcc
+ os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3
- compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-O
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-classic
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=r
+ - compiler: gcc
+ os: linux
env: SWIGLANG=ruby
- compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.3.0
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=scilab
+ - compiler: gcc
+ os: linux
env: SWIGLANG=tcl
+ - os: linux
+ env: SWIGLANG=csharp SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ - os: linux
+ env: SWIGLANG=java SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ - os: linux
+ env: SWIGLANG=python SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ - os: osx
+ env: SWIGLANG= SWIG_CC=gcc-4.2 SWIG_CXX=g++-4.2
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=csharp
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=go
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=guile
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=java
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=lua
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=perl5
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=php
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=python
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=python PY3=3
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=ruby
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=tcl
+
allow_failures:
- # Occasional gcc internal compiler error
+ # Lots of failing tests currently
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ocaml
+ # Not quite working yet
- compiler: gcc
- env: SWIGLANG=octave SWIGJOBS=-j3 VER=3.8
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-O
before_install:
- date -u
- uname -a
- - lsb_release -a
- - sudo apt-get -qq update
- - time sudo apt-get -qq install libboost-dev
- - if test -z "$SWIGLANG"; then sudo apt-get -qq install yodl; fi
- - if test "$SWIGLANG" = "csharp"; then sudo apt-get -qq install mono-devel; fi
- - if test "$SWIGLANG" = "d"; then wget http://downloads.dlang.org/releases/2014/dmd_2.066.0-0_amd64.deb; sudo dpkg -i dmd_2.066.0-0_amd64.deb; fi
- - if test "$SWIGLANG" = "go"; then go env | sed -e 's/^/export /' > goenvsetup && source goenvsetup && rm -f goenvsetup; fi # Until configure.ac is fixed
- - if test "$SWIGLANG" = "javascript" -a "$ENGINE" = "node"; then sudo apt-get install -qq rlwrap python-software-properties && echo 'yes' | sudo add-apt-repository ppa:chris-lea/node.js && sudo apt-get -qq update && sudo apt-get install -qq nodejs && sudo npm install -g node-gyp; fi
- - if test "$SWIGLANG" = "javascript" -a "$ENGINE" = "jsc"; then sudo apt-get install -qq libwebkitgtk-dev; fi
- - if test "$SWIGLANG" = "javascript" -a "$ENGINE" = "v8"; then sudo apt-get install -qq libv8-dev; fi
- - if test "$SWIGLANG" = "guile"; then sudo apt-get -qq install guile-2.0-dev; fi
- - if test "$SWIGLANG" = "lua"; then sudo apt-get -qq install lua5.1 liblua5.1-dev; fi
- - if test "$SWIGLANG" = "octave" -a -z "$VER"; then sudo apt-get -qq install octave3.2 octave3.2-headers; fi
- - if test "$SWIGLANG" = "octave" -a "$VER"; then sudo add-apt-repository -y ppa:kwwette/octaves && sudo apt-get -qq update && sudo apt-get -qq install liboctave${VER}-dev; fi
- - if test "$SWIGLANG" = "php"; then sudo apt-get install php5-cli php5-dev; fi
- - 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" = "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=(
- ["csharp"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["d"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["go"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["guile"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["java"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["javascript"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["lua"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["octave"]="-Werror -std=gnu89 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["perl5"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["php"]="-Werror -std=gnu89 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["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"
- )
- - declare -A CXXFLAGS_EXAMPLES && CXXFLAGS_EXAMPLES=(
- ["csharp"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["d"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["go"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["guile"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["java"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["javascript"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["lua"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["octave"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["perl5"]="-Werror -std=c++98 -fdiagnostics-show-option -Wno-long-long -Wreturn-type"
- ["php"]="-Werror -std=c++98 -fdiagnostics-show-option -pedantic -Wno-long-long -Wreturn-type"
- ["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"
- )
+ - if test "$TRAVIS_OS_NAME" = "linux"; then lscpu && cat /proc/cpuinfo | grep "model name" && cat /proc/meminfo | grep MemTotal; fi
+ - if test "$TRAVIS_OS_NAME" = "osx"; then sysctl -a | grep brand_string; fi
+ # Travis overrides CC environment with compiler predefined values
+ - if test -n "$SWIG_CC"; then export CC="$SWIG_CC"; fi
+ - if test -n "$SWIG_CXX"; then export CXX="$SWIG_CXX"; fi
+install:
+ - if test "$TRAVIS_OS_NAME" = "linux"; then source Tools/travis-linux-install.sh; fi
+ - if test "$TRAVIS_OS_NAME" = "osx"; then source Tools/travis-osx-install.sh; fi
+ - if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++11 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++11; fi
+ - if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++14 -Wall -Wextra" "CFLAGS=-std=c11 -Wall -Wextra") && export CSTD=c11 && export CPPSTD=c++14; fi
+ - ls -la $(which $CC)
+ - ls -la $(which $CXX)
- $CC --version
- $CXX --version
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
- - ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure $CONFIGOPTS
+ - if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
+ - echo "${CONFIGOPTS[@]}"
+ - ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
- echo -en 'travis_fold:end:script.1\\r'
- make -s $SWIGJOBS
- ./swig -version && ./swig -pcreversion
@@ -124,9 +191,13 @@ script:
- echo 'Installing...' && echo -en 'travis_fold:start:script.2\\r'
- if test -z "$SWIGLANG"; then sudo make -s install && swig -version && ccache-swig -V; fi
- echo -en 'travis_fold:end:script.2\\r'
+ # Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
+ - if test -n "$SWIGLANG"; then cflags=$($TRAVIS_BUILD_DIR/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC) && echo $cflags; fi
+ - if test -n "$SWIGLANG"; then cxxflags=$($TRAVIS_BUILD_DIR/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC) && echo $cxxflags; fi
- if test -n "$SWIGLANG"; then make -s check-$SWIGLANG-version; fi
- - if test -n "$SWIGLANG"; then make -k $SWIGJOBS check-$SWIGLANG-examples CFLAGS="${CFLAGS_EXAMPLES[$SWIGLANG]}" CXXFLAGS="${CXXFLAGS_EXAMPLES[$SWIGLANG]}"; fi
- - if test -n "$SWIGLANG"; then make -k $SWIGJOBS check-$SWIGLANG-test-suite; fi
+ - if test -n "$SWIGLANG"; then make check-$SWIGLANG-enabled; fi
+ - if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
+ - if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
- echo 'Cleaning...' && echo -en 'travis_fold:start:script.3\\r'
- make check-maintainer-clean && ../../configure $CONFIGOPTS
- echo -en 'travis_fold:end:script.3\\r'
diff --git a/ANNOUNCE b/ANNOUNCE
index e3792cc95ce..b06aa53d283 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 3.0.5 (in progress) ***
+*** ANNOUNCE: SWIG 3.0.9 (in progress) ***
http://www.swig.org
-We're pleased to announce SWIG-3.0.5, the latest SWIG release.
+We're pleased to announce SWIG-3.0.9, the latest SWIG release.
What is SWIG?
=============
@@ -11,21 +11,27 @@ SWIG is a software development tool that reads C/C++ header files and
generates the wrapper code needed to make C and C++ code accessible
from other programming languages including Perl, Python, Tcl, Ruby,
PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme, CHICKEN),
-D, Ocaml, Pike, Modula-3, Octave, R, Common Lisp (CLISP, Allegro CL,
-CFFI, UFFI). SWIG can also export its parse tree in the form of XML
-and Lisp s-expressions. Major applications of SWIG include generation
-of scripting language extension modules, rapid prototyping, testing,
-and user interface development for large C/C++ systems.
+D, Ocaml, Pike, Modula-3, Octave, R, Scilab, Common Lisp (CLISP,
+Allegro CL, CFFI, UFFI). SWIG can also export its parse tree in
+the form of XML and Lisp s-expressions. Major applications of SWIG
+include generation of scripting language extension modules, rapid
+prototyping, testing, and user interface development for large
+C/C++ systems.
+
+Release Notes
+=============
+Detailed release notes are available with the release and are also
+published on the SWIG web site at http://swig.org/release.html.
Availability
============
The release is available for download on Sourceforge at
- http://prdownloads.sourceforge.net/swig/swig-3.0.5.tar.gz
+ http://prdownloads.sourceforge.net/swig/swig-3.0.9.tar.gz
A Windows version is also available at
- http://prdownloads.sourceforge.net/swig/swigwin-3.0.5.zip
+ http://prdownloads.sourceforge.net/swig/swigwin-3.0.9.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.
diff --git a/CCache/Makefile.in b/CCache/Makefile.in
index 6cded08d4bd..67fd3f36384 100644
--- a/CCache/Makefile.in
+++ b/CCache/Makefile.in
@@ -43,17 +43,21 @@ $(srcdir)/$(PACKAGE_NAME).1: $(srcdir)/ccache.yo
$(srcdir)/web/ccache-man.html: $(srcdir)/ccache.yo
yodl2html -o $(srcdir)/web/ccache-man.html $(srcdir)/ccache.yo
-install: $(PACKAGE_NAME)$(EXEEXT) $(srcdir)/$(PACKAGE_NAME).1
+install: $(PACKAGE_NAME)$(EXEEXT)
@echo "Installing $(PACKAGE_NAME)"
@echo "Installing $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)"
${INSTALLCMD} -d $(DESTDIR)${bindir}
${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+
+install-docs: $(srcdir)/$(PACKAGE_NAME).1
@echo "Installing $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1"
${INSTALLCMD} -d $(DESTDIR)${mandir}/man1
${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
-uninstall: $(PACKAGE_NAME)$(EXEEXT) $(srcdir)/$(PACKAGE_NAME).1
+uninstall: $(PACKAGE_NAME)$(EXEEXT)
rm -f $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+
+uninstall-docs: $(srcdir)/$(PACKAGE_NAME).1
rm -f $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
clean:
diff --git a/CCache/test.sh b/CCache/test.sh
index f64c3e3de6c..438e782cd84 100755
--- a/CCache/test.sh
+++ b/CCache/test.sh
@@ -15,6 +15,11 @@ else
SWIG=swig
fi
+# fix: Remove ccache from $PATH if it exists
+# as it will influence the unit tests
+PATH="`echo $PATH | \
+ sed -e 's!:/usr\(/local\)*/lib\([0-9]\)*/ccache\(/\)*!!g'`"
+
CCACHE=../ccache-swig
TESTDIR=test.$$
@@ -402,6 +407,29 @@ swigtests() {
rm -rf $TESTDIR
mkdir $TESTDIR
cd $TESTDIR || exit 1
+
+unset CCACHE_DIR
+unset CCACHE_TEMPDIR
+unset CCACHE_LOGFILE
+unset CCACHE_VERBOSE
+unset CCACHE_PATH
+unset CCACHE_CC
+unset CCACHE_PREFIX
+unset CCACHE_DISABLE
+unset CCACHE_READONLY
+unset CCACHE_CPP2
+unset CCACHE_NOCOMPRESS
+unset CCACHE_NOSTATS
+unset CCACHE_NLEVELS
+unset CCACHE_HARDLINK
+unset CCACHE_RECACHE
+unset CCACHE_UMASK
+unset CCACHE_HASHDIR
+unset CCACHE_UNIFY
+unset CCACHE_EXTENSION
+unset CCACHE_STRIPC
+unset CCACHE_SWIG
+
CCACHE_DIR="ccache dir" # with space in directory name (like Windows default)
mkdir "$CCACHE_DIR"
export CCACHE_DIR
diff --git a/CHANGES b/CHANGES
index 9c64f9c75e8..1982307756f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,514 @@ 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.8 (31 Dec 2015)
+===========================
+
+2015-12-30: wsfulton
+ The pdf documentation is now generated by wkhtmltopdf and has colour
+ for the code snippets just like the html documentation!
+
+2015-12-23: ahnolds
+ [Python] Fixes for conversion of signed and unsigned integer types:
+
+ No longer check for PyInt objects in Python3. Because PyInt_Check
+ and friends are #defined to the corresponding PyLong methods, this
+ had caused errors in Python3 where values greater than what could be
+ stored in a long were incorrectly interpreted as the value -1 with
+ the Python error indicator set to OverflowError. This applies to
+ both the conversions PyLong->long and PyLong->double.
+
+ Conversion from PyLong to long, unsigned long, long long, and
+ unsigned long long now raise OverflowError instead of TypeError in
+ both Python2 and Python3 for PyLong values outside the range
+ expressible by the corresponding C type. This matches the existing
+ behavior for other integral types (signed and unsigned ints, shorts,
+ and chars), as well as the conversion for PyInt to all numeric
+ types. This also indirectly applies to the size_t and ptrdiff_t
+ types, which depend on the conversions for unsigned long and long.
+
+2015-12-19: wsfulton
+ [Python] Python 2 Unicode UTF-8 strings can be used as inputs to char * or
+ std::string types if the generated C/C++ code has SWIG_PYTHON_2_UNICODE defined.
+
+2015-12-17: wsfulton
+ Issues #286, #128
+ Remove ccache-swig.1 man page - please use the CCache.html docs instead.
+ The yodl2man and yodl2html tools are no longer used and so SWIG no
+ longer has a dependency on these packages which were required when
+ building from git.
+
+2015-12-16: zturner/coleb
+ [Python] Fix Python3.5 interpreter assertions when objects are being
+ deleted due to an existing exception. Most notably in generators
+ which terminate using a StopIteration exception. Fixes #559 #560 #573.
+ If a further exception is raised during an object destruction,
+ PyErr_WriteUnraisable is used on this second exception and the
+ original exception bubbles through.
+
+2015-12-14: ahnolds/wsfulton
+ [Python] Add in missing initializers for tp_finalize,
+ nb_matrix_multiply, nb_inplace_matrix_multiply, ht_qualname
+ ht_cached_keys and tp_prev.
+
+2015-12-12: wsfulton
+ Fix STL wrappers to not generate <: digraphs.
+ For example std::vector<::X::Y> was sometimes generated, now
+ corrected to std::vector< ::X::Y >.
+
+2015-11-25: wsfulton
+ [Ruby] STL ranges and slices fixes.
+
+ Ruby STL container setting slices fixes:
+
+ Setting an STL container wrapper slice better matches the way Ruby
+ arrays work. The behaviour is now the same as Ruby arrays. The only
+ exception is the default value used when expanding a container
+ cannot be nil as this is not a valid type/value for C++ container
+ elements.
+
+ Obtaining a Ruby STL container ranges and slices fixes:
+
+ Access via ranges and slices now behave identically to Ruby arrays.
+ The fixes are mostly for out of range indices and lengths.
+ - Zero length slice requests return an empty container instead of nil.
+ - Slices which request a length greater than the size of the container
+ no longer chop off the last element.
+ - Ranges which used to return nil now return an empty array when the
+ the start element is a valid index.
+
+ Ruby STL container negative indexing support improved.
+
+ Using negative indexes to set values works the same as Ruby arrays, eg
+
+ %template(IntVector) std::vector;
+
+ iv = IntVector.new([1,2,3,4])
+ iv[-4] = 9 # => [1,2,3,9]
+ iv[-5] = 9 # => IndexError
+
+2015-11-21: wsfulton
+ [Ruby, Python] Add std::array container wrappers.
+
+ These work much like any of the other STL containers except Python/Ruby slicing
+ is somewhat limited because the array is a fixed size. Only slices of
+ the full size are supported.
+
+2015-10-10: wsfulton
+ [Python] #539 - Support Python 3.5 and -builtin. PyAsyncMethods is a new
+ member in PyHeapTypeObject.
+
+2015-10-06: ianlancetaylor
+ [Go] Don't emit a constructor function for a director
+ class with an abstract method, since the function will
+ always panic.
+
+2015-10-01: wsfulton
+ Fix %shared_ptr support for private and protected inheritance.
+ - Remove unnecessary Warning 520: Derived class 'Derived' of 'Base'
+ is not similarly marked as a smart pointer
+ - Do not generate code that attempts to cast up the inheritance chain in the
+ type system runtime in such cases as it doesn't compile and can't be used.
+ Remove unnecessary warning 520 for %shared_ptr when the base class is ignored.
+
+2015-10-01: vkalinin
+ Fix #508: Fix segfault parsing anonymous typedef nested classes.
+
+2015-09-26: wsfulton
+ [Ruby] Add shared_ptr support
+
+2015-09-13: kkaempf
+ [Ruby] Resolve tracking bug - issue #225.
+ The bug is that the tracking code uses a ruby hash and thus may
+ allocate objects (Bignum) while running the GC. This was tolerated in
+ 1.8 but is invalid (raises an exception) in 1.9.
+ The patch uses a C hash (also used by ruby) instead.
+
+2015-09-09: lyze
+ [CFFI] Extend the "export" feature in the CFFI module to support
+ exporting to a specified package.
+
+2015-09-04: olly
+ [Python] Fix docstrings for %callback functions.
+
+2015-09-03: demi-rluddy
+ [Go] Removed golang stringing for signed/unsigned char
+
+ Changed default handling of signed char* and unsigned char* to be
+ opaque pointers rather than strings, similarly to how other
+ languages work.
+
+ Any existing code relying on treating signed char* or unsigned
+ char* as a string can restore the old behavior with typemaps.i by
+ using %apply to copy the [unchanged] char* behavior.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2015-08-07: talby
+ [Perl] tidy -Wtautological-constant-out-of-range-compare warnings when building generated code under clang
+
+2015-08-07: xantares
+ [Python] pep257 & numpydoc conforming docstrings:
+ - Mono-line module docsstring
+ - Rewrite autodoc parameters section in numpydoc style:
+ https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
+ - One line summary should end with "."
+ - Adds a blank line after class docstring
+
+2015-08-05: vadz
+ [Java] Make (char* STRING, size_t LENGTH) typemaps usable for
+ strings of other types, e.g. "unsigned char*".
+
+Version 3.0.7 (3 Aug 2015)
+==========================
+
+2015-08-02: wsfulton
+ [Java] Fix potential security exploit in generated Java classes.
+ The swigCPtr and swigCMemOwn member variables in the generated Java
+ classes are now declared 'transient' by default. Further details of the exploit
+ in Android is being published in an academic paper as part of USENIX WOOT '15:
+ https://www.usenix.org/conference/woot15/workshop-program/presentation/peles.
+
+ In the unlikely event that you are relying on these members being serializable,
+ then you will need to override the default javabody and javabody_derived typemaps
+ to generate the old generated code. The relevant typemaps are in the Lib directory
+ in the java.swg, boost_shared_ptr.i and boost_intrusive_ptr.i files. Copy the
+ relevant default typemaps into your interface file and remove the 'transient' keyword.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2015-08-01: vadz
+ Make configure --without-alllang option more useful: it can now be overridden by the following
+ --with-xxx options, allowing to easily enable just one or two languages.
+
+2015-07-30: wsfulton
+ Fix #440 - Initialise all newly created arrays when using %array_functions and %array_class
+ in the carrays.i library - bug is only relevant when using C++.
+
+2015-07-29: wsfulton
+ [Python] Improve indentation warning and error messages for code in the following directives:
+
+ %pythonprepend
+ %pythonappend
+ %pythoncode
+ %pythonbegin
+ %feature("shadow")
+
+ Old error example:
+ Error: Line indented less than expected (line 3 of pythoncode)
+
+ New error example:
+ Error: Line indented less than expected (line 3 of %pythoncode or %insert("python") block)
+ as no line should be indented less than the indentation in line 1
+
+ Old warning example:
+ Warning 740: Whitespace prefix doesn't match (line 2 of %pythoncode or %insert("python") block)
+
+ New warning example:
+ Warning 740: Whitespace indentation is inconsistent compared to earlier lines (line 3 of
+ %pythoncode or %insert("python") block)
+
+
+2015-07-28: wsfulton
+ [Python] Fix #475. Improve docstring indentation handling.
+
+ SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring feature.
+ This occurred when the indentation (whitespace) in the docstring was less in the
+ second or later lines when compared to the first line.
+ SWIG-3.0.6 gave a 'Line indented less than expected' error instead of truncating
+ the docstring text.
+ Now the indentation for the 'docstring' feature is smarter and is appropriately
+ adjusted so that no truncation occurs.
+
+2015-07-22: wsfulton
+ Support for special variable expansion in typemap attributes. Example usage expansion
+ in the 'out' attribute (C# specific):
+
+ %typemap(ctype, out="$*1_ltype") unsigned int& "$*1_ltype"
+
+ is equivalent to the following as $*1_ltype expands to 'unsigned int':
+
+ %typemap(ctype, out="unsigned int") unsigned int& "unsigned int"
+
+ Special variables can be used within special variable macros too. Example usage expansion:
+
+ %typemap(cstype) unsigned int "uint"
+ %typemap(cstype, out="$typemap(cstype, $*1_ltype)") unsigned int& "$typemap(cstype, $*1_ltype)"
+
+ Special variables are expanded first and hence the above is equivalent to:
+
+ %typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
+
+ which then expands to:
+
+ %typemap(cstype, out="uint") unsigned int& "uint"
+
+2015-07-22: lindleyf
+ Apply patch #439 - support for $typemap() (aka embedded typemaps or special variable
+ macros) in typemap attributes. A simple example where $typemap() is expanded in the
+ 'out' attribute (C# specific):
+
+ %typemap(cstype) unsigned int "uint"
+ %typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
+
+ is equivalent to:
+
+ %typemap(cstype, out="uint") unsigned int& "uint"
+
+2015-07-18: m7thon
+ [Python] Docstrings provided via %feature("docstring") are now quoted and added to
+ the tp_doc slot when using python builtin classes (-builtin). When no docstring is
+ provided, the tp_doc slot is set to the fully qualified C/C++ class name.
+ Github issues #445 and #461.
+
+2015-07-17: kwwette
+ [octave] Support Octave version 4.0.0 (thanks to patches from Orion Poplawski).
+
+2015-07-07: wsfulton
+ SWIG no longer generates a wrapper for a class' constructor if that class has
+ any base class with a private destructor. This is because your compiler should
+ not allow a class to be instantiated if a base has a private destructor. Some
+ compilers do, so if you need the old behaviour, use the "notabstract" feature, eg:
+
+ %feature("notabstract") Derived;
+ class Base {
+ ~Base() {}
+ };
+ struct Derived : Base {};
+
+Version 3.0.6 (5 Jul 2015)
+==========================
+
+2015-07-02: wsfulton
+ Fix syntax error when the template keyword is used in types, eg:
+
+ std::template vector v;
+
+2015-07-02: ngladitz
+ [Lua] Push characters as unformatted 1-character strings to avoid
+ unprintable characters such as (char)127 being converted to
+ "<\127>" with Lua 5.3 and later. (github PR #452)
+
+2015-06-29: olly
+ [Python] Improve handling of whitespace in %pythoncode.
+
+ Previously SWIG looked at the indentation of the first line and
+ removed that many characters from each subsequent line, regardless
+ of what those characters were. This was made worse because SWIG's
+ preprocessor removes any whitespace before a '#'. Fixes github
+ issue #379, reported by Joe Orton.
+
+2015-06-12: wsfulton
+ [R] Fix #430 - call to SWIG_createNewRef in copyToC was incorrectly named.
+
+2015-06-11: sghirate
+ [C#] Patch #427 adds in new command line option -outfile to combine all the
+ generated C# code into a single file.
+
+2015-06-09: wsfulton
+ Fix seg fault processing C++11 type aliasing. Issue #424.
+
+2015-05-28: wsfulton
+ [Python] Add new feature "python:cdefaultargs" to control default argument
+ code generation. By default, SWIG attempts to convert C/C++ default argument values
+ into Python values and generates code into the Python layer with these values.
+ Recent versions of SWIG are able to convert more of these values, however, the
+ new behaviour can be circumvented if desired via this new feature, such that
+ the default argument values are obtained from the C layer and not the Python layer.
+ For example:
+
+ struct CDA {
+ int fff(int a = 1, bool b = false);
+ };
+
+ The default code generation in the Python layer is:
+
+ class CDA(_object):
+ ...
+ def fff(self, a=1, b=False):
+ return _default_args.CDA_fff(self, a, b)
+
+ Adding the feature:
+
+ %feature("python:cdefaultargs") CDA::fff;
+
+ Results in:
+
+ class CDA(_object):
+ ...
+ def fff(self, *args):
+ return _default_args.CDA_fff(self, *args)
+
+ Some code generation modes, eg -builtin and -fastproxy, are unaffected by this as
+ the default values are always obtained from the C layer.
+
+2015-05-27: wsfulton
+ [Python] Deal with an integer as the default value of a typedef to bool
+ parameter in the C++ prototype. See #327. Regression from 3.0.0 onwards.
+
+2015-05-19: olly
+ [Python] Fix warning when compiling generated code with MSVC.
+ (Fixes https://sourceforge.net/p/swig/patches/351/ reported by
+ Mateusz Szyma¿ski).
+
+2015-05-14: wsfulton
+ Fix seg fault wrapping shared_ptr of classes with private constructors and destructors.
+ This also fixes the "unref" feature when used on classes with private destructors.
+
+2015-05-10: wsfulton
+ [Java] Fix multi-argument typemaps (char *STRING, size_t LENGTH)
+ so that they can be applied to a wider range of types. Fixes #385.
+
+2015-05-07: olly
+ [Python] Deal with an integer as the default value of a bool
+ parameter in the C++ prototype. Fixes github #327, reported by
+ Greg Allen.
+
+2015-05-07: LindleyF
+ [Java] Allow feature("director") and feature("ref") to be used
+ together. Github PR#403.
+
+2015-05-05: olly
+ Suppress warning 325 "Nested class not currently supported (Foo
+ ignored)" when Foo has already been explicitly ignored with "%ignore".
+
+2015-05-04: wsfulton
+ Add support for friend templates, including operator overloading - fixes #196. Considering
+ the example below, previously the operator gave a syntax error and friendfunc incorrectly
+ warned with:
+
+ "Warning 503: Can't wrap 'friendfunc<(Type)>' unless renamed to a valid identifier."
+
+ template class MyClass {
+ friend int friendfunc (double is, MyClass & x);
+ friend int operator<< (double un, const MyClass &x);
+ };
+
+ The following also previously incorrectly warned with:
+
+ "Warning 302: Identifier 'template_friend' redefined (ignored),"
+
+ template T template_friend(T);
+ struct MyTemplate {
+ template friend T template_friend(T);
+ };
+
+2015-05-01: wsfulton
+ Fix handling of conversion operators where the operator is split over multiple
+ lines or has comments within the operator type. Fixes #401.
+
+ Also fix similar problem with normal operators which gave a syntax error if split over
+ multiple lines or had a comment within the operator declaration.
+
+2015-04-30: olly
+ Ignore unknown preprocessor directives which are inside an inactive
+ conditional (github issue #394, reported by Dan Wilcox).
+ Regression introduced in 3.0.3.
+
+2015-04-27: vadz
+ [Python] Fix "default" typemap used after an argument with "numinputs=0" (#377).
+
+2015-04-24: wsfulton
+ [Python] Fix #256. Code generated with '-builtin -modernargs' segfaults for any
+ method taking zero arguments.
+
+ Also fixes: "SystemError: error return without exception set" during error checking
+ when using just -builtin and the incorrect number of arguments is passed to a class
+ method expecting zero arguments.
+
+2015-04-23: wsfulton
+ [Java] Bug #386 - Memory leak fix in (char *STRING, size_t LENGTH) typemaps.
+
+2015-04-23: vadz
+ [Python] Make "default" typemap work again (#330, #377).
+
+2015-04-23: vadz
+ [Python] Fix the use of default values for the pointer types (#365, #376).
+
+2015-04-23: wsfulton
+ Fix 'make check-ccache' which is part of 'make check' when one of the CCACHE_
+ environment variables, for example CCACHE_DISABLE, is set.
+
+2015-04-14: wsfulton
+ Clearer warning message for badly constructed typecheck typemaps. For example, was:
+
+ example.i:3: Warning 467: Overloaded foo(int) not supported (no type checking
+ rule for 'int').
+
+ Now:
+
+ example.i:3: Warning 467: Overloaded foo(int) not supported (incomplete type checking
+ rule - no precedence level in typecheck typemap for 'int').
+
+2015-04-11: wsfulton
+ [Java] Fix #353 - Linker multiple definition of 'ExceptionMatches' when
+ using directors and multiple modules.
+
+2015-04-11: wsfulton
+ Merge #320 - Make __dict__ accessible for Python builtin classes.
+
+2015-04-07: wsfulton
+ Fix #375 - parsing of extern "C" and typedef for example:
+ extern "C" typedef void (*Hook2_t)(int, const char *);
+ extern "C" typedef int Integer;
+
+2015-03-12: olly
+ -DSWIG_DIRECTOR_STATIC is now supported for all languages with
+ director support, not only Python and PHP.
+
+2015-03-02: ianlancetaylor
+ [Go] Add -cgo option, required for Go versions 1.5 and
+ later.
+
+2015-02-26: olly
+ Fix segmentation fault when top==NULL, introduced by nested class
+ handling (reported in issue#346 by Pawe¿ Tomulik).
+
+2015-02-09: wsfulton
+ [Guile] Fix generated code for static const char member variables when
+ defined and declared inline.
+
+2015-02-09: mishas
+ [Go] Fix %import of files in sub directories.
+
+2015-02-05: ianlancetaylor
+ [Go] Ignore Go specific type maps (goin, goout, etc.) if they are empty.
+
+2015-02-05: ianlancetaylor
+ [Go] Generated Go code no longer calls _swig_goallocate or
+ _swig_makegostring, as they will no longer work as of Go 1.5.
+
+Version 3.0.5 (31 Jan 2015)
+===========================
+
+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.
+
Version 3.0.4 (14 Jan 2015)
===========================
@@ -69,6 +577,10 @@ Version 3.0.3 (30 Dec 2014)
[Python] Patch #201 The generated .py file no longer uses *args for all Python parameters.
Instead, the parameters are named using the C++ parameter names.
+ "compactdefaultargs" feature can be enabled to restore the old behaviour.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
2014-10-24: timotheecour
[D] Patch #204 Use core.atomic.atomicOp to mutate shared variables
@@ -1489,7 +2001,7 @@ Version 2.0.6 (30 April 2012)
[Lua] Fix uninitialised variable in SWIGTYPE **OUTPUT typemaps as reported by Jim Anderson.
2012-04-28: wsfulton
- [Python] Fix compilation errors when wrapping STL containers on Mac OSX and possibly other systems.
+ [Python] Fix compilation errors when wrapping STL containers on Mac OS X and possibly other systems.
2012-04-28: wsfulton
[Java] Patch 3521811 from Leo Davis - char **STRING_ARRAY typemaps fixed to handle
@@ -2184,7 +2696,7 @@ Version 2.0.2 (20 February 2011)
Update chapter name to MzScheme/Racket accounting for the rename of MzScheme to Racket.
2011-02-05: wsfulton
- [C#] SF #3085906 - Possible fix running test-suite on Mac OSX.
+ [C#] SF #3085906 - Possible fix running test-suite on Mac OS X.
2011-02-05: wsfulton
SF #3173367 Better information during configure about Boost prerequisite for running
@@ -3837,7 +4349,7 @@ Version 1.3.37 (13 January 2009)
in Allegro CL
2008-07-19: wsfulton
- Fix building of Tcl examples/test-suite on Mac OSX reported by Gideon Simpson.
+ Fix building of Tcl examples/test-suite on Mac OS X reported by Gideon Simpson.
2008-07-17: wsfulton
Fix SF #2019156 Configuring with --without-octave or --without-alllang
@@ -7341,7 +7853,7 @@ Version 1.3.28 (February 12, 2006)
12/10/2005: mmatus
[UTF]
- - Fix unneccessary calls to SWIG_TypeQuery for 'char *'
+ - Fix unnecessary calls to SWIG_TypeQuery for 'char *'
and 'wchar_t *', problem found by Clay Culver while
profiling the PyOgre project.
@@ -10676,7 +11188,7 @@ Version 1.3.23 (November 11, 2004)
now if you have
- %pythonnondynamic(1) A;
+ %pythonnondynamic A;
struct A {
int a;
@@ -10694,11 +11206,11 @@ Version 1.3.23 (November 11, 2004)
Since this is a feature, you can use
- %pythonnondynamic(1);
+ %pythonnondynamic;
or
- %pythondynamic(0); [ Note: %pythondynamic since deprecated ]
+ %pythondynamic; [ Note: %pythondynamic since deprecated ]
to force all the wrapped classes to be "nondynamic" ones.
@@ -12658,7 +13170,7 @@ Version 1.3.20 (December 17, 2003)
Suggested by Kerim Borchaev.
11/11/2003: beazley
- Configuration changes to make SWIG work on Mac OSX 10.3.x (Panther).
+ Configuration changes to make SWIG work on Mac OS X 10.3.x (Panther).
Tested with Python, Tcl, Perl, and Ruby---all of which seem to work.
11/08/2003: cheetah (William Fulton)
@@ -23064,7 +23576,7 @@ Version 1.1b5 (March 12, 1997)
2/23/97 : Modified Python module to be better behaved under Windows
- Module initialization function is now properly exported.
- It should not be neccessary to explicitly export this function
+ It should not be necessary to explicitly export this function
yourself.
- Bizarre compilation problems when compiling the SWIG wrapper
diff --git a/CHANGES.current b/CHANGES.current
index 084711f9f4a..4c5ef680e19 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -2,12 +2,71 @@ 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.5 (in progress)
+Version 3.0.9 (in progress)
===========================
-2015-01-15: wsfulton
- [Python] Merge patch #250 - Fixes for using %constant and objects (non-primitive types)
+2016-03-01: olly
+ [Python] Fix isfinite() check to work with GCC6. Fixes
+ https://github.com/swig/swig/issues/615 reported by jplesnik.
-2015-01-15: wsfulton
- [C# Go] Merge patch #308 and fix #307 - C++11 strongly typed enum support
- in directors
+2016-02-17: olly
+ [Python] Add missing keywords 'as' and 'with' to pythonkw.swg.
+
+2016-02-07: kwwette
+ [Octave] recognise various unary functions
+ * Use __float__() for numeric conversions, e.g. when calling double()
+ * Map various unary functions, e.g. abs() to __abs__(), see full list
+ in section 32.3.10 of manual; only available in Octave 3.8.0 or later
+
+2016-02-07: kwwette
+ [Octave] export function swig_octave_prereq() for testing Octave version
+
+2016-02-06: pjohangustavsson
+ [C#] Fix duplicate symbol problems when linking the source generated
+ from multiple SWIG modules into one shared library for the -namespace
+ option. The namespace is now mangled into the global PInvoke function
+ names.
+
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2016-01-27: ahnolds
+ [Python] Added support for differentiating between Python Bytes
+ and Unicode objects using by defining SWIG_PYTHON_STRICT_BYTE_CHAR
+ and SWIG_PYTHON_STRICT_UNICODE_WCHAR.
+
+2016-01-27: steeve
+ [Go] Ensure structs are properly packed between gc and GCC/clang.
+
+2016-01-25: ahnolds
+ [Python] Support the full Python test suite in -classic mode
+ * Convert long/unsigned long/long long/unsigned long long to PyInt
+ rather than PyLong when possible. Certain python functions like
+ len() require a PyInt when operating on old-style classes.
+ * Add support for static methods in classic mode, including support
+ for pythonappend, pythonprepend, and docstrings.
+ * Removing the use of __swig_getmethods__ for static member methods
+ since they will always be found by the standard argument lookup
+ * Fix a bug where the wrong type of exception was caught when
+ checking for new-style class support
+
+2016-01-23: ahnolds
+ [Go] Enable support for the Go test-suite on OSX:
+ * The linker on OSX requires that all symbols (even weak symbols)
+ are defined at link time. Because the function _cgo_topofstack is
+ only defined starting in Go version 1.4, we explicitly mark it as
+ undefined for older versions of Go on OSX.
+ * Avoid writing empty swigargs structs, since empty structs are not
+ allowed in extern "C" blocks.
+
+2016-01-12: olly
+ [Javascript] Look for "nodejs" as well as "node", as it's packaged
+ as the former on Debian.
+
+2016-01-12: olly
+ [Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
+ Fixes https://github.com/swig/swig/issues/561.
+
+2016-01-10: ahnolds
+ Improved size_t and ptrdiff_t typemaps to support large values
+ on platforms where sizeof(size_t) > sizeof(unsigned long) and
+ sizeof(ptrdiff_t) > sizeof(long).
diff --git a/COPYRIGHT b/COPYRIGHT
index 1344630bbc0..c3fbbdebdeb 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -11,57 +11,62 @@ Portions also copyrighted by:
Information-technology Promotion Agency, Japan
Active SWIG Developers:
- William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin)
- Olly Betts (olly@survex.com) (PHP)
- Joseph Wang (joequant@gmail.com) (R)
- Xavier Delacour (xavier.delacour@gmail.com) (Octave)
- David Nadlinger (code@klickverbot.at) (D)
- Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
- Neha Narang (narangneha03@gmail.com) (Javascript)
+ William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin)
+ Olly Betts (olly@survex.com) (PHP)
+ Joseph Wang (joequant@gmail.com) (R)
+ Xavier Delacour (xavier.delacour@gmail.com) (Octave)
+ 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)
- Henning Thielemann (swig@henning-thielemann.de) (Modula3)
- Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme)
- Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping)
- Mikel Bancroft (mikel@franz.com) (Allegro CL)
- Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
- Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
- Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
- Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
- Charlie Savage (cfis@interserv.com) (Ruby)
- Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
- Richard Palmer (richard@magicality.org) (PHP)
- Sam Liddicott - Ananova Ltd (saml@liddicott.com) (PHP)
- Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP)
- Kevin Ruland (PHP)
- Shibukawa Yoshiki (Japanese Translation)
- Jason Stewart (jason@openinformatics.com) (Perl5)
- Loic Dachary (Perl5)
- David Fletcher (Perl5)
- Gary Holt (Perl5)
- Masaki Fukushima (Ruby)
- Scott Michel (scottm@cs.ucla.edu) (Java directors)
- Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core)
- Mark Rose (mrose@stm.lbl.gov) (Directors)
- Jonah Beckford (beckford@usermail.com) (CHICKEN)
- Ahmon Dancy (dancy@franz.com) (Allegro CL)
- Dirk Gerrits (Allegro CL)
- Neil Cawse (C#)
- Harco de Hilster (Java)
- Alexey Dyachenko (dyachenko@fromru.com) (Tcl)
- Bob Techentin (Tcl)
- Martin Froehlich (Guile)
- Marcio Luis Teixeira (Guile)
- Duncan Temple Lang (R)
- Miklos Vajna (PHP directors)
- Mark Gossage (mark@gossage.cjb.net) (Lua)
- 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)
- Ian Lance Taylor (Go)
- Vadim Zeitlin (PCRE)
- Stefan Zager (szager@gmail.com) (Python)
+ Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
+ Henning Thielemann (swig@henning-thielemann.de) (Modula3)
+ Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme)
+ Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping)
+ Mikel Bancroft (mikel@franz.com) (Allegro CL)
+ Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
+ Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
+ Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
+ Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
+ Charlie Savage (cfis@interserv.com) (Ruby)
+ Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
+ Richard Palmer (richard@magicality.org) (PHP)
+ Sam Liddicott - Ananova Ltd (saml@liddicott.com) (PHP)
+ Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP)
+ Kevin Ruland (PHP)
+ Shibukawa Yoshiki (Japanese Translation)
+ Jason Stewart (jason@openinformatics.com) (Perl5)
+ Loic Dachary (Perl5)
+ David Fletcher (Perl5)
+ Gary Holt (Perl5)
+ Masaki Fukushima (Ruby)
+ Scott Michel (scottm@cs.ucla.edu) (Java directors)
+ Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core)
+ Mark Rose (mrose@stm.lbl.gov) (Directors)
+ Jonah Beckford (beckford@usermail.com) (CHICKEN)
+ Ahmon Dancy (dancy@franz.com) (Allegro CL)
+ Dirk Gerrits (Allegro CL)
+ Neil Cawse (C#)
+ Harco de Hilster (Java)
+ Alexey Dyachenko (dyachenko@fromru.com) (Tcl)
+ Bob Techentin (Tcl)
+ Martin Froehlich (Guile)
+ Marcio Luis Teixeira (Guile)
+ Duncan Temple Lang (R)
+ Miklos Vajna (PHP directors)
+ Mark Gossage (mark@gossage.cjb.net) (Lua)
+ 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 (Scilab)
+ Ian Lance Taylor (Go)
+ Vadim Zeitlin (PCRE, Python)
+ 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
diff --git a/Doc/Manual/Allegrocl.html b/Doc/Manual/Allegrocl.html
index 8295bad1c0a..4b6bad42151 100644
--- a/Doc/Manual/Allegrocl.html
+++ b/Doc/Manual/Allegrocl.html
@@ -1,14 +1,14 @@
-
-
+
SWIG and Allegro Common Lisp
+
- 18 SWIG and Allegro Common Lisp
+
@@ -135,10 +135,10 @@ 18 SWIG and Allegro Common Lisp
to it.
- 18.1 Basics
+
- 18.1.1 Running SWIG
+
@@ -360,7 +360,7 @@
18.1.1 Running SWIG
the C++ wrapper will be what you then load into Allegro CL.
- 18.1.2 Command Line Options
+
@@ -373,21 +373,21 @@
18.1.2 Command Line Options
-identifier-converter [name] - Binds the variable swig:*swig-identifier-convert*
in the generated .cl file to name .
- This function is used to generate symbols
- for the lisp side of the interface.
+ This function is used to generate symbols
+ for the lisp side of the interface.
-cwrap - [default] Generate a .cxx file containing C wrapper function when
wrapping C code. The interface generated is similar to what is
- done for C++ code.
+ done for C++ code.
-nocwrap - Explicitly turn off generation of .cxx wrappers for C code. Reasonable
for modules with simple interfaces. Can not handle all legal enum
- and constant constructs, or take advantage of SWIG customization features.
+ and constant constructs, or take advantage of SWIG customization features.
-isolate - With this command-line argument, all lisp helper functions are defined
in a unique package named swig.<module-name> rather than
- swig . This prevents conflicts when the module is
- intended to be used with other swig generated interfaces that may,
- for instance, make use of different identifier converters.
+ swig . This prevents conflicts when the module is
+ intended to be used with other swig generated interfaces that may,
+ for instance, make use of different identifier converters.
@@ -396,7 +396,7 @@ 18.1.2 Command Line Options
functions for more details.
- 18.1.3 Inserting user code into generated files
+
@@ -436,7 +436,7 @@
18.1.3 Inserting user code into generated files<
- 18.2 Wrapping Overview
+
@@ -446,7 +446,7 @@
18.2 Wrapping Overview
interested in generating an interface to C++.
- 18.2.1 Function Wrapping
+
@@ -472,7 +472,7 @@
18.2.1 Function Wrapping
| Foreign Code | What we're generating an interface to.
|______________|
|
- |
+ |
_______v______
| | (foreign side)
| Wrapper code | extern "C" wrappers calling C++
@@ -484,22 +484,22 @@ 18.2.1 Function Wrapping
| FFI Layer | Low level lisp interface. ff:def-foreign-call,
|______________| ff:def-foreign-variable
|
- +----------------------------
+ +----------------------------
_______v______ _______v______
| | | | (lisp side)
| Defuns | | Defmethods | wrapper for overloaded
|______________| |______________| functions or those with
(lisp side) | defaulted arguments
- Wrapper for non-overloaded |
- functions and methods _______v______
- | | (lisp side)
- | Defuns | dispatch function
- |______________| to overloads based
- on arity
+ Wrapper for non-overloaded |
+ functions and methods _______v______
+ | | (lisp side)
+ | Defuns | dispatch function
+ |______________| to overloads based
+ on arity
- 18.2.2 Foreign Wrappers
+
@@ -512,7 +512,7 @@
18.2.2 Foreign Wrappers
typemap.
- 18.2.3 FFI Wrappers
+
@@ -593,7 +593,7 @@
18.2.3 FFI Wrappers
ff:def-foreign-call's.
- 18.2.4 Non-overloaded Defuns
+
@@ -606,7 +606,7 @@
18.2.4 Non-overloaded Defuns
this function can be manipulated via the lout typemap.
- 18.2.5 Overloaded Defuns
+
@@ -622,7 +622,7 @@
18.2.5 Overloaded Defuns
can be manipulated via the lout typemap.
- 18.2.6 What about constant and variable access?
+
@@ -635,7 +635,7 @@
18.2.6 What about constant and variable access?
into the foreign module.
- 18.2.7 Object Wrapping
+
@@ -657,7 +657,7 @@
18.2.7 Object Wrapping
foreign function interface.
- 18.3 Wrapping Details
+
@@ -665,7 +665,7 @@
18.3 Wrapping Details
translated into lisp.
- 18.3.1 Namespaces
+
@@ -742,7 +742,7 @@
18.3.1 Namespaces
function such as (car '(1 2 3) .
- 18.3.2 Constants
+
@@ -799,11 +799,11 @@ 18.3.2 Constants
- Users are cautioned to get to know their constants before use, or
- not use the -nocwrap command-line option.
+ Users are cautioned to get to know their constants before use, or
+ not use the -nocwrap command-line option.
- 18.3.3 Variables
+
@@ -881,7 +881,7 @@
18.3.3 Variables
- 18.3.4 Enumerations
+
@@ -907,7 +907,7 @@
18.3.4 Enumerations
For example, the following header file
enum.h:
-enum COL { RED, GREEN, BLUE };
+enum COL { RED, GREEN, BLUE };
enum FOO { FOO1 = 10, FOO2, FOO3 };
@@ -957,7 +957,7 @@ 18.3.4 Enumerations
- 18.3.5 Arrays
+
@@ -1105,10 +1105,10 @@
18.3.5 Arrays
- 18.3.6 Classes and Structs and Unions (oh my!)
+
- 18.3.6.1 CLOS wrapping of
+
@@ -1123,7 +1123,7 @@
18.3.6.1 CLOS wrapping of
integer values.
- 18.3.6.2 CLOS Inheritance
+
@@ -1136,7 +1136,7 @@
18.3.6.2 CLOS Inheritance
parameter.
- 18.3.6.3 Member fields and functions
+
@@ -1152,7 +1152,7 @@
18.3.6.3 Member fields and functions
the interface does nothing for friend directives,
- 18.3.6.4 Why not directly access C++ classes using foreign types?
+
@@ -1170,34 +1170,34 @@
18.3.6.4 Why not directly access C++ classes us
use the more robust wrapper functions.
- 18.3.7 Templates
+
- 18.3.7.1 Generating wrapper code for templates
+
-
- SWIG provides support for dealing with templates, but by
- default, it will not generate any member variable or function
- wrappers for templated classes. In order to create these
- wrappers, you need to explicitly tell SWIG to instantiate
- them. This is done via the
- %template
- directive.
-
+
+SWIG provides support for dealing with templates, but by
+default, it will not generate any member variable or function
+wrappers for templated classes. In order to create these
+wrappers, you need to explicitly tell SWIG to instantiate
+them. This is done via the
+%template
+directive.
+
- 18.3.7.2 Implicit Template instantiation
+
-
- While no wrapper code is generated for accessing member
- variables, or calling member functions, type code is generated
- to include these templated classes in the foreign-type and CLOS
- class schema.
-
+
+While no wrapper code is generated for accessing member
+variables, or calling member functions, type code is generated
+to include these templated classes in the foreign-type and CLOS
+class schema.
+
- 18.3.8 Typedef, Templates, and Synonym Types
+
@@ -1243,7 +1243,7 @@
18.3.8 Typedef, Templates, and Synonym Types
- (setf (find-class <synonym>) <primary>)
+ (setf (find-class <synonym>) <primary>)
The result is that all references to synonym types in foreign
@@ -1277,7 +1277,7 @@
18.3.8 Typedef, Templates, and Synonym Types
- 18.3.8.1 Choosing a primary type
+
@@ -1285,20 +1285,20 @@
18.3.8.1 Choosing a primary type
criteria from a set of synonym types.
-
- If a synonym type has a class definition, it is the primary type.
-
-
- If a synonym type is a class template and has been explicitly
- instantiated via %template , it is the primary type.
-
-
- For all other sets of synonymous types, the synonym which is
- parsed first becomes the primary type.
-
+
+ If a synonym type has a class definition, it is the primary type.
+
+
+ If a synonym type is a class template and has been explicitly
+ instantiated via %template , it is the primary type.
+
+
+ For all other sets of synonymous types, the synonym which is
+ parsed first becomes the primary type.
+
- 18.3.9 Function overloading/Parameter defaulting
+
@@ -1461,7 +1461,7 @@
@@ -1472,68 +1472,68 @@
18.3.10 Operator wrapping and Operator overload
/* name conversion for overloaded operators. */
#ifdef __cplusplus
-%rename(__add__) *::operator+;
-%rename(__pos__) *::operator+();
-%rename(__pos__) *::operator+() const;
+%rename(__add__) *::operator+;
+%rename(__pos__) *::operator+();
+%rename(__pos__) *::operator+() const;
-%rename(__sub__) *::operator-;
-%rename(__neg__) *::operator-() const;
-%rename(__neg__) *::operator-();
+%rename(__sub__) *::operator-;
+%rename(__neg__) *::operator-() const;
+%rename(__neg__) *::operator-();
-%rename(__mul__) *::operator*;
-%rename(__deref__) *::operator*();
-%rename(__deref__) *::operator*() const;
+%rename(__mul__) *::operator*;
+%rename(__deref__) *::operator*();
+%rename(__deref__) *::operator*() const;
-%rename(__div__) *::operator/;
-%rename(__mod__) *::operator%;
-%rename(__logxor__) *::operator^;
-%rename(__logand__) *::operator&;
-%rename(__logior__) *::operator|;
-%rename(__lognot__) *::operator~();
-%rename(__lognot__) *::operator~() const;
+%rename(__div__) *::operator/;
+%rename(__mod__) *::operator%;
+%rename(__logxor__) *::operator^;
+%rename(__logand__) *::operator&;
+%rename(__logior__) *::operator|;
+%rename(__lognot__) *::operator~();
+%rename(__lognot__) *::operator~() const;
-%rename(__not__) *::operator!();
-%rename(__not__) *::operator!() const;
+%rename(__not__) *::operator!();
+%rename(__not__) *::operator!() const;
-%rename(__assign__) *::operator=;
+%rename(__assign__) *::operator=;
%rename(__add_assign__) *::operator+=;
-%rename(__sub_assign__) *::operator-=;
-%rename(__mul_assign__) *::operator*=;
-%rename(__div_assign__) *::operator/=;
-%rename(__mod_assign__) *::operator%=;
+%rename(__sub_assign__) *::operator-=;
+%rename(__mul_assign__) *::operator*=;
+%rename(__div_assign__) *::operator/=;
+%rename(__mod_assign__) *::operator%=;
%rename(__logxor_assign__) *::operator^=;
%rename(__logand_assign__) *::operator&=;
%rename(__logior_assign__) *::operator|=;
-%rename(__lshift__) *::operator<<;
+%rename(__lshift__) *::operator<<;
%rename(__lshift_assign__) *::operator<<=;
-%rename(__rshift__) *::operator>>;
+%rename(__rshift__) *::operator>>;
%rename(__rshift_assign__) *::operator>>=;
-%rename(__eq__) *::operator==;
-%rename(__ne__) *::operator!=;
-%rename(__lt__) *::operator<;
-%rename(__gt__) *::operator>;
-%rename(__lte__) *::operator<=;
-%rename(__gte__) *::operator>=;
+%rename(__eq__) *::operator==;
+%rename(__ne__) *::operator!=;
+%rename(__lt__) *::operator<;
+%rename(__gt__) *::operator>;
+%rename(__lte__) *::operator<=;
+%rename(__gte__) *::operator>=;
-%rename(__and__) *::operator&&;
-%rename(__or__) *::operator||;
+%rename(__and__) *::operator&&;
+%rename(__or__) *::operator||;
-%rename(__preincr__) *::operator++();
-%rename(__postincr__) *::operator++(int);
-%rename(__predecr__) *::operator--();
-%rename(__postdecr__) *::operator--(int);
+%rename(__preincr__) *::operator++();
+%rename(__postincr__) *::operator++(int);
+%rename(__predecr__) *::operator--();
+%rename(__postdecr__) *::operator--(int);
-%rename(__comma__) *::operator,();
-%rename(__comma__) *::operator,() const;
+%rename(__comma__) *::operator,();
+%rename(__comma__) *::operator,() const;
%rename(__member_ref__) *::operator->;
%rename(__member_func_ref__) *::operator->*;
-%rename(__funcall__) *::operator();
-%rename(__aref__) *::operator[];
+%rename(__funcall__) *::operator();
+%rename(__aref__) *::operator[];
@@ -1607,7 +1607,7 @@ 18.3.10 Operator wrapping and Operator overload
- 18.3.11 Varargs
+18.3.11 Varargs
@@ -1628,7 +1628,7 @@
18.3.11 Varargs
with other ways such functions can be wrapped.
- 18.3.12 C++ Exceptions
+18.3.12 C++ Exceptions
@@ -1640,7 +1640,7 @@
18.3.12 C++ Exceptions
implemented.
- 18.3.13 Pass by value, pass by reference
+18.3.13 Pass by value, pass by reference
@@ -1652,7 +1652,7 @@
18.3.13 Pass by value, pass by reference
newly defined types.
- 18.4 Typemaps
+18.4 Typemaps
@@ -1663,7 +1663,7 @@
18.4 Typemaps
on Typemaps for more information.
- 18.4.1 Code Generation in the C++ Wrapper
+18.4.1 Code Generation in the C++ Wrapper
@@ -1693,7 +1693,7 @@ 18.4.1 Code Generation in the C++ Wrapper
- 18.4.1.1 IN Typemap
+18.4.1.1 IN Typemap
@@ -1728,7 +1728,7 @@
18.4.1.1 IN Typemap
- 18.4.1.2 OUT Typemap
+18.4.1.2 OUT Typemap
@@ -1752,7 +1752,7 @@
18.4.1.2 OUT Typemap
- 18.4.1.3 CTYPE Typemap
+18.4.1.3 CTYPE Typemap
@@ -1784,7 +1784,7 @@
18.4.1.3 CTYPE Typemap
these common typemaps here.
- 18.4.2 Code generation in Lisp wrappers
+18.4.2 Code generation in Lisp wrappers
@@ -1803,7 +1803,7 @@
18.4.2 Code generation in Lisp wrappers
16.3.1 Namespaces for details.
- 18.4.2.1 LIN Typemap
+18.4.2.1 LIN Typemap
@@ -1821,32 +1821,32 @@
18.4.2.1 LIN Typemap
The LIN typemap accepts the following $variable references.
- $in - expands to the name of the parameter being
- applied to this typemap
-
- $out - expands to the name of the local variable
- assigned to this typemap
-
- $in_fftype - the foreign function type of the C type.
- $*in_fftype - the foreign function type of the C type
- with one pointer removed. If there is no pointer, then $*in_fftype
- is the same as $in_fftype.
-
- $body - very important. Instructs SWIG where
- subsequent code generation steps should be inserted into the
- current typemap. Leaving out a $body reference
- will result in lisp wrappers that do very little by way of
- calling into foreign code. Not recommended.
-
+ $in - expands to the name of the parameter being
+ applied to this typemap
+
+ $out - expands to the name of the local variable
+ assigned to this typemap
+
+ $in_fftype - the foreign function type of the C type.
+ $*in_fftype - the foreign function type of the C type
+ with one pointer removed. If there is no pointer, then $*in_fftype
+ is the same as $in_fftype.
+
+ $body - very important. Instructs SWIG where
+ subsequent code generation steps should be inserted into the
+ current typemap. Leaving out a $body reference
+ will result in lisp wrappers that do very little by way of
+ calling into foreign code. Not recommended.
+
-%typemap(lin) SWIGTYPE "(cl:let (($out $in))\n $body)";
+%typemap(lin) SWIGTYPE "(cl:let (($out $in))\n $body)";
- 18.4.2.2 LOUT Typemap
+18.4.2.2 LOUT Typemap
@@ -1858,17 +1858,17 @@
18.4.2.2 LOUT Typemap
The LOUT typemap uses the following $variable
- $lclass - Expands to the CLOS class that
- represents foreign-objects of the return type matching this
- typemap.
-
- $body - Same as for the LIN map. Place this
- variable where you want the foreign-function call to occur.
-
- $ldestructor - Expands to the symbol naming the destructor for this
- class ($lclass) of object. Allows you to insert finalization or automatic garbage
- collection into the wrapper code (see default mappings below).
-
+ $lclass - Expands to the CLOS class that
+ represents foreign-objects of the return type matching this
+ typemap.
+
+ $body - Same as for the LIN map. Place this
+ variable where you want the foreign-function call to occur.
+
+ $ldestructor - Expands to the symbol naming the destructor for this
+ class ($lclass) of object. Allows you to insert finalization or automatic garbage
+ collection into the wrapper code (see default mappings below).
+
@@ -1889,7 +1889,7 @@
18.4.2.2 LOUT Typemap
- 18.4.2.3 FFITYPE Typemap
+18.4.2.3 FFITYPE Typemap
@@ -1939,7 +1939,7 @@ 18.4.2.3 FFITYPE Typemap
- 18.4.2.4 LISPTYPE Typemap
+18.4.2.4 LISPTYPE Typemap
@@ -1959,7 +1959,7 @@
18.4.2.4 LISPTYPE Typemap
- 18.4.2.5 LISPCLASS Typemap
+18.4.2.5 LISPCLASS Typemap
@@ -1983,7 +1983,7 @@
18.4.2.5 LISPCLASS Typemap
- 18.4.3 Modifying SWIG behavior using typemaps
+18.4.3 Modifying SWIG behavior using typemaps
@@ -2017,10 +2017,10 @@
18.4.3 Modifying SWIG behavior using typemaps
- 18.5 Identifier Converter functions
+18.5 Identifier Converter functions
- 18.5.1 Creating symbols in the lisp environment
+18.5.1 Creating symbols in the lisp environment
@@ -2041,11 +2041,11 @@
18.5.1 Creating symbols in the lisp environment
of arguments.
- 18.5.2 Existing identifier-converter functions
+18.5.2 Existing identifier-converter functions
Two basic identifier routines have been defined.
-
18.5.2.1 identifier-convert-null
+18.5.2.1 identifier-convert-null
@@ -2054,7 +2054,7 @@
18.5.2.1 identifier-convert-null
strings, from which a symbol will be created.
- 18.5.2.2 identifier-convert-lispify
+18.5.2.2 identifier-convert-lispify
@@ -2063,7 +2063,7 @@
18.5.2.2 identifier-convert-lispify
same symbol transformations.
- 18.5.2.3 Default identifier to symbol conversions
+18.5.2.3 Default identifier to symbol conversions
@@ -2072,7 +2072,7 @@
18.5.2.3 Default identifier to symbol conversio
default naming conventions.
- 18.5.3 Defining your own identifier-converter
+18.5.3 Defining your own identifier-converter
@@ -2128,7 +2128,7 @@
18.5.3 Defining your own identifier-converter
this identifier.
- 18.5.4 Instructing SWIG to use a particular identifier-converter
+18.5.4 Instructing SWIG to use a particular identifier-converter
diff --git a/Doc/Manual/Android.html b/Doc/Manual/Android.html
index 2890e241519..8838e67a9fd 100644
--- a/Doc/Manual/Android.html
+++ b/Doc/Manual/Android.html
@@ -1,11 +1,12 @@
-
+
SWIG and Android
+
- 19 SWIG and Android
+19 SWIG and Android
@@ -30,24 +31,24 @@ 19 SWIG and Android
- 19.1 Overview
+19.1 Overview
The Android chapter is fairly short as support for Android is the same as for Java, where the Java Native Interface (JNI) is
used to call from Android Java into C or C++ compiled code.
-Everything in the Java chapter applies to generating code for access from Android Java code.
+Everything in the Java chapter applies to generating code for access from Android Java code.
This chapter contains a few Android specific notes and examples.
- 19.2 Android examples
+19.2 Android examples
- 19.2.1 Examples introduction
+19.2.1 Examples introduction
-The examples require the Android SDK and Android NDK which can be installed as per instructions in the links.
+The examples require the Android SDK and Android NDK which can be installed as per instructions in the links.
The Eclipse version is not required for these examples as just the command line tools are used (shown for Linux as the host, but Windows will be very similar, if not identical in most places).
Add the SDK tools and NDK tools to your path and create a directory somewhere for your Android projects (adjust PATH as necessary to where you installed the tools):
@@ -76,7 +77,7 @@ 19.2.1 Examples introduction
The following examples are shipped with SWIG under the Examples/android directory and include a Makefile to build and install each example.
- 19.2.2 Simple C example
+19.2.2 Simple C example
@@ -209,7 +210,7 @@
19.2.2 Simple C example
$ adb devices
List of devices attached
-A32-6DBE0001-9FF80000-015D62C3-02018028 device
+A32-6DBE0001-9FF80000-015D62C3-02018028 device
@@ -221,7 +222,7 @@ 19.2.2 Simple C example
$ adb install bin/SwigSimple-debug.apk
95 KB/s (4834 bytes in 0.049s)
- pkg: /data/local/tmp/SwigSimple-debug.apk
+ pkg: /data/local/tmp/SwigSimple-debug.apk
Success
@@ -398,7 +399,7 @@ 19.2.2 Simple C example
- 19.2.3 C++ class example
+19.2.3 C++ class example
@@ -746,7 +747,7 @@
19.2.3 C++ class example
- 19.2.4 Other examples
+19.2.4 Other examples
@@ -758,7 +759,7 @@
19.2.4 Other examples
Normally C++ exception handling and the STL is not available by default in the version of g++ shipped with Android, but this example turns these features on as described in the next section.
- 19.3 C++ STL
+19.3 C++ STL
diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html
index 3b77136862b..48ec5c629b0 100644
--- a/Doc/Manual/Arguments.html
+++ b/Doc/Manual/Arguments.html
@@ -1,12 +1,13 @@
-
+
Argument Handling
+
- 10 Argument Handling
+10 Argument Handling
- 10.1.2 Input parameters
+10.1.2 Input parameters
@@ -203,7 +204,7 @@
10.1.2 Input parameters
-int *INPUT
+int *INPUT
short *INPUT
long *INPUT
unsigned int *INPUT
@@ -220,7 +221,7 @@ 10.1.2 Input parameters
double add(double *a, double *b) {
- return *a+*b;
+ return *a+*b;
}
@@ -247,7 +248,7 @@ 10.1.2 Input parameters
result = add(3,4)
- 10.1.3 Output parameters
+10.1.3 Output parameters
@@ -272,7 +273,7 @@
10.1.3 Output parameters
void add(double a, double b, double *c) {
- *c = a+b;
+ *c = a+b;
}
@@ -314,7 +315,7 @@ 10.1.3 Output parameters
- 10.1.4 Input/Output parameters
+10.1.4 Input/Output parameters
@@ -338,7 +339,7 @@
10.1.4 Input/Output parameters
void negate(double *x) {
- *x = -(*x);
+ *x = -(*x);
}
@@ -379,7 +380,7 @@ 10.1.4 Input/Output parameters
SWIG. Backwards compatibility is preserved, but deprecated.
- 10.1.5 Using different names
+10.1.5 Using different names
@@ -413,7 +414,7 @@
10.1.5 Using different names
file or a matching %clear declaration.
- 10.2 Applying constraints to input values
+10.2 Applying constraints to input values
@@ -423,7 +424,7 @@
10.2 Applying constraints to input values
can be accomplished including the constraints.i library file.
- 10.2.1 Simple constraint example
+10.2.1 Simple constraint example
@@ -449,7 +450,7 @@
10.2.1 Simple constraint example
exception will be raised. As a result, it is possible to catch bad
values, prevent mysterious program crashes and so on.
- 10.2.2 Constraint methods
+10.2.2 Constraint methods
@@ -465,7 +466,7 @@
10.2.2 Constraint methods
- 10.2.3 Applying constraints to new datatypes
+10.2.3 Applying constraints to new datatypes
diff --git a/Doc/Manual/CCache.html b/Doc/Manual/CCache.html
new file mode 100644
index 00000000000..d23b0cb2f2d
--- /dev/null
+++ b/Doc/Manual/CCache.html
@@ -0,0 +1,474 @@
+
+
+
+ccache-swig(1) manpage
+
+
+
+
+
+17 Using SWIG with ccache - ccache-swig(1) manpage
+
+
+
+
+
+
+
+
17.1 NAME
+
+
+
+
+ccache-swig - a fast compiler cache
+
+
+
17.2 SYNOPSIS
+
+
+
+ccache-swig [OPTION]
+
+ccache-swig <compiler> [COMPILER OPTIONS]
+
+<compiler> [COMPILER OPTIONS]
+
+
17.3 DESCRIPTION
+
+
+
+ccache-swig is a compiler cache. It speeds up re-compilation of C/C++/SWIG code
+by caching previous compiles and detecting when the same compile is
+being done again. ccache-swig is ccache plus support for SWIG. ccache
+and ccache-swig are used interchangeably in this document.
+
+
17.4 OPTIONS SUMMARY
+
+
+
+Here is a summary of the options to ccache-swig.
+
+
+
+-s show statistics summary
+-z zero statistics
+-c run a cache cleanup
+-C clear the cache completely
+-F <n> set maximum files in cache
+-M <n> set maximum size of cache (use G, M or K)
+-h this help page
+-V print version number
+
+
+
+
+
17.5 OPTIONS
+
+
+
+These options only apply when you invoke ccache as "ccache-swig". When
+invoked as a compiler none of these options apply. In that case your
+normal compiler options apply and you should refer to your compilers
+documentation.
+
+
+
-h Print a options summary page
+
+
-s Print the current statistics summary for the cache. The
+statistics are stored spread across the subdirectories of the
+cache. Using "ccache-swig -s" adds up the statistics across all
+subdirectories and prints the totals.
+
+
-z Zero the cache statistics.
+
+
-V Print the ccache version number
+
+
-c Clean the cache and re-calculate the cache file count and
+size totals. Normally the -c option should not be necessary as ccache
+keeps the cache below the specified limits at runtime and keeps
+statistics up to date on each compile. This option is mostly useful
+if you manually modify the cache contents or believe that the cache
+size statistics may be inaccurate.
+
+
-C Clear the entire cache, removing all cached files.
+
+
-F <maxfiles> This sets the maximum number of files allowed in
+the cache. The value is stored inside the cache directory and applies
+to all future compiles. Due to the way the value is stored the actual
+value used is always rounded down to the nearest multiple of 16.
+
+
-M <maxsize> This sets the maximum cache size. You can specify
+a value in gigabytes, megabytes or kilobytes by appending a G, M or K
+to the value. The default is gigabytes. The actual value stored is
+rounded down to the nearest multiple of 16 kilobytes.
+
+
+
+
17.6 INSTALLATION
+
+
+
+There are two ways to use ccache. You can either prefix your compile
+commands with "ccache-swig" or you can create a symbolic link between
+ccache-swig and the names of your compilers. The first method is most
+convenient if you just want to try out ccache or wish to use it for
+some specific projects. The second method is most useful for when you
+wish to use ccache for all your compiles.
+
+To install for usage by the first method just copy ccache-swig to somewhere
+in your path.
+
+To install for the second method do something like this:
+
+
+ cp ccache-swig /usr/local/bin/
+ ln -s /usr/local/bin/ccache-swig /usr/local/bin/gcc
+ ln -s /usr/local/bin/ccache-swig /usr/local/bin/g++
+ ln -s /usr/local/bin/ccache-swig /usr/local/bin/cc
+ ln -s /usr/local/bin/ccache-swig /usr/local/bin/swig
+
+
+
+This will work as long as /usr/local/bin comes before the path to gcc
+(which is usually in /usr/bin). After installing you may wish to run
+"which gcc" to make sure that the correct link is being used.
+
+Note! Do not use a hard link, use a symbolic link. A hardlink will
+cause "interesting" problems.
+
+
17.7 EXTRA OPTIONS
+
+
+
+When run as a compiler front end ccache usually just takes the same
+command line options as the compiler you are using. The only exception
+to this is the option '--ccache-skip'. That option can be used to tell
+ccache that the next option is definitely not a input filename, and
+should be passed along to the compiler as-is.
+
+The reason this can be important is that ccache does need to parse the
+command line and determine what is an input filename and what is a
+compiler option, as it needs the input filename to determine the name
+of the resulting object file (among other things). The heuristic
+ccache uses in this parse is that any string on the command line that
+exists as a file is treated as an input file name (usually a C
+file). By using --ccache-skip you can force an option to not be
+treated as an input file name and instead be passed along to the
+compiler as a command line option.
+
+
17.8 ENVIRONMENT VARIABLES
+
+
+
+ccache uses a number of environment variables to control operation. In
+most cases you won't need any of these as the defaults will be fine.
+
+
+
+
CCACHE_DIR the CCACHE_DIR environment variable specifies
+where ccache will keep its cached compiler output. The default is
+"$HOME/.ccache".
+
+
CCACHE_TEMPDIR the CCACHE_TEMPDIR environment variable specifies
+where ccache will put temporary files. The default is the same as
+CCACHE_DIR. Note that the CCACHE_TEMPDIR path must be on the same
+filesystem as the CCACHE_DIR path, so that renames of files between
+the two directories can work.
+
+
CCACHE_LOGFILE If you set the CCACHE_LOGFILE environment
+variable then ccache will write some log information on cache hits
+and misses in that file. This is useful for tracking down problems.
+
+
CCACHE_VERBOSE If you set the CCACHE_VERBOSE environment
+variable then ccache will display on stdout all the compiler invocations
+that it makes. This can useful for debugging unexpected problems.
+
+
CCACHE_PATH You can optionally set CCACHE_PATH to a colon
+separated path where ccache will look for the real compilers. If you
+don't do this then ccache will look for the first executable matching
+the compiler name in the normal PATH that isn't a symbolic link to
+ccache itself.
+
+
CCACHE_CC You can optionally set CCACHE_CC to force the name
+of the compiler to use. If you don't do this then ccache works it out
+from the command line.
+
+
CCACHE_PREFIX This option adds a prefix to the command line
+that ccache runs when invoking the compiler. Also see the section
+below on using ccache with distcc.
+
+
CCACHE_DISABLE If you set the environment variable
+CCACHE_DISABLE then ccache will just call the real compiler,
+bypassing the cache completely.
+
+
CCACHE_READONLY the CCACHE_READONLY environment variable
+tells ccache to attempt to use existing cached object files, but not
+to try to add anything new to the cache. If you are using this because
+your CCACHE_DIR is read-only, then you may find that you also need to
+set CCACHE_TEMPDIR as otherwise ccache will fail to create the
+temporary files.
+
+
CCACHE_CPP2 If you set the environment variable CCACHE_CPP2
+then ccache will not use the optimisation of avoiding the 2nd call to
+the pre-processor by compiling the pre-processed output that was used
+for finding the hash in the case of a cache miss. This is primarily a
+debugging option, although it is possible that some unusual compilers
+will have problems with the intermediate filename extensions used in
+this optimisation, in which case this option could allow ccache to be
+used.
+
+
CCACHE_NOCOMPRESS If you set the environment variable
+CCACHE_NOCOMPRESS then there is no compression used on files that go
+into the cache. However, this setting has no effect on how files are
+retrieved from the cache, compressed results will still be usable.
+
+
CCACHE_NOSTATS If you set the environment variable
+CCACHE_NOSTATS then ccache will not update the statistics files on
+each compile.
+
+
CCACHE_NLEVELS The environment variable CCACHE_NLEVELS allows
+you to choose the number of levels of hash in the cache directory. The
+default is 2. The minimum is 1 and the maximum is 8.
+
+
CCACHE_HARDLINK If you set the environment variable
+CCACHE_HARDLINK then ccache will attempt to use hard links from the
+cache directory when creating the compiler output rather than using a
+file copy. Using hard links is faster, but can confuse programs like
+'make' that rely on modification times. Hard links are never made for
+compressed cache files.
+
+
CCACHE_RECACHE This forces ccache to not use any cached
+results, even if it finds them. New results are still cached, but
+existing cache entries are ignored.
+
+
CCACHE_UMASK This sets the umask for ccache and all child
+processes (such as the compiler). This is mostly useful when you wish
+to share your cache with other users. Note that this also affects the
+file permissions set on the object files created from your
+compilations.
+
+
CCACHE_HASHDIR This tells ccache to hash the current working
+directory when calculating the hash that is used to distinguish two
+compiles. This prevents a problem with the storage of the current
+working directory in the debug info of a object file, which can lead
+ccache to give a cached object file that has the working directory in
+the debug info set incorrectly. This option is off by default as the
+incorrect setting of this debug info rarely causes problems. If you
+strike problems with gdb not using the correct directory then enable
+this option.
+
+
CCACHE_UNIFY If you set the environment variable CCACHE_UNIFY
+then ccache will use the C/C++ unifier when hashing the pre-processor
+output if -g is not used in the compile. The unifier is slower than a
+normal hash, so setting this environment variable loses a little bit
+of speed, but it means that ccache can take advantage of not
+recompiling when the changes to the source code consist of
+reformatting only. Note that using CCACHE_UNIFY changes the hash, so
+cached compiles with CCACHE_UNIFY set cannot be used when
+CCACHE_UNIFY is not set and vice versa. The reason the unifier is off
+by default is that it can give incorrect line number information in
+compiler warning messages.
+
+
CCACHE_EXTENSION Normally ccache tries to automatically
+determine the extension to use for intermediate C pre-processor files
+based on the type of file being compiled. Unfortunately this sometimes
+doesn't work, for example when using the aCC compiler on HP-UX. On
+systems like this you can use the CCACHE_EXTENSION option to override
+the default. On HP-UX set this environment variable to "i" if you use
+the aCC compiler.
+
+
CCACHE_STRIPC If you set the environment variable
+CCACHE_STRIPC then ccache will strip the -c option when invoking
+the preprocessor. This option is primarily for the Sun Workshop
+C++ compiler as without this option an unwarranted warning is displayed:
+CC: Warning: "-E" redefines product from "object" to "source (stdout)"
+when -E and -c is used together.
+
+
CCACHE_SWIG When using SWIG as the compiler and it does not
+have 'swig' in the executable name, then the CCACHE_SWIG environment
+variable needs to be set in order for ccache to work correctly with
+SWIG. The use of CCACHE_CPP2 is also recommended for SWIG due to some
+preprocessor quirks, however, use of CCACHE_CPP2 can often be skipped
+-- check your generated code with and without this option set. Known
+problems are using preprocessor directives within %inline blocks and
+the use of '#pragma SWIG'.
+
+
+
+
17.9 CACHE SIZE MANAGEMENT
+
+
+
+By default ccache has a one gigabyte limit on the cache size and no
+maximum number of files. You can set a different limit using the
+"ccache -M" and "ccache -F" options, which set the size and number of
+files limits.
+
+When these limits are reached ccache will reduce the cache to 20%
+below the numbers you specified in order to avoid doing the cache
+clean operation too often.
+
+
17.10 CACHE COMPRESSION
+
+
+
+By default on most platforms ccache will compress all files it puts
+into the cache
+using the zlib compression. While this involves a negligible
+performance slowdown, it significantly increases the number of files
+that fit in the cache. You can turn off compression setting the
+CCACHE_NOCOMPRESS environment variable.
+
+
17.11 HOW IT WORKS
+
+
+
+The basic idea is to detect when you are compiling exactly the same
+code a 2nd time and use the previously compiled output. You detect
+that it is the same code by forming a hash of:
+
+
+ the pre-processor output from running the compiler with -E
+ the command line options
+ the real compilers size and modification time
+ any stderr output generated by the compiler
+
+
+These are hashed using md4 (a strong hash) and a cache file is formed
+based on that hash result. When the same compilation is done a second
+time ccache is able to supply the correct compiler output (including
+all warnings etc) from the cache.
+
+ccache has been carefully written to always produce exactly the same
+compiler output that you would get without the cache. If you ever
+discover a case where ccache changes the output of your compiler then
+please let me know.
+
+
17.12 USING CCACHE WITH DISTCC
+
+
+
+distcc is a very useful program for distributing compilation across a
+range of compiler servers. It is often useful to combine distcc with
+ccache, so that compiles that are done are sped up by distcc, but that
+ccache avoids the compile completely where possible.
+
+To use distcc with ccache I recommend using the CCACHE_PREFIX
+option. You just need to set the environment variable CCACHE_PREFIX to
+'distcc' and ccache will prefix the command line used with the
+compiler with the command 'distcc'.
+
+
17.13 SHARING A CACHE
+
+
+
+A group of developers can increase the cache hit rate by sharing a
+cache directory. The hard links however cause unwanted side effects,
+as all links to a cached file share the file's modification timestamp.
+This results in false dependencies to be triggered by timestamp-based
+build systems whenever another user links to an existing
+file. Typically, users will see that their libraries and binaries are
+relinked without reason. To share a cache without side effects, the
+following conditions need to be met:
+
+
+ Use the same CCACHE_DIR environment variable setting
+ Unset the CCACHE_HARDLINK environment variable
+ Make sure everyone sets the CCACHE_UMASK environment variable
+ to 002, this ensures that cached files are accessible to everyone in
+ the group.
+ Make sure that all users have write permission in the entire
+ cache directory (and that you trust all users of the shared cache).
+ Make sure that the setgid bit is set on all directories in the
+ cache. This tells the filesystem to inherit group ownership for new
+ directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might
+ be useful for this.
+ Set CCACHE_NOCOMPRESS for all users, if there are users with
+ versions of ccache that do not support compression.
+
+
+
17.14 HISTORY
+
+
+
+ccache was inspired by the compilercache shell script script written
+by Erik Thiele and I would like to thank him for an excellent piece of
+work. See
+http://www.erikyyy.de/compilercache/
+for the Erik's scripts.
+ccache-swig is a port of the original ccache with support added for use
+with SWIG.
+
+I wrote ccache because I wanted to get a bit more speed out of a
+compiler cache and I wanted to remove some of the limitations of the
+shell-script version.
+
+
17.15 DIFFERENCES FROM COMPILERCACHE
+
+
+
+The biggest differences between Erik's compilercache script and ccache
+are:
+
+ ccache is written in C, which makes it a bit faster (calling out to
+ external programs is mostly what slowed down the scripts).
+ ccache can automatically find the real compiler
+ ccache keeps statistics on hits/misses
+ ccache can do automatic cache management
+ ccache can cache compiler output that includes warnings. In many
+ cases this gives ccache a much higher cache hit rate.
+ ccache can handle a much wider ranger of compiler options
+ ccache avoids a double call to cpp on a cache miss
+
+
+
17.16 CREDITS
+
+
+
+Thanks to the following people for their contributions to ccache
+
+ Erik Thiele for the original compilercache script
+ Luciano Rocha for the idea of compiling the pre-processor output
+ to avoid a 2nd cpp pass
+ Paul Russell for many suggestions and the debian packaging
+
+
+
17.17 AUTHOR
+
+
+
+ccache was written by Andrew Tridgell
+http://samba.org/~tridge/ .
+ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
+
+If you wish to report a problem or make a suggestion then please email
+the SWIG developers on the swig-devel mailing list, see
+http://www.swig.org/mail.html
+
+ccache is released under the GNU General Public License version 2 or
+later. Please see the file COPYING for license details.
+
+
+
+
+
diff --git a/Doc/Manual/CPlusPlus11.html b/Doc/Manual/CPlusPlus11.html
index b7e1d638ce3..714845bbab3 100644
--- a/Doc/Manual/CPlusPlus11.html
+++ b/Doc/Manual/CPlusPlus11.html
@@ -1,12 +1,13 @@
-
+
SWIG and C++11
+
- 7 SWIG and C++11
+7 SWIG and C++11
- 7.2.2 Generalized constant expressions
+7.2.2 Generalized constant expressions
SWIG parses and identifies the keyword constexpr , but cannot fully utilise it.
@@ -138,7 +139,7 @@
7.2.2 Generalized
When either of these is used from a target language, a runtime call is made to obtain the underlying constant.
- 7.2.3 Extern template
+7.2.3 Extern template
SWIG correctly parses the keywords extern template .
@@ -151,7 +152,7 @@
7.2.3 Extern template
%template(VectorInt) std::vector<int>; // SWIG instantiation
- 7.2.4 Initializer lists
+7.2.4 Initializer lists
@@ -283,7 +284,7 @@
7.2.4 Initializer lists
and hence any user supplied typemaps will override it and suppress the warning.
- 7.2.5 Uniform initialization
+7.2.5 Uniform initialization
The curly brackets {} for member initialization are fully
@@ -316,7 +317,7 @@
7.2.5 Uniform initializatio
142.15
- 7.2.6 Type inference
+7.2.6 Type inference
SWIG supports decltype() with some limitations. Single
@@ -333,13 +334,13 @@
7.2.6 Type inference
decltype(i+j) k; // syntax error
- 7.2.7 Range-based for-loop
+7.2.7 Range-based for-loop
This feature is part of the implementation block only. SWIG
ignores it.
- 7.2.8 Lambda functions and expressions
+7.2.8 Lambda functions and expressions
SWIG correctly parses most of the Lambda functions syntax. For example:
@@ -365,7 +366,7 @@ 7.2.8 Lambda func
Better support should be available in a later release.
- 7.2.9 Alternate function syntax
+7.2.9 Alternate function syntax
SWIG fully supports the new definition of functions. For example:
@@ -400,7 +401,7 @@ 7.2.9 Alternate function
auto square(float a, float b) -> decltype(a);
- 7.2.10 Object construction improvement
+7.2.10 Object construction improvement
@@ -463,7 +464,7 @@
7.2.10 Object cons
};
- 7.2.11 Explicit overrides and final
+7.2.11 Explicit overrides and final
@@ -487,12 +488,12 @@
7.2.11 Explicit overrides
- 7.2.12 Null pointer constant
+7.2.12 Null pointer constant
The nullptr constant is mostly unimportant in wrappers. In the few places it has an effect, it is treated like NULL .
- 7.2.13 Strongly typed enumerations
+7.2.13 Strongly typed enumerations
SWIG supports strongly typed enumerations and parses the new enum class syntax and forward declarator for the enums, such as:
@@ -548,7 +549,7 @@ 7.2.13 Strongly typed
System.out.println(Color.RainbowColors.Red.swigValue() + " " + Color.WarmColors.Red.swigValue() + " " + Color.PrimeColors.Red.swigValue());
- 7.2.14 Double angle brackets
+7.2.14 Double angle brackets
SWIG correctly parses the symbols >> as closing the
@@ -559,7 +560,7 @@
7.2.14 Double angle brackets
std::vector<std::vector<int>> myIntTable;
- 7.2.15 Explicit conversion operators
+7.2.15 Explicit conversion operators
SWIG correctly parses the keyword explicit for operators in addition to constructors now.
@@ -602,7 +603,7 @@
7.2.15 Explicit conv
them available as a normal proxy method.
- 7.2.16 Alias templates
+7.2.16 Alias templates
@@ -656,7 +657,7 @@
7.2.16 Alias templates
typedef void (*PFD)(double); // The old style
- 7.2.17 Unrestricted unions
+7.2.17 Unrestricted unions
SWIG fully supports any type inside a union even if it does not
@@ -682,7 +683,7 @@
7.2.17 Unrestricted unions
- 7.2.18 Variadic templates
+7.2.18 Variadic templates
SWIG supports the variadic templates syntax (inside the <>
@@ -717,7 +718,7 @@
7.2.18 Variadic templates
In the above example SIZE is of course wrapped as a constant.
- 7.2.19 New string literals
+7.2.19 New string literals
SWIG supports wide string and Unicode string constants and raw string literals.
@@ -747,7 +748,7 @@ 7.2.19 New string literals
- 7.2.20 User-defined literals
+7.2.20 User-defined literals
@@ -814,7 +815,7 @@
7.2.20 User-defined literals
OutputType var3 = 3.1416_suffix;
- 7.2.21 Thread-local storage
+7.2.21 Thread-local storage
SWIG correctly parses the thread_local keyword. For example, variables
@@ -834,7 +835,7 @@
7.2.21 Thread-local storage
same way that it will be thread local if accessed from C++ code.
- 7.2.22 Explicitly defaulted functions and deleted functions
+7.2.22 Explicitly defaulted functions and deleted functions
SWIG handles explicitly defaulted functions, that is, = default added to a function declaration. Deleted definitions, which are also called deleted functions, have = delete added to the function declaration.
@@ -872,12 +873,12 @@
7.2.22 Explicitly defaulted func
so in this case it is entirely possible to pass an int instead of a double to f from Java, Python etc.
- 7.2.23 Type long long int
+7.2.23 Type long long int
SWIG correctly parses and uses the new long long type already introduced in C99 some time ago.
- 7.2.24 Static assertions
+7.2.24 Static assertions
@@ -892,7 +893,7 @@
7.2.24 Static assertions
};
- 7.2.25 Allow sizeof to work on members of classes without an explicit object
+7.2.25 Allow sizeof to work on members of classes without an explicit object
@@ -913,7 +914,7 @@
7.2.25 Allow sizeof to work on members of c
8
- 7.2.26 Exception specifications and noexcept
+7.2.26 Exception specifications and noexcept
@@ -929,7 +930,7 @@
7.2.26 Exception specifications and noexc
int noex3(int, bool) noexcept(false);
- 7.2.27 Control and query object alignment
+7.2.27 Control and query object alignment
@@ -961,7 +962,7 @@
7.2.27 Control and query object alignmen
- 7.2.28 Attributes
+7.2.28 Attributes
@@ -974,10 +975,10 @@
7.2.28 Attributes
[[noreturn, nothrow]] void f [[noreturn]] ();
- 7.3 Standard library changes
+7.3 Standard library changes
- 7.3.1 Threading facilities
+7.3.1 Threading facilities
SWIG does not currently wrap or use any of the new threading
@@ -985,7 +986,7 @@
7.3.1 Threading facilities
- 7.3.2 Tuple types
+7.3.2 Tuple types
@@ -993,7 +994,7 @@
7.3.2 Tuple types
Variadic template support requires further work to provide substantial tuple wrappers.
- 7.3.3 Hash tables
+7.3.3 Hash tables
@@ -1001,14 +1002,14 @@
7.3.3 Hash tables
These are not available in SWIG, but in principle should be easily implemented by adapting the current STL containers.
- 7.3.4 Regular expressions
+7.3.4 Regular expressions
While SWIG could provide wrappers for the new C++11 regular expressions classes, there is little need as the target languages have their own regular expression facilities.
- 7.3.5 General-purpose smart pointers
+7.3.5 General-purpose smart pointers
@@ -1017,12 +1018,12 @@
7.3.5 General-purpo
There is no special smart pointer handling available for std::weak_ptr and std::unique_ptr yet.
- 7.3.6 Extensible random number facility
+7.3.6 Extensible random number facility
This feature extends and standardizes the standard library only and does not effect the C++ language nor SWIG.
- 7.3.7 Wrapper reference
+7.3.7 Wrapper reference
@@ -1033,7 +1034,7 @@
7.3.7 Wrapper reference
- 7.3.8 Polymorphous wrappers for function objects
+7.3.8 Polymorphous wrappers for function objects
@@ -1064,7 +1065,7 @@
7.3.8 P
b = t(1,2) # invoke C++ function object
- 7.3.9 Type traits for metaprogramming
+7.3.9 Type traits for metaprogramming
The type_traits functions to support C++ metaprogramming is useful at compile time and is aimed specifically at C++ development:
@@ -1114,7 +1115,7 @@ 7.3.9 Type traits
2
- 7.3.10 Uniform method for computing return type of function objects
+7.3.10 Uniform method for computing return type of function objects
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index ba49fa00434..0cbc9ec2404 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -1,17 +1,19 @@
-
+
SWIG and C#
+
- 20 SWIG and C#
+20 SWIG and C#
-
Multiples modules
+Multiple modules
C# Typemap examples
Memory management when returning references to member variables
@@ -52,7 +54,7 @@ 20 SWIG and C#
- 20.1 Introduction
+20.1 Introduction
@@ -69,17 +71,70 @@
20.1 Introduction
To get the most out of this chapter an understanding of interop is required.
The Microsoft Developer Network (MSDN) has a good reference guide in a section titled "Interop Marshaling".
-Monodoc, available from the Mono project, has a very useful section titled Interop with native libraries .
+Monodoc, available from the Mono project, has a very useful section titled Interop with native libraries .
- 20.1.1 SWIG 2 Compatibility
+20.1.1 SWIG 2 Compatibility
In order to minimize name collisions between names generated based on input to SWIG and names used in the generated code from the .NET framework, SWIG 3 fully qualifies the use of all .NET types. Furthermore, SWIG 3 avoids using directives in generated code. This breaks backwards compatibility with typemaps, pragmas, etc written for use with SWIG 2 that assume the presence of using System; or using System.Runtime.InteropServices; directives in the intermediate class imports, module imports, or proxy imports. SWIG 3 supports backwards compatibility though the use of the SWIG2_CSHARP macro. If SWIG2_CSHARP is defined, SWIG 3 generates using directives in the intermediate class, module class, and proxy class code similar to those generated by SWIG 2. This can be done without modifying any of the input code by passing the -DSWIG2_CSHARP commandline parameter when executing swig .
- 20.2 Differences to the Java module
+
+20.1.2 Additional command line options
+
+
+
+The following table lists the additional commandline options available for the C# module. They can also be seen by using:
+
+
+
+
+
+
+C# specific options
+
+
+
+-dllimport <dl>
+Override DllImport attribute name to <dl>
+
+
+
+-namespace <nm>
+Generate wrappers into C# namespace <nm>
+
+
+
+-noproxy
+Generate the low-level functional interface instead of proxy classes
+
+
+
+-oldvarnames
+Old intermediary method names for variable wrappers
+
+
+
+-outfile <file>
+Write all C# into a single <file> located in the output directory
+
+
+
+
+
+
+The -outfile option combines all the generated C# code into a single output file instead of creating multiple C# files.
+The default, when this option is not provided, is to generate separate .cs files for the module class,
+intermediary class and each of the generated proxy and type wrapper classes.
+Note that the file extension (.cs) will not be automatically added and needs to be provided.
+Due to possible compiler limits it is not advisable to use -outfile for large projects.
+
+
+20.2 Differences to the Java module
@@ -492,7 +547,7 @@
20.2 Differences to the Java moduleCygwin or MinGW environment for automatic configuration of the example makefiles.
Any one of the three C# compilers (Portable.NET, Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
- 20.3 Void pointers
+20.3 Void pointers
@@ -510,7 +565,7 @@
20.3 Void pointers
- 20.4 C# Arrays
+20.4 C# Arrays
@@ -522,7 +577,7 @@
20.4 C# Arrays
pinned arrays.
- 20.4.1 The SWIG C arrays library
+20.4.1 The SWIG C arrays library
@@ -559,7 +614,7 @@
20.4.1 The SWIG C arrays library
- 20.4.2 Managed arrays using P/Invoke default array marshalling
+20.4.2 Managed arrays using P/Invoke default array marshalling
@@ -686,7 +741,7 @@
20.4.2 Managed
- 20.4.3 Managed arrays using pinning
+20.4.3 Managed arrays using pinning
@@ -781,7 +836,7 @@
20.4.3 Managed arrays using pinning
- 20.5 C# Exceptions
+20.5 C# Exceptions
@@ -878,7 +933,7 @@
20.5 C# Exceptions
- 20.5.1 C# exception example using "check" typemap
+20.5.1 C# exception example using "check" typemap
@@ -1060,7 +1115,7 @@
20.5.1 C# exception exa
Actually it will issue this warning for any function beginning with SWIG_CSharpSetPendingException .
- 20.5.2 C# exception example using %exception
+20.5.2 C# exception example using %exception
@@ -1126,7 +1181,7 @@
20.5.2 C# exception
- 20.5.3 C# exception example using exception specifications
+20.5.3 C# exception example using exception specifications
@@ -1183,7 +1238,7 @@
20.5.3 C# ex
Multiple catch handlers are generated should there be more than one exception specifications declared.
- 20.5.4 Custom C# ApplicationException example
+20.5.4 Custom C# ApplicationException example
@@ -1317,7 +1372,7 @@
20.5.4 Custom C# Applicati
- 20.6 C# Directors
+20.6 C# Directors
@@ -1330,7 +1385,7 @@
20.6 C# Directors
However, the Java directors section should also be read in order to gain more insight into directors.
- 20.6.1 Directors example
+20.6.1 Directors example
@@ -1451,7 +1506,7 @@
20.6.1 Directors example
- 20.6.2 Directors implementation
+20.6.2 Directors implementation
@@ -1634,7 +1689,7 @@
20.6.2 Directors implementatio
- 20.6.3 Director caveats
+20.6.3 Director caveats
@@ -1682,11 +1737,11 @@
20.6.3 Director caveats
should pass the call on to CSharpDefaults.DefaultMethod(int) using the C++ default value, as shown above.
- 20.7 Multiples modules
+20.7 Multiple modules
-When using multiple modules it is is possible to compile each SWIG generated wrapper
+When using multiple modules it is is possible to compile each SWIG generated wrapper
into a different assembly.
However, by default the generated code may not compile if
generated classes in one assembly use generated classes in another assembly.
@@ -1717,7 +1772,7 @@
20.7 Multiples modules
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers.
- 20.8 C# Typemap examples
+20.8 C# Typemap examples
This section includes a few examples of typemaps. For more examples, you
@@ -1725,7 +1780,7 @@ 20.8 C# Typemap examples
the SWIG library.
- 20.8.1 Memory management when returning references to member variables
+20.8.1 Memory management when returning references to member variables
@@ -1849,7 +1904,7 @@
20.8.1 Memory manage
Note the addReference call.
- 20.8.2 Memory management for objects passed to the C++ layer
+20.8.2 Memory management for objects passed to the C++ layer
@@ -1968,7 +2023,7 @@
20.8.2 Memory management for
- 20.8.3 Date marshalling using the csin typemap and associated attributes
+20.8.3 Date marshalling using the csin typemap and associated attributes
@@ -2254,7 +2309,7 @@
20.8.3 Date marshalling using the csin
- 20.8.4 A date example demonstrating marshalling of C# properties
+20.8.4 A date example demonstrating marshalling of C# properties
@@ -2354,7 +2409,7 @@
20.8.4 A date example demonstrating mar
The 'csin' typemap has 'pre', 'post' and 'cshin' attributes, and these are all ignored in the property set. The code in these attributes must instead be replicated within the 'csvarin' typemap. The line creating the temp$csinput variable is such an example; it is identical to what is in the 'pre' attribute.
- 20.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors
+20.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors
@@ -2416,7 +2471,7 @@
20.8.5 Date example demonstrati
- 20.8.6 Turning wrapped classes into partial classes
+20.8.6 Turning wrapped classes into partial classes
@@ -2516,7 +2571,7 @@
20.8.6 Turning wrapped classes into par
The following example is an alternative approach to adding managed code to the generated proxy class.
- 20.8.7 Extending proxy classes with additional C# code
+20.8.7 Extending proxy classes with additional C# code
@@ -2555,7 +2610,7 @@
20.8.7 Extending proxy classes wi
- 20.8.8 Underlying type for enums
+20.8.8 Underlying type for enums
diff --git a/Doc/Manual/Chicken.html b/Doc/Manual/Chicken.html
index 82861c31c74..820d01fde14 100644
--- a/Doc/Manual/Chicken.html
+++ b/Doc/Manual/Chicken.html
@@ -1,14 +1,14 @@
-
-
+
SWIG and Chicken
+
- 21 SWIG and Chicken
+21 SWIG and Chicken
@@ -55,10 +55,10 @@ 21 SWIG and Chicken
- generates portable C code
- includes a customizable interpreter
- links to C libraries with a simple Foreign Function Interface
- supports full tail-recursion and first-class continuations
+ generates portable C code
+ includes a customizable interpreter
+ links to C libraries with a simple Foreign Function Interface
+ supports full tail-recursion and first-class continuations
@@ -72,7 +72,7 @@
21 SWIG and Chicken
- 21.1 Preliminaries
+21.1 Preliminaries
@@ -89,7 +89,7 @@
21.1 Preliminaries
directory for the basic steps to run SWIG CHICKEN.
- 21.1.1 Running SWIG in C mode
+21.1.1 Running SWIG in C mode
@@ -98,7 +98,7 @@
21.1.1 Running SWIG in C mode
-
% swig -chicken example.i
+
% swig -chicken example.i
@@ -122,7 +122,7 @@
21.1.1 Running SWIG in C mode
object files and linked into your project.
- 21.1.2 Running SWIG in C++ mode
+21.1.2 Running SWIG in C++ mode
@@ -131,7 +131,7 @@
21.1.2 Running SWIG in C++ mode
-
% swig -chicken -c++ example.i
+
% swig -chicken -c++ example.i
@@ -142,7 +142,7 @@
21.1.2 Running SWIG in C++ mode
-
% chicken example.scm -output-file oexample.c
+
% chicken example.scm -output-file oexample.c
@@ -151,10 +151,10 @@
21.1.2 Running SWIG in C++ mode
object files and linked into your project.
- 21.2 Code Generation
+21.2 Code Generation
- 21.2.1 Naming Conventions
+21.2.1 Naming Conventions
@@ -170,16 +170,16 @@
21.2.1 Naming Conventions
%rename SWIG directive in the SWIG interface file.
- 21.2.2 Modules
+21.2.2 Modules
The name of the module must be declared one of two ways:
- Placing %module example in the SWIG interface
- file.
- Using -module example on the SWIG command
- line.
+ Placing %module example in the SWIG interface
+ file.
+ Using -module example on the SWIG command
+ line.
@@ -189,10 +189,10 @@
21.2.2 Modules
CHICKEN will be able to access the module using the (declare
- (uses modulename ))
CHICKEN Scheme form.
+ (uses modulename )) CHICKEN Scheme form.
- 21.2.3 Constants and Variables
+21.2.3 Constants and Variables
@@ -200,10 +200,10 @@
21.2.3 Constants and Variables
the interface file:
- #define MYCONSTANT1 ...
- %constant int MYCONSTANT2 = ...
- const int MYCONSTANT3 = ...
- enum { MYCONSTANT4 = ... };
+ #define MYCONSTANT1 ...
+ %constant int MYCONSTANT2 = ...
+ const int MYCONSTANT3 = ...
+ enum { MYCONSTANT4 = ... };
@@ -229,7 +229,7 @@
21.2.3 Constants and Variables
for info on how to apply the %feature.
- 21.2.4 Functions
+21.2.4 Functions
@@ -248,7 +248,7 @@
21.2.4 Functions
parameters). The return values can then be accessed with (call-with-values)
.
- 21.2.5 Exceptions
+21.2.5 Exceptions
The SWIG chicken module has support for exceptions thrown from
@@ -290,16 +290,16 @@
21.2.5 Exceptions
- 21.3 TinyCLOS
+21.3 TinyCLOS
The author of TinyCLOS, Gregor Kiczales, describes TinyCLOS as:
- "Tiny CLOS is a Scheme implementation of a `kernelized' CLOS, with a
- metaobject protocol. The implementation is even simpler than
- the simple CLOS found in `The Art of the Metaobject Protocol,'
- weighing in at around 850 lines of code, including (some)
- comments and documentation."
+ "Tiny CLOS is a Scheme implementation of a `kernelized' CLOS, with a
+ metaobject protocol. The implementation is even simpler than
+ the simple CLOS found in `The Art of the Metaobject Protocol,'
+ weighing in at around 850 lines of code, including (some)
+ comments and documentation."
@@ -333,7 +333,7 @@
21.3 TinyCLOS
- 21.4 Linkage
+21.4 Linkage
@@ -354,7 +354,7 @@
21.4 Linkage
- 21.4.1 Static binary or shared library linked at compile time
+21.4.1 Static binary or shared library linked at compile time
We can easily use csc to build a static binary.
@@ -395,7 +395,7 @@ 21.4.1 Static binary or shared library linked at
be run with csi .
- 21.4.2 Building chicken extension libraries
+21.4.2 Building chicken extension libraries
Building a shared library like in the above section only works if the library
@@ -453,7 +453,7 @@
21.4.2 Building chicken extension libraries
See the Examples/chicken/egg directory in the SWIG source for an example that builds
two eggs, one using the first method and one using the second method.
- 21.4.3 Linking multiple SWIG modules with TinyCLOS
+21.4.3 Linking multiple SWIG modules with TinyCLOS
Linking together multiple modules that share type information using the %import
@@ -477,7 +477,7 @@
21.4.3 Linking multiple SWIG modules with TinyCLO
To create an extension library or an egg, just create a module_load.scm file that (declare (uses ...))
all the modules.
- 21.5 Typemaps
+21.5 Typemaps
@@ -486,7 +486,7 @@
21.5 Typemaps
Lib/chicken/chicken.swg
.
- 21.6 Pointers
+21.6 Pointers
@@ -519,7 +519,7 @@
21.6 Pointers
type. flags is either zero or SWIG_POINTER_DISOWN (see below).
- 21.6.1 Garbage collection
+21.6.1 Garbage collection
If the owner flag passed to SWIG_NewPointerObj
is 1, NewPointerObj
will add a
@@ -550,7 +550,7 @@
21.6.1 Garbage collection
must be called manually.
- 21.7 Unsupported features and known problems
+21.7 Unsupported features and known problems
- 21.7.1 TinyCLOS problems with Chicken version <= 1.92
+21.7.1 TinyCLOS problems with Chicken version <= 1.92
In Chicken versions equal to or below 1.92, TinyCLOS has a limitation such that generic methods do not properly work on methods
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index 51d4edaa444..55d16ee1a13 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -1,10 +1,12 @@
-
+
SWIG Users Manual
+
+
SWIG Users Manual
@@ -142,8 +144,8 @@
5 SWIG Basics
Basic Type Handling
Global Variables
Constants
-A brief word about const
-A cautionary tale of char *
+A brief word about const
+A cautionary tale of char *
Pointers and complex objects
+Special variables and typemap attributes
+Special variables combined with special variable macros
Common typemap methods
Typemaps and overloading
-More about %apply and %clear
+More about %apply and %clear
Passing data between typemaps
C++ "this" pointer
Where to go for more information?
@@ -725,6 +729,7 @@ 20 SWIG and C#
Introduction
Differences to the Java module
Void pointers
@@ -747,7 +752,7 @@ 20 SWIG and C#
Directors implementation
Director caveats
-Multiples modules
+Multiple modules
C# Typemap examples
-%feature s
+D and %feature
Pragmas
D Exceptions
D Directors
Other features
Further details on the generated Java classes
Embedded Webkit
Creating Applications with node-webkit
-Examples
+Examples
Exceptions
@@ -1309,6 +1328,10 @@ 32 SWIG and Octave
Class extension with %extend
C++ templates
C++ Smart Pointers
+
Directors (calling Octave from C++ code)
Threads
Memory management
@@ -1414,7 +1437,7 @@ 34 SWIG and PHP
Pointers and References
Structures and C++ classes
Further details on the Python class interface
@@ -1529,6 +1556,7 @@ 36 SWIG and Python
Simple pointers
Unbounded C Arrays
String handling
+Default arguments
Typemaps
@@ -1629,6 +1658,10 @@ 38 SWIG and Ruby
C++ STL Functors
C++ STL Iterators
C++ Smart Pointers
+
Cross-Language Polymorphism
Exception Unrolling
@@ -1727,7 +1760,76 @@ 38 SWIG and Ruby
-39 SWIG and Tcl
+39 SWIG and Scilab
+
+
+
+
+
+40 SWIG and Tcl
-40 Extending SWIG to support new languages
+41 Extending SWIG to support new languages
diff --git a/Doc/Manual/Contract.html b/Doc/Manual/Contract.html
index 35bc874ef06..4b4995819a3 100644
--- a/Doc/Manual/Contract.html
+++ b/Doc/Manual/Contract.html
@@ -1,12 +1,13 @@
-
+
Contract Checking
+
-
13 Contracts
+
13 Contracts
@@ -38,7 +39,7 @@ 13 Contracts
generated rather than having the program continue to execute.
- 13.1 The %contract directive
+13.1 The %contract directive
@@ -94,7 +95,7 @@
13.1 The %contract directive
-
13.2 %contract and classes
+
13.2 %contract and classes
@@ -173,7 +174,7 @@
13.2 %contract and classes
this means that both the arguments to
Spam::bar must be positive.
-
13.3 Constant aggregation and %aggregate_check
+
13.3 Constant aggregation and %aggregate_check
@@ -262,7 +263,7 @@
13.3 Constant aggregation and %aggregate_check
- 13.4 Notes
+13.4 Notes
diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html
index 8e26a7e8a0d..8705534f9dd 100644
--- a/Doc/Manual/Customization.html
+++ b/Doc/Manual/Customization.html
@@ -1,12 +1,13 @@
-
+
Customization Features
+
-
12 Customization Features
+
12 Customization Features
@@ -45,7 +46,7 @@ 12 Customization Features
customization mechanism known as "features" is described.
- 12.1 Exception handling with %exception
+12.1 Exception handling with %exception
@@ -100,7 +101,7 @@
12.1 Exception handling with %exceptio
provides the same functionality, but is substantially more flexible.
- 12.1.1 Handling exceptions in C code
+12.1.1 Handling exceptions in C code
@@ -115,16 +116,18 @@
12.1.1 Handling exceptions in C code
static int error_status = 0;
void throw_exception(char *msg) {
- strncpy(error_message,msg,256);
- error_status = 1;
+ strncpy(error_message,msg,256);
+ error_status = 1;
}
void clear_exception() {
- error_status = 0;
+ error_status = 0;
}
char *check_exception() {
- if (error_status) return error_message;
- else return NULL;
+ if (error_status)
+ return error_message;
+ else
+ return NULL;
}
@@ -136,13 +139,13 @@
12.1.1 Handling exceptions in C code
double inv(double x) {
- if (x != 0) return 1.0/x;
- else {
- throw_exception("Division by zero");
- return 0;
- }
+ if (x != 0)
+ return 1.0/x;
+ else {
+ throw_exception("Division by zero");
+ return 0;
+ }
}
-
@@ -151,12 +154,12 @@
12.1.1 Handling exceptions in C code
%exception {
- char *err;
- clear_exception();
- $action
- if ((err = check_exception())) {
- croak(err);
- }
+ char *err;
+ clear_exception();
+ $action
+ if ((err = check_exception())) {
+ croak(err);
+ }
}
@@ -166,7 +169,7 @@
12.1.1 Handling exceptions in C code
and for Perl it is the
croak method shown above.
-
12.1.2 Exception handling with longjmp()
+
12.1.2 Exception handling with longjmp()
@@ -206,8 +209,10 @@
12.1.2 Exception handling with longjmp()
double inv(double x) {
- if (x) return 1.0/x;
- else throw(DivisionByZero);
+ if (x)
+ return 1.0/x;
+ else
+ throw(DivisionByZero);
}
@@ -221,17 +226,17 @@ 12.1.2 Exception handling with longjmp()
@@ -240,7 +245,7 @@ 12.1.2 Exception handling with longjmp() try declarations.
- 12.1.3 Handling C++ exceptions
+12.1.3 Handling C++ exceptions
@@ -249,17 +254,17 @@
12.1.3 Handling C++ exceptions
%exception {
- try {
- $action
- } catch(RangeError) {
- croak("Range Error");
- } catch(DivisionByZero) {
- croak("Division by zero");
- } catch(OutOfMemory) {
- croak("Out of memory");
- } catch(...) {
- croak("Unknown exception");
- }
+ try {
+ $action
+ } catch(RangeError) {
+ croak("Range Error");
+ } catch(DivisionByZero) {
+ croak("Division by zero");
+ } catch(OutOfMemory) {
+ croak("Out of memory");
+ } catch(...) {
+ croak("Unknown exception");
+ }
}
@@ -275,7 +280,7 @@ 12.1.3 Handling C++ exceptions
- 12.1.4 Exception handlers for variables
+12.1.4 Exception handlers for variables
@@ -300,7 +305,7 @@
12.1.4 Exception handlers for variab
- 12.1.5 Defining different exception handlers
+12.1.5 Defining different exception handlers
@@ -319,7 +324,7 @@
12.1.5 Defining different exception handlers
%exception {
- ... your exception handler ...
+ ... your exception handler ...
}
/* Define critical operations that can throw exceptions here */
@@ -437,7 +442,7 @@ 12.1.5 Defining different exception handlers
%exception directive is much better.
- 12.1.6 Special variables for %exception
+12.1.6 Special variables for %exception
@@ -540,7 +545,7 @@
12.1.6 Special varia
- 12.1.7 Using The SWIG exception library
+12.1.7 Using The SWIG exception library
@@ -595,7 +600,7 @@
12.1.7 Using The SWIG exception library
The SWIG_exception() function can also be used in typemaps.
- 12.2 Object ownership and %newobject
+12.2 Object ownership and %newobject
@@ -752,7 +757,7 @@
12.2 Object ownership and %newobject
The results might not be what you expect.
- 12.3 Features and the %feature directive
+12.3 Features and the %feature directive
@@ -834,7 +839,7 @@
12.3 Features and the %feature directiv
The syntax in the first variation will generate the { } delimiters used whereas the other variations will not.
- 12.3.1 Feature attributes
+12.3.1 Feature attributes
@@ -875,7 +880,7 @@
12.3.1 Feature attributes Java exception handling section.
- 12.3.2 Feature flags
+12.3.2 Feature flags
@@ -973,7 +978,7 @@
12.3.2 Feature flags
The concept of clearing features is discussed next.
- 12.3.3 Clearing features
+12.3.3 Clearing features
@@ -1066,7 +1071,7 @@
12.3.3 Clearing features
- 12.3.4 Features and default arguments
+12.3.4 Features and default arguments
@@ -1141,7 +1146,7 @@
12.3.4 Features and defaul
in SWIG-1.3.23 when the approach to wrapping methods with default arguments was changed.
- 12.3.5 Feature example
+12.3.5 Feature example
diff --git a/Doc/Manual/D.html b/Doc/Manual/D.html
index 47dab50f17d..9e8e6535897 100644
--- a/Doc/Manual/D.html
+++ b/Doc/Manual/D.html
@@ -1,4 +1,4 @@
-
+
SWIG and D
@@ -6,7 +6,7 @@
- 22 SWIG and D
+22 SWIG and D
-
%feature s
+D and %feature
Pragmas
D Exceptions
D Directors
Other features
-Extended namespace support (nspace )
+Extended namespace support (nspace)
Native pointer support
Operator overloading
Running the test-suite
@@ -41,7 +41,7 @@ 22 SWIG and D
- 22.1 Introduction
+22.1 Introduction
From the D Programming Language web site: D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code. As such, it is not very surprising that D is able to directly interface with C libraries . Why would a SWIG module for D be needed then in the first place?
@@ -50,10 +50,10 @@ 22.1 Introduction
While these issues can be worked around relatively easy by hand-coding a thin wrapper layer around the C library in question, there is another issue where writing wrapper code per hand is not feasible: C++ libraries. D did not support interfacing to C++ in version 1 at all, and even if extern(C++) has been added to D2, the support is still very limited, and a custom wrapper layer is still required in many cases.
-To help addressing these issues, the SWIG C# module has been forked to support D. Is has evolved quite a lot since then, but there are still many similarities, so if you do not find what you are looking for on this page, it might be worth having a look at the chapter on C# (and also on Java , since the C# module was in turn forked from it).
+To help addressing these issues, the SWIG C# module has been forked to support D. Is has evolved quite a lot since then, but there are still many similarities, so if you do not find what you are looking for on this page, it might be worth having a look at the chapter on C# (and also on Java , since the C# module was in turn forked from it).
- 22.2 Command line invocation
+22.2 Command line invocation
To activate the D module, pass the -d option to SWIG at the command line. The same standard command line switches as with any other language module are available, plus the following D specific ones:
@@ -64,7 +64,7 @@ 22.2 Command line invocation
By default, SWIG generates code for D1/Tango. Use the -d2 flag to target D2/Phobos instead.
- -splitproxy
+ -splitproxy
By default, SWIG generates two D modules: the proxy module, named like the source module (either specified via the %module directive or via the module command line switch), which contains all the proxy classes, functions, enums, etc., and the intermediary module (named like the proxy module, but suffixed with _im ), which contains all the extern(C) function declarations and other private parts only used internally by the proxy module.
If the split proxy mode is enabled by passing this switch at the command line, all proxy classes and enums are emitted to their own D module instead. The main proxy module only contains free functions and constants in this case.
@@ -83,10 +83,10 @@ 22.2 Command line invocation
- 22.3 Typemaps
+22.3 Typemaps
- 22.3.1 C# <-> D name comparison
+22.3.1 C# <-> D name comparison
If you already know the SWIG C# module, you might find the following name comparison table useful:
@@ -112,7 +112,7 @@ 22.3.1 C# <-> D name compariso
- 22.3.2 ctype, imtype, dtype
+22.3.2 ctype, imtype, dtype
Mapping of types between the C/C++ library, the C/C++ library wrapper exposing the C functions, the D wrapper module importing these functions and the D proxy code.
@@ -120,26 +120,26 @@ 22.3.2 ctype, imtype, dtype
The ctype typemap is used to determine the types to use in the C wrapper functions. The types from the imtype typemap are used in the extern(C) declarations of these functions in the intermediary D module. The dtype typemap contains the D types used in the D proxy module/class.
- 22.3.3 in, out, directorin, directorout
+22.3.3 in, out, directorin, directorout
Used for converting between the types for C/C++ and D when generating the code for the wrapper functions (on the C++ side).
-The code from the in typemap is used to convert arguments to the C wrapper function to the type used in the wrapped code (ctype ->original C++ type), the out typemap is utilized to convert values from the wrapped code to wrapper function return types (original C++ type->ctype ).
+The code from the in typemap is used to convert arguments to the C wrapper function to the type used in the wrapped code (ctype ->original C++ type), the out typemap is utilized to convert values from the wrapped code to wrapper function return types (original C++ type->ctype ).
The directorin typemap is used to convert parameters to the type used in the D director callback function, its return value is processed by directorout (see below).
- 22.3.4 din, dout, ddirectorin, ddirectorout
+22.3.4 din, dout, ddirectorin, ddirectorout
Typemaps for code generation in D proxy and type wrapper classes.
-The din typemap is used for converting function parameter types from the type used in the proxy module or class to the type used in the intermediary D module (the $dinput macro is replaced). To inject further parameter processing code before or after the call to the intermediary layer, the pre , post and terminator attributes can be used (please refer to the C# date marshalling example for more information on these).
+ The din typemap is used for converting function parameter types from the type used in the proxy module or class to the type used in the intermediary D module (the $dinput macro is replaced). To inject further parameter processing code before or after the call to the intermediary layer, the pre , post and terminator attributes can be used (please refer to the C# date marshalling example for more information on these).
-The dout typemap is used for converting function return values from the return type used in the intermediary D module to the type returned by the proxy function. The $excode special variable in dout typemaps is replaced by the excode typemap attribute code if the method can throw any exceptions from unmanaged code, otherwise by nothing (the $imcall and $owner macros are replaced).
+ The dout typemap is used for converting function return values from the return type used in the intermediary D module to the type returned by the proxy function. The $excode special variable in dout typemaps is replaced by the excode typemap attribute code if the method can throw any exceptions from unmanaged code, otherwise by nothing (the $imcall and $owner macros are replaced).
-The code from the ddirectorin and ddirectorout typemaps is used for conversion in director callback functions. Arguments are converted to the type used in the proxy class method they are calling by using the code from ddirectorin , the proxy class method return value is converted to the type the C++ code expects via the ddirectorout typemap (the $dcall and $winput macros are replaced).
+ The code from the ddirectorin and ddirectorout typemaps is used for conversion in director callback functions. Arguments are converted to the type used in the proxy class method they are calling by using the code from ddirectorin , the proxy class method return value is converted to the type the C++ code expects via the ddirectorout typemap (the $dcall and $winput macros are replaced).
The full chain of type conversions when a director callback is invoked looks like this:
@@ -157,13 +157,13 @@ 22.3.4 din, dout, ddirecto
dtype DClass.method(dtype a)
- 22.3.5 typecheck typemaps
+22.3.5 typecheck typemaps
Because, unlike many scripting languages supported by SWIG, D does not need any dynamic dispatch helper to access an overloaded function, the purpose of these is merely to issue a warning for overloaded C++ functions that cannot be overloaded in D (as more than one C++ type maps to a single D type).
- 22.3.6 Code injection typemaps
+22.3.6 Code injection typemaps
These typemaps are used for generating the skeleton of proxy classes for C++ types.
@@ -172,10 +172,10 @@ 22.3.6 Code injection typemaps
Using dcode and dimports , you can specify additional D code which will be emitted into the class body respectively the imports section of the D module the class is written to.
-dconstructor , ddestructor , ddispose and ddispose_derived are used to generate the class constructor, destructor and dispose() method, respectively. The auxiliary code for handling the pointer to the C++ object is stored in dbody and dbody_derived . You can override them for specific types.
+dconstructor , ddestructor , ddispose and ddispose_derived are used to generate the class constructor, destructor and dispose() method, respectively. The auxiliary code for handling the pointer to the C++ object is stored in dbody and dbody_derived . You can override them for specific types.
- 22.3.7 Special variable macros
+22.3.7 Special variable macros
The standard SWIG special variables are available for use within typemaps as described in the Typemaps documentation , for example $1 , $input , $result etc.
@@ -197,7 +197,7 @@ 22.3.7 Special variable macros
$null
In code inserted into the generated C/C++ wrapper functions, this variable is replaced by either 0 or nothing at all, depending on whether the function has a return value or not. It can be used to bail out early e.g. in case of errors (return $null; ).
- $dinput (C#: $csinput )
+ $dinput (C#: $csinput )
This variable is used in din typemaps and is replaced by the expression which is to be passed to C/C++.
For example, this input
@@ -214,7 +214,7 @@ 22.3.7 Special variable macros
example_im.foo(SomeClass.getCPointer(arg));
}
- $imcall and $owner (C#: $imcall )
+ $imcall and $owner (C#: $imcall )
These variables are used in dout typemaps. $imcall contains the call to the intermediary module which provides the value to be used, and $owner signals if the caller is responsible for managing the object lifetime (that is, if the called method is a constructor or has been marked via %newobject ).
Consider the following example:
@@ -243,7 +243,7 @@ 22.3.7 Special variable macros
$dcall and $winput (C#: $cscall , $iminput )
- These variables are used in the director-specific typemaps ddirectorin and ddirectorout . They are more or less the reverse of the $imcall and $dinput macros: $dcall contains the invocation of the D proxy method of which the return value is to be passed back to C++, $winput contains the parameter value from C++.
+ These variables are used in the director-specific typemaps ddirectorin and ddirectorout . They are more or less the reverse of the $imcall and $dinput macros: $dcall contains the invocation of the D proxy method of which the return value is to be passed back to C++, $winput contains the parameter value from C++.
$excode
This variable is used in dout and dconstructor typemaps and is filled with the contents of the excode typemap attribute if an exception could be thrown from the C++ side. See the C# documentation for details.
@@ -263,7 +263,7 @@ 22.3.7 Special variable macros
- $importtype(SomeDType)
+ $importtype(SomeDType)
This macro is used in the dimports typemap if a dependency on another D type generated by SWIG is added by a custom typemap.
Consider the following code snippet:
@@ -295,7 +295,7 @@ 22.3.7 Special variable macros
- 22.4 %feature s
+22.4 D and %feature
The D module defines a number of directives which modify the SWIG features set globally or for a specific declaration:
@@ -325,7 +325,7 @@ 22.4 %feature s
- 22.5 Pragmas
+22.5 Pragmas
There are a few SWIG pragmas specific to the D module, which you can use to influence the D code SWIG generates:
@@ -364,7 +364,7 @@ 22.5 Pragmas
- 22.6 D Exceptions
+22.6 D Exceptions
Out of the box, C++ exceptions are fundamentally incompatible to their equivalent in the D world and cannot simply be propagated to a calling D method. There is, however, an easy way to solve this problem: Just catch the exception in the C/C++ wrapper layer, pass the contents to D, and make the wrapper code rethrow the exception in the D world.
@@ -374,7 +374,7 @@ 22.6 D Exceptions
As this feature is implemented in exactly the same way it is for C#, please see the C# documentation for a more detailed explanation.
- 22.7 D Directors
+22.7 D Directors
When the directors feature is activated, SWIG generates extra code on both the C++ and the D side to enable cross-language polymorphism. Essentially, this means that if you subclass a proxy class in D, C++ code can access any overridden virtual methods just as if you created a derived class in C++.
@@ -383,16 +383,16 @@ 22.7 D Directors
- 22.8 Other features
+22.8 Other features
- 22.8.1 Extended namespace support (nspace )
+22.8.1 Extended namespace support (nspace)
By default, SWIG flattens all C++ namespaces into a single target language namespace, but as for Java and C#, the nspace feature is supported for D. If it is active, C++ namespaces are mapped to D packages/modules. Note, however, that like for the other languages, free variables and functions are not supported yet; currently, they are all allows written to the main proxy D module.
- 22.8.2 Native pointer support
+22.8.2 Native pointer support
Contrary to many of the scripting languages supported by SWIG, D fully supports C-style pointers. The D module thus includes a custom mechanism to wrap C pointers directly as D pointers where applicable, that is, if the type that is pointed to is represented the same in C and D (on the bit-level), dubbed a primitive type below.
@@ -404,7 +404,7 @@ 22.8.2 Native pointer support
To determine if a type should be considered primitive, the cprimitive attribute on its dtype attribute is used. For example, the dtype typemap for float has cprimitive="1" , so the code from the nativepointer attribute is taken into account e.g. for float ** or the function pointer float (*)(float *) .
- 22.8.3 Operator overloading
+22.8.3 Operator overloading
The D module comes with basic operator overloading support for both D1 and D2. There are, however, a few limitations arising from conceptual differences between C++ and D:
@@ -416,7 +416,7 @@ 22.8.3 Operator overloading
There are also some cases where the operators can be translated to D, but the differences in the implementation details are big enough that a rather involved scheme would be required for automatic wrapping them, which has not been implemented yet. This affects, for example, the array subscript operator, [] , in combination with assignments - while operator [] in C++ simply returns a reference which is then written to, D resorts to a separate opIndexAssign method -, or implicit casting (which was introduced in D2 via alias this ). Despite the lack of automatic support, manually handling these cases should be perfectly possible.
- 22.8.4 Running the test-suite
+22.8.4 Running the test-suite
As with any other language, the SWIG test-suite can be built for D using the *-d-test-suite targets of the top-level Makefile. By default, D1 is targeted, to build it with D2, use the optional D_VERSION variable, e.g. make check-d-test-suite D_VERSION=2 .
@@ -424,14 +424,14 @@ 22.8.4 Running the test-suite
Note: If you want to use GDC on Linux or another platform which requires you to link libdl for dynamically loading the shared library, you might have to add -ldl manually to the d_compile target in Examples/Makefile , because GDC does not currently honor the pragma(lib,...) statement.
- 22.9 D Typemap examples
+22.9 D Typemap examples
There are no D-specific typemap examples yet. However, with the above name comparison table , you should be able to get an idea what can be done by looking at the corresponding C# section .
- 22.10 Work in progress and planned features
+22.10 Work in progress and planned features
There are a couple of features which are not implemented yet, but would be very useful and might be added in the near future:
diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html
index 00302d7b5c8..14dcbdccdf6 100644
--- a/Doc/Manual/Extending.html
+++ b/Doc/Manual/Extending.html
@@ -1,12 +1,13 @@
-
+
Extending SWIG to support new languages
+
- 40 Extending SWIG to support new languages
+41 Extending SWIG to support new languages
@@ -75,7 +76,7 @@ 40 Extending SWIG to support new languages
- 40.1 Introduction
+41.1 Introduction
@@ -91,7 +92,7 @@
40.1 Introduction
you should probably look at one of SWIG's existing modules.
- 40.2 Prerequisites
+41.2 Prerequisites
@@ -121,7 +122,7 @@
40.2 Prerequisites
wrapper code are driven by C++ datatypes.
- 40.3 The Big Picture
+41.3 The Big Picture
@@ -158,7 +159,7 @@
40.3 The Big Picture
based on pattern matching and interact heavily with the underlying type system.
- 40.4 Execution Model
+41.4 Execution Model
@@ -203,7 +204,7 @@
40.4 Execution Model
The next few sections briefly describe some of these stages.
- 40.4.1 Preprocessing
+41.4.1 Preprocessing
@@ -284,7 +285,7 @@
40.4.1 Preprocessing
construction of the wrapper code.
- 40.4.2 Parsing
+41.4.2 Parsing
@@ -385,7 +386,7 @@
40.4.2 Parsing
arguments).
- 40.4.3 Parse Trees
+41.4.3 Parse Trees
@@ -640,7 +641,7 @@
40.4.3 Parse Trees
- 40.4.4 Attribute namespaces
+41.4.4 Attribute namespaces
@@ -659,7 +660,7 @@
40.4.4 Attribute namespaces
perl:foo .
- 40.4.5 Symbol Tables
+41.4.5 Symbol Tables
@@ -750,7 +751,7 @@
40.4.5 Symbol Tables
- 40.4.6 The %feature directive
+41.4.6 The %feature directive
@@ -806,7 +807,7 @@
40.4.6 The %feature directive
stored without any modifications.
- 40.4.7 Code Generation
+41.4.7 Code Generation
@@ -928,7 +929,7 @@
40.4.7 Code Generation
The role of these functions is described shortly.
- 40.4.8 SWIG and XML
+41.4.8 SWIG and XML
@@ -941,7 +942,7 @@
40.4.8 SWIG and XML
your mind as a model.
- 40.5 Primitive Data Structures
+41.5 Primitive Data Structures
@@ -987,7 +988,7 @@
40.5 Primitive Data Structures
- 40.5.1 Strings
+41.5.1 Strings
@@ -1128,7 +1129,7 @@
40.5.1 Strings
- 40.5.2 Hashes
+41.5.2 Hashes
@@ -1205,7 +1206,7 @@
40.5.2 Hashes
- 40.5.3 Lists
+41.5.3 Lists
@@ -1294,7 +1295,7 @@
40.5.3 Lists
and is used to create a String object.
- 40.5.4 Common operations
+41.5.4 Common operations
The following operations are applicable to all datatypes.
@@ -1349,7 +1350,7 @@ 40.5.4 Common operations
Gets the line number associated with x .
- 40.5.5 Iterating over Lists and Hashes
+41.5.5 Iterating over Lists and Hashes
To iterate over the elements of a list or a hash table, the following functions are used:
@@ -1394,7 +1395,7 @@ 40.5.5 Iterating over Lists and Hashes
- 40.5.6 I/O
+41.5.6 I/O
Special I/O functions are used for all internal I/O. These operations
@@ -1528,7 +1529,7 @@ 40.5.6 I/O
Similarly, the preprocessor and parser all operate on string-files.
- 40.6 Navigating and manipulating parse trees
+41.6 Navigating and manipulating parse trees
Parse trees are built as collections of hash tables. Each node is a hash table in which
@@ -1662,7 +1663,7 @@ 40.6 Navigating and manipulating parse trees
- 40.7 Working with attributes
+41.7 Working with attributes
@@ -1779,7 +1780,7 @@
40.7 Working with attributes
function.
- 40.8 Type system
+41.8 Type system
@@ -1788,7 +1789,7 @@
40.8 Type system
type theory is impossible here. However, let's cover the highlights.
- 40.8.1 String encoding of types
+41.8.1 String encoding of types
@@ -1889,7 +1890,7 @@
40.8.1 String encoding of types
string concatenation.
- 40.8.2 Type construction
+41.8.2 Type construction
@@ -2058,7 +2059,7 @@
40.8.2 Type construction
ty is unmodified.
- 40.8.3 Type tests
+41.8.3 Type tests
@@ -2145,7 +2146,7 @@
40.8.3 Type tests
Checks if ty is a templatized type.
- 40.8.4 Typedef and inheritance
+41.8.4 Typedef and inheritance
@@ -2247,7 +2248,7 @@
40.8.4 Typedef and inheritance
will consist only of primitive typenames.
- 40.8.5 Lvalues
+41.8.5 Lvalues
@@ -2284,7 +2285,7 @@
40.8.5 Lvalues
- 40.8.6 Output functions
+41.8.6 Output functions
@@ -2346,7 +2347,7 @@
40.8.6 Output functions
that appear in wrappers (e.g., SWIGTYPE_p_double ).
- 40.9 Parameters
+41.9 Parameters
@@ -2445,7 +2446,7 @@
40.9 Parameters
Returns the number of required (non-optional) arguments in p .
- 40.10 Writing a Language Module
+41.10 Writing a Language Module
@@ -2460,7 +2461,7 @@
40.10 Writing a Language Module
this to other languages.
- 40.10.1 Execution model
+41.10.1 Execution model
@@ -2470,7 +2471,7 @@
40.10.1 Execution model
different methods of the Language that must be defined by your module.
- 40.10.2 Starting out
+41.10.2 Starting out
@@ -2578,7 +2579,7 @@
40.10.2 Starting out
messages from your new module should appear.
- 40.10.3 Command line options
+41.10.3 Command line options
@@ -2637,7 +2638,7 @@
40.10.3 Command line options
unrecognized command line option error.
- 40.10.4 Configuration and preprocessing
+41.10.4 Configuration and preprocessing
@@ -2686,7 +2687,7 @@
40.10.4 Configuration and preprocessing
python.swg .
- 40.10.5 Entry point to code generation
+41.10.5 Entry point to code generation
@@ -2744,7 +2745,7 @@
40.10.5 Entry point to code generation
- 40.10.6 Module I/O and wrapper skeleton
+41.10.6 Module I/O and wrapper skeleton
@@ -2892,7 +2893,7 @@ 40.10.6 Module I/O and wrapper skeleton
- 40.10.7 Low-level code generators
+41.10.7 Low-level code generators
@@ -3046,7 +3047,7 @@ 40.10.7 Low-level code generators
- 40.10.8 Configuration files
+41.10.8 Configuration files
@@ -3190,7 +3191,7 @@ 40.10.8 Configuration files
- 40.10.9 Runtime support
+41.10.9 Runtime support
@@ -3199,7 +3200,7 @@
40.10.9 Runtime support
the SWIG files that implement those functions.
- 40.10.10 Standard library files
+41.10.10 Standard library files
@@ -3218,7 +3219,7 @@
40.10.10 Standard library files
Please copy these and modify for any new language.
- 40.10.11 User examples
+41.10.11 User examples
@@ -3247,7 +3248,7 @@
40.10.11 User examples
files.
- 40.10.12 Test driven development and the test-suite
+41.10.12 Test driven development and the test-suite
@@ -3306,7 +3307,7 @@
40.10.12 Test driven development and the
but error/exception out with an error message on stderr on failure.
- 40.10.12.1 Running the test-suite
+41.10.12.1 Running the test-suite
@@ -3498,7 +3499,7 @@
40.10.12.1 Running the test-suite
The test cases used and the way it works is described in Examples/test-suite/errors/Makefile.in .
- 40.10.13 Documentation
+41.10.13 Documentation
@@ -3530,7 +3531,7 @@
40.10.13 Documentation
if available.
- 40.10.14 Prerequisites for adding a new language module to the SWIG distribution
+41.10.14 Prerequisites for adding a new language module to the SWIG distribution
@@ -3587,7 +3588,7 @@
40.10.14 Prerequisites for adding a ne
the existing tests.
- 40.10.15 Coding style guidelines
+41.10.15 Coding style guidelines
@@ -3611,7 +3612,7 @@
40.10.15 Coding style guidel
should be avoided as unlike the SWIG developers, users will never have consistent tab settings.
- 40.11 Debugging Options
+41.11 Debugging Options
@@ -3638,7 +3639,7 @@
40.11 Debugging Options
The complete list of command line options for SWIG are available by running swig -help .
- 40.12 Guide to parse tree nodes
+41.12 Guide to parse tree nodes
@@ -4046,7 +4047,7 @@
40.12 Guide to parse tree nodes
- 40.13 Further Development Information
+41.13 Further Development Information
diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html
index 9a6de95982f..ced046c6661 100644
--- a/Doc/Manual/Go.html
+++ b/Doc/Manual/Go.html
@@ -1,11 +1,12 @@
-
+
SWIG and Go
+
- 23 SWIG and Go
+23 SWIG and Go
@@ -13,8 +14,8 @@ 23 SWIG and Go
Examples
Running SWIG with Go
A tour of basic C/C++ wrapping
@@ -29,6 +30,16 @@ 23 SWIG and Go
Go Templates
Go Director Classes
+
Default Go primitive type mappings
Output arguments
Adding additional go code
@@ -46,55 +57,131 @@ 23 SWIG and Go
see golang.org .
- 23.1 Overview
+23.1 Overview
-Go is a compiled language, not a scripting language. However, it does
-not support direct calling of functions written in C/C++. The cgo
-program may be used to generate wrappers to call C code from Go, but
-there is no convenient way to call C++ code. SWIG fills this gap.
+Go does not support direct calling of functions written in C/C++. The
+cgo program may be used to generate
+wrappers to call C code from Go, but there is no convenient way to call C++
+code. SWIG fills this gap.
-There are (at least) two different Go compilers. One is the gc
-compiler, normally invoked via the go tool. The other
-is the gccgo compiler, which is a frontend to the gcc compiler suite.
-The interface to C/C++ code is completely different for the two Go
-compilers. SWIG supports both, selected by a command line option.
+There are (at least) two different Go compilers. The first is the gc compiler
+of the Go distribution , normally
+invoked via the go tool .
+The second Go compiler is the
+gccgo compiler , which is a frontend to the GCC compiler suite.
+The interface to C/C++ code is completely different for the two Go compilers.
+SWIG supports both Go compilers, selected by the -gccgo command line
+option.
-Because Go is a type-safe compiled language, SWIG's runtime type
-checking and runtime library are not used with Go. This should be
-borne in mind when reading the rest of the SWIG documentation.
+Go is a type-safe compiled language and the wrapper code generated by SWIG is
+type-safe as well. In case of type issues the build will fail and hence SWIG's
+runtime library and
+runtime type checking
+are not used.
- 23.2 Examples
+23.2 Examples
-Working examples can be found here:
+Working examples can be found in the
+SWIG source tree
+ .
-
+
-The examples in the 2nd link are shipped with the SWIG distribution under the Examples/go directory.
+Please note that the examples in the SWIG source tree use makefiles with the .i
+SWIG interface file extension for backwards compatibility with Go 1.
- 23.3 Running SWIG with Go
+23.3 Running SWIG with Go
+
+
+Most Go programs are built using the go
+tool . Since Go 1.1 the go tool has support for SWIG. To use it, give your
+SWIG interface file the extension .swig (for C code) or .swigcxx (for C++ code).
+Put that file in a GOPATH/src directory as usual for Go sources. Put other
+C/C++ code in the same directory with extensions of .c and .cxx. The
+go build and go install commands will automatically run SWIG
+for you and compile the generated wrapper code. To check the SWIG command line
+options the go tool uses run go build -x . To access the automatically
+generated files run go build -work . You'll find the files under the
+temporary WORK directory.
+
-To generate Go code, use the -go option with SWIG. By
-default SWIG will generate code for the gc compilers. To generate
-code for gccgo, you should also use the -gccgo option.
+To manually generate and compile C/C++ wrapper code for Go, use the -go
+option with SWIG. By default SWIG will generate code for the Go compiler of the
+Go distribution. To generate code for gccgo, you should also use the
+-gccgo option.
- 23.3.1 Additional Commandline Options
+
+When using the -cgo option, SWIG will generate files that can be used
+directly by go build . Starting with the Go 1.5 distribution the
+-cgo option has to be given. Put your SWIG interface file in a
+directory under GOPATH/src, and give it a name that does not end in the
+.swig or .swigcxx extension. Typically the SWIG interface file extension is .i
+in this case.
+
+
+
+% swig -go -cgo example.i
+% go install
+
+
+
+You will now have a Go package that you can import from other Go packages as
+usual.
+
+
+
+To use SWIG without the -cgo option, more steps are required. Recall
+that this only works with Go versions before 1.5. When using Go version 1.2 or
+later, or when using gccgo, the code generated by SWIG can be linked directly
+into the Go program. A typical command sequence when using the Go compiler of
+the Go distribution would look like this:
+
+
+
+% swig -go example.i
+% gcc -c code.c # The C library being wrapped.
+% gcc -c example_wrap.c
+% go tool 6g example.go
+% go tool 6c example_gc.c
+% go tool pack grc example.a example.6 example_gc.6 code.o example_wrap.o
+% go tool 6g main.go
+% go tool 6l main.6
+
+
+
+You can also put the wrapped code into a shared library, and when using the Go
+versions before 1.2 this is the only supported option. A typical command
+sequence for this approach would look like this:
+
+
+
+% swig -go -use-shlib example.i
+% gcc -c -fpic example.c
+% gcc -c -fpic example_wrap.c
+% gcc -shared example.o example_wrap.o -o example.so
+% go tool 6g example.go
+% go tool 6c example_gc.c
+% go tool pack grc example.a example.6 example_gc.6
+% go tool 6g main.go # your code, not generated by SWIG
+% go tool 6l main.6
+
+
+
+23.3.1 Go-specific Commandline Options
@@ -106,9 +193,17 @@
23.3.1 Additional Commandline Options
swig -go -help
-
+
+
+Go-specific options
+
+
-Go specific options
+-cgo
+Generate files to be used as input for the Go cgo tool. This
+ option is required for Go 1.5 and later, and works for Go 1.2 and
+ later. In the future this option will likely become the
+ default.
@@ -126,7 +221,7 @@ 23.3.1 Additional Commandline Options
-gccgo
Generate code for gccgo. The default is to generate code for
- the gc compiler.
+ the Go compiler of the Go distribution.
@@ -138,8 +233,8 @@ 23.3.1 Additional Commandline Options
-use-shlib
Tell SWIG to emit code that uses a shared library. This is only
- meaningful for the gc compiler, which needs to know at compile time
- whether a shared library will be used.
+ meaningful for the Go compiler of the Go distribution, which needs to know at
+ compile time whether a shared library will be used.
@@ -147,9 +242,9 @@ 23.3.1 Additional Commandline Options
Set the runtime name of the shared library that the dynamic linker
should include at runtime. The default is the package name with
".so" appended. This is only used when generating code for
- the gc compiler; when using gccgo, the equivalent name will be taken from
- the -soname
option passed to the linker. Using this
- option implies the -use-shlib option.
+ the Go compiler of the Go distribution; when using gccgo, the equivalent name
+ will be taken from the -soname
option passed to the linker.
+ Using this option implies the -use-shlib option.
@@ -168,11 +263,17 @@ 23.3.1 Additional Commandline Options
- 23.3.2 Go Output Files
+23.3.2 Generated Wrapper Files
+
+
+There are two different approaches to generating wrapper files,
+ controlled by SWIG's -cgo option. The -cgo option
+ works with Go version 1.2 or later. It is required when using Go
+ version 1.5 or later.
- When generating Go code, SWIG will generate the following
- files:
+With or without the -cgo option, SWIG will generate the
+ following files when generating wrapper code:
@@ -180,71 +281,34 @@ 23.3.2 Go Output Files
These functions will be wrappers for the C++ functions defined by your
module. This file should, of course, be compiled with the Go
compiler.
+
MODULE_wrap.c or MODULE_wrap.cxx will contain C/C++ functions will be
invoked by the Go wrapper code. This file should be compiled with the
-usual C or C++ compiler and linked into a shared library.
+usual C or C++ compiler.
+
MODULE_wrap.h will be generated if you use the directors feature. It
provides a definition of the generated C++ director classes. It is
generally not necessary to use this file, but in some special cases it
may be helpful to include it in your code, compiled with the usual C
or C++ compiler.
-
-If using the gc compiler, MODULE_gc.c will contain C code which should
-be compiled with the C compiler distributed as part of the gc
-compiler. It should then be combined with the compiled MODULE.go
-using gopack. This file will not be generated when using gccgo.
+
-
-Most Go programs are built using the go tool. The go tool has limited
-support for SWIG. To use it, put your SWIG interface into a file with
-the extension .swig, or, if you are wrapping C++ code, .swigcxx. Put
-that file in a GOPATH/src directory as usual for Go sources. Put
-other interface code in the same directory with extensions of .c and
-.cxx. The go build command and go install commands will automatically
-run SWIG for you and will build the interface code.
-
-
-
-You can also use SWIG directly yourself. When using the gc compiler
-version 1.2 or later, or when using gccgo, the code generated by SWIG
-can be linked directly into the Go program. A typical command
-sequence when using the gc compiler would look like this:
-
-
-
-% swig -go example.i
-% gcc -c code.c # The C library being wrapped.
-% gcc -c example_wrap.c
-% go tool 6g example.go
-% go tool 6c example_gc.c
-% go tool pack grc example.a example.6 example_gc.6 code.o example_wrap.o
-% go tool 6g main.go
-% go tool 6l main.6
-
+When neither the -cgo nor the -gccgo option is
+ used, SWIG will also generate an additional file:
-
-You can also put the wrapped code into a shared library, and when
-using the gc compiler before version 1.2 this is the only supported
-option. A typical command sequence for this approach would look like
-this:
-
+
+
+MODULE_gc.c will contain C code which should be compiled with the C
+compiler distributed as part of the gc compiler. It should then be
+combined with the compiled MODULE.go using go tool pack.
+
+
-
-% swig -go -use-shlib example.i
-% gcc -c -fpic example.c
-% gcc -c -fpic example_wrap.c
-% gcc -shared example.o example_wrap.o -o example.so
-% go tool 6g example.go
-% go tool 6c example_gc.c
-% go tool pack grc example.a example.6 example_gc.6
-% go tool 6g main.go # your code, not generated by SWIG
-% go tool 6l main.6
-
- 23.4 A tour of basic C/C++ wrapping
+23.4 A tour of basic C/C++ wrapping
@@ -254,7 +318,7 @@
23.4 A tour of basic C/C++ wrapping
essential aspects of this wrapping.
- 23.4.1 Go Package Name
+23.4.1 Go Package Name
@@ -264,7 +328,7 @@
23.4.1 Go Package Name
command line option.
- 23.4.2 Go Names
+23.4.2 Go Names
@@ -296,7 +360,7 @@
23.4.2 Go Names
named Delete followed by that name.
- 23.4.3 Go Constants
+23.4.3 Go Constants
@@ -304,7 +368,7 @@
23.4.3 Go Constants
directive become Go constants, declared with a const
declaration.
- 23.4.4 Go Enumerations
+23.4.4 Go Enumerations
@@ -314,7 +378,7 @@
23.4.4 Go Enumerations
code should avoid modifying those variables.
- 23.4.5 Go Classes
+23.4.5 Go Classes
@@ -392,43 +456,129 @@
23.4.5 Go Classes
for this by calling the Swigcptr() method.
- 23.4.5.1 Go Class Memory Management
+23.4.5.1 Go Class Memory Management
-Calling NewClassName for some C++ class ClassName
-will allocate memory using the C++ memory allocator. This memory will
-not be automatically freed by Go's garbage collector as the object ownership is
-not tracked. When you are done with the C++ object you must free it manually
-using DeleteClassName .
+Calling NewClassName for a C++ class ClassName will allocate
+memory using the C++ memory allocator. This memory will not be automatically
+freed by Go's garbage collector as the object ownership is not tracked. When
+you are done with the C++ object you must free it using
+DeleteClassName .
+
+The most Go idiomatic way to manage the memory for some C++ class is to call
+NewClassName followed by a
+defer of
+the DeleteClassName call. Using defer ensures that the memory
+of the C++ object is freed as soon as the function containing the defer
+statement returns. Furthemore defer works great for short-lived
+objects and fits nicely C++'s RAII idiom. Example:
+
+
+func UseClassName(...) ... {
+ o := NewClassName(...)
+ defer DeleteClassName(o)
+ // Use the ClassName object
+ return ...
+}
+
+
-A common technique is to store the C++ object into a Go object, and
-use the Go function runtime.SetFinalizer to free the C++ object when
-the Go object is freed. It is strongly recommended to read the
-runtime.SetFinalizer
-documentation before using this technique to understand its limitations.
-For example, if the SWIG package is imported as "wrap":
+With increasing complexity, especially complex C++ object hierarchies, the
+correct placement of defer statements becomes harder and harder as C++
+objects need to be freed in the correct order. This problem can be eased by
+keeping a C++ object function local so that it is only available to the function
+that creates a C++ object and functions called by this function. Example:
+func WithClassName(constructor args, f func(ClassName, ...interface{}) error, data ...interface{}) error {
+ o := NewClassName(constructor args)
+ defer DeleteClassName(o)
+ return f(o, data...)
+}
+
+func UseClassName(o ClassName, data ...interface{}) (err error) {
+ // Use the ClassName object and additional data and return error.
+}
+
+func main() {
+ WithClassName(constructor args, UseClassName, additional data)
+}
+
+
+
+
+Using defer has limitations though, especially when it comes to
+long-lived C++ objects whichs lifetimes are hard to predict. For such C++
+objects a common technique is to store the C++ object into a Go object, and to
+use the Go function runtime.SetFinalizer to add a finalizer which frees
+the C++ object when the Go object is freed. It is strongly recommended to read
+the runtime.SetFinalizer
+ documentation before using this technique to understand the
+runtime.SetFinalizer limitations.
+
+
+Common pitfalls with runtime.SetFinalizer are:
+
+
+
+If a hierarchy of C++ objects will be automatically freed by Go finalizers then
+the Go objects that store the C++ objects need to replicate the hierarchy of the
+C++ objects to prevent that C++ objects are freed prematurely while other C++
+objects still rely on them.
+
+
+The usage of Go finalizers is problematic with C++'s RAII idiom as it isn't
+predictable when the finalizer will run and this might require a Close or Delete
+method to be added the Go object that stores a C++ object to mitigate.
+
+
+The Go finalizer function typically runs in a different OS thread which can be
+problematic with C++ code that uses thread-local storage.
+
+
+
+
+runtime.SetFinalizer Example:
+
+
+
+import (
+ "runtime"
+ "wrap" // SWIG generated wrapper code
+)
+
type GoClassName struct {
- w wrap.ClassName
+ wcn wrap.ClassName
}
func NewGoClassName() *GoClassName {
- r := &GoClassName{wrap.NewClassName()}
- runtime.SetFinalizer(r,
- func(r *GoClassName) {
- wrap.DeleteClassName(r.w)
- })
- return r
+ o := &GoClassName{wcn: wrap.NewClassName()}
+ runtime.SetFinalizer(o, deleteGoClassName)
+ return o
+}
+
+func deleteGoClassName(o *GoClassName) {
+ // Runs typically in a different OS thread!
+ wrap.DeleteClassName(o.wcn)
+ o.wcn = nil
+}
+
+func (o *GoClassName) Close() {
+ // If the C++ object has a Close method.
+ o.wcn.Close()
+
+ // If the GoClassName object is no longer in an usable state.
+ runtime.SetFinalizer(o, nil) // Remove finalizer.
+ deleteGoClassName() // Free the C++ object.
}
- 23.4.5.2 Go Class Inheritance
+23.4.5.2 Go Class Inheritance
@@ -440,7 +590,7 @@
23.4.5.2 Go Class Inheritance
be checked dynamically.
- 23.4.6 Go Templates
+23.4.6 Go Templates
@@ -448,50 +598,551 @@
23.4.6 Go Templates
wrappers for a particular template instantation. To do this, use
the %template directive.
- 23.4.7 Go Director Classes
+
+23.4.7 Go Director Classes
+
+
+
+SWIG's director feature permits a Go type to act as the subclass of a C++ class.
+This is complicated by the fact that C++ and Go define inheritance differently.
+SWIG normally represents the C++ class inheritance automatically in Go via
+interfaces but with a Go type representing a subclass of a C++ class some manual
+work is necessary.
+
+
+
+This subchapter gives a step by step guide how to properly sublass a C++ class
+with a Go type. In general it is strongly recommended to follow this guide
+completely to avoid common pitfalls with directors in Go.
+
+
+
+23.4.7.1 Example C++ code
+
+
+
+The step by step guide is based on two example C++ classes. FooBarAbstract is
+an abstract C++ class and the FooBarCpp class inherits from it. This guide
+explains how to implement a FooBarGo class similar to the FooBarCpp class.
+
+
+
+FooBarAbstract abstract C++ class:
+
+
+
+
+class FooBarAbstract
+{
+public:
+ FooBarAbstract() {};
+ virtual ~FooBarAbstract() {};
+
+ std::string FooBar() {
+ return this->Foo() + ", " + this->Bar();
+ };
+
+protected:
+ virtual std::string Foo() {
+ return "Foo";
+ };
+
+ virtual std::string Bar() = 0;
+};
+
+
+
+
+FooBarCpp C++ class:
+
+
+
+
+class FooBarCpp : public FooBarAbstract
+{
+protected:
+ virtual std::string Foo() {
+ return "C++ " + FooBarAbstract::Foo();
+ }
+
+ virtual std::string Bar() {
+ return "C++ Bar";
+ }
+};
+
+
+
+
+Returned string by the FooBarCpp::FooBar method is:
+
+
+
+
+
+
+The complete example, including the FooBarGoo class implementation, can
+be found in the end of the guide .
+
+
+
+23.4.7.2 Enable director feature
+
+
+
+The director feature is disabled by default. To use directors you must make two
+changes to the interface file. First, add the "directors" option to the %module
+directive, like this:
+
+
+
+
+%module(directors="1") modulename
+
+
+
+
+Second, you must use the %feature("director") directive to tell SWIG which
+classes should get directors. In the example the FooBarAbstract class needs the
+director feature enabled so that the FooBarGo class can inherit from it, like
+this:
+
+
+
+
+%feature("director") FooBarAbstract;
+
+
+
+
+For a more detailed documentation of the director feature and how to enable or
+disable it for specific classes and virtual methods see SWIG's Java
+documentation on directors.
+
+
+
+23.4.7.3 Constructor and destructor
-SWIG's director feature permits a Go type to act as the subclass of a
-C++ class with virtual methods. This is complicated by the fact that
-C++ and Go define inheritance differently. In Go, structs can inherit
-methods via anonymous field embedding. However, when a method is
-called for an embedded struct, if that method calls any other methods,
-they are called for the embedded struct, not for the original type.
-Therefore, SWIG must use Go interfaces to represent C++ inheritance.
+SWIG creates an additional set of constructor and destructor functions once the
+director feature has been enabled for a C++ class.
+NewDirectorClassName allows overriding virtual methods on the new
+object instance and DeleteDirectorClassName needs to be used to free a
+director object instance created with NewDirectorClassName .
+More on overriding virtual methods follows later in this guide under
+overriding virtual methods .
-In order to use the director feature in Go, you must define a type in
-your Go code. You must then add methods for the type. Define a
-method in Go for each C++ virtual function that you want to override.
-You must then create a value of your new type, and pass a pointer to
-it to the function NewDirectorClassName ,
-where ClassName is the name of the C++ class. That will
-return a value of type ClassName .
+The default constructor and destructor functions NewClassName and
+DeleteClassName can still be used as before so that existing code
+doesn't break just because the director feature has been enabled for a C++
+class. The behavior is undefined if the default and director constructor and
+destructor functions get mixed and so great care needs to be taken that only one
+of the constructor and destructor function pairs is used for any object
+instance. Both constructor functions, the default and the director one, return
+the same interface type. This makes it potentially hard to know which
+destructor function, the default or the director one, needs to be called to
+delete an object instance.
-For example:
+In theory the DirectorInterface method could be used to
+determine if an object instance was created via NewDirectorClassName :
-type GoClass struct { }
-func (p *GoClass) VirtualFunction() { }
-func MakeClass() ClassName {
- return NewDirectorClassName(&GoClass{})
+if o.DirectorInterface() != nil {
+ DeleteDirectorClassName(o)
+} else {
+ DeleteClassName(o)
}
-Any call in C++ code to the virtual function will wind up calling the
-method defined in Go. The Go code may of course call other methods on
-itself, and those methods may be defined either in Go or in C++.
+In practice it is strongly recommended to embed a director object
+instance in a Go struct so that a director object instance will be represented
+as a distinct Go type that subclasses a C++ class. For this Go type custom
+constructor and destructor functions take care of the director constructor and
+destructor function calls and the resulting Go class will appear to the user as
+any other SWIG wrapped C++ class. More on properly subclassing a C++ class
+follows later in this guide under subclass via
+embedding .
- 23.4.8 Default Go primitive type mappings
+
+23.4.7.4 Override virtual methods
+
+
+
+In order to override virtual methods on a C++ class with Go methods the
+NewDirectorClassName constructor functions receives a
+DirectorInterface argument. The methods in the
+DirectorInterface are a subset of the public and protected virtual methods
+of the C++ class. If the DirectorInterface contains a method with a
+matching signature to a virtual method of the C++ class then the virtual C++
+method will be overwritten with the Go method. As Go doesn't support protected
+methods all overriden protected virtual C++ methods will be public in Go.
+
+
+
+As an example see part of the FooBarGo class:
+
+
+
+
+type overwrittenMethodsOnFooBarAbstract struct {
+ fb FooBarAbstract
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
+ ...
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Bar() string {
+ ...
+}
+
+func NewFooBarGo() FooBarGo {
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb
+ ...
+}
+
+
+
+
+The complete example, including the FooBarGoo class implementation, can
+be found in the end of the guide . In
+this part of the example the virtual methods FooBarAbstract::Foo and
+FooBarAbstract::Bar have been overwritten with Go methods similarly to
+how the FooBarAbstract virtual methods are overwritten by the
+FooBarCpp class.
+
+
+
+The DirectorInterface in the example is implemented by the
+overwrittenMethodsOnFooBarAbstract Go struct type. A pointer to a
+overwrittenMethodsOnFooBarAbstract struct instance will be given to the
+NewDirectorFooBarAbstract constructor function. The constructor return
+value implements the FooBarAbstract interface.
+overwrittenMethodsOnFooBarAbstract could in theory be any Go type but
+in practice a struct is used as it typically contains at least a value of the
+C++ class interface so that the overwritten methods can use the rest of the
+C++ class. If the FooBarGo class would receive additional constructor
+arguments then these would also typically be stored in the
+overwrittenMethodsOnFooBarAbstract struct so that they can be used by
+the Go methods.
+
+
+
+23.4.7.5 Call base methods
+
+
+
+Often a virtual method will be overwritten to extend the original behavior of
+the method in the base class. This is also the case for the
+FooBarCpp::Foo method of the example code:
+
+
+
+
+virtual std::string Foo() {
+ return "C++ " + FooBarAbstract::Foo();
+}
+
+
+
+
+To use base methods the DirectorClassNameMethodName wrapper functions
+are automatically generated by SWIG for public and protected virtual methods.
+The FooBarGo.Foo implementation in the example looks like this:
+
+
+
+
+func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
+ return "Go " + DirectorFooBarAbstractFoo(om.fb)
+}
+
+
+
+
+The complete example, including the FooBarGoo class implementation, can
+be found in the end of the guide .
+
+
+
+23.4.7.6 Subclass via embedding
+
+
+
+As previously mentioned in this guide the
+default and director constructor functions return the same interface type. To
+properly subclass a C++ class with a Go type the director object instance
+returned by the NewDirectorClassName constructor function should be
+embedded into a Go struct so that it represents a distinct but compatible type
+in Go's type system. This Go struct should be private and the constructor and
+destructor functions should instead work with a public interface type so that
+the Go class that subclasses a C++ class can be used as a compatible drop in.
+
+
+
+The subclassing part of the FooBarGo class for an example looks like
+this:
+
+
+
+
+type FooBarGo interface {
+ FooBarAbstract
+ deleteFooBarAbstract()
+ IsFooBarGo()
+}
+
+type fooBarGo struct {
+ FooBarAbstract
+}
+
+func (fbgs *fooBarGo) deleteFooBarAbstract() {
+ DeleteDirectorFooBarAbstract(fbgs.FooBarAbstract)
+}
+
+func (fbgs *fooBarGo) IsFooBarGo() {}
+
+func NewFooBarGo() FooBarGo {
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb
+
+ return &fooBarGo{FooBarAbstract: fb}
+}
+
+func DeleteFooBarGo(fbg FooBarGo) {
+ fbg.deleteFooBarAbstract()
+}
+
+
+
+
+
+The complete example, including the FooBarGoo class implementation, can
+be found in the end of the guide . In
+this part of the example the private fooBarGo struct embeds
+FooBarAbstract which lets the fooBarGo Go type "inherit" all the
+methods of the FooBarAbstract C++ class by means of embedding. The
+public FooBarGo interface type includes the FooBarAbstract
+interface and hence FooBarGo can be used as a drop in replacement for
+FooBarAbstract while the reverse isn't possible and would raise a
+compile time error. Furthemore the constructor and destructor functions
+NewFooBarGo and DeleteFooBarGo take care of all the director
+specifics and to the user the class appears as any other SWIG wrapped C++
+class.
+
+
+
+23.4.7.7 Memory management with runtime.SetFinalizer
+
+
+
+In general all guidelines for C++ class memory
+management apply as well to director classes. One often overlooked
+limitation with runtime.SetFinalizer is that a finalizer doesn't run
+in case of a cycle and director classes typically have a cycle. The cycle
+in the FooBarGo class is here:
+
+
+
+
+type overwrittenMethodsOnFooBarAbstract struct {
+ fb FooBarAbstract
+}
+
+func NewFooBarGo() FooBarGo {
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om) // fb.v = om
+ om.fb = fb // Backlink causes cycle as fb.v = om!
+ ...
+}
+
+
+
+
+In order to be able to use runtime.SetFinalizer nevertheless the
+finalizer needs to be set on something that isn't in a cycle and that references
+the director object instance. In the FooBarGo class example the
+FooBarAbstract director instance can be automatically deleted by setting
+the finalizer on fooBarGo :
+
+
+
+
+type fooBarGo struct {
+ FooBarAbstract
+}
+
+type overwrittenMethodsOnFooBarAbstract struct {
+ fb FooBarAbstract
+}
+
+func NewFooBarGo() FooBarGo {
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb // Backlink causes cycle as fb.v = om!
+
+ fbgs := &fooBarGo{FooBarAbstract: fb}
+ runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
+ return fbgs
+}
+
+
+
+
+Furthermore if runtime.SetFinalizer is in use either the
+DeleteClassName destructor function needs to be removed or the
+fooBarGo struct needs additional data to prevent double deletion. Please
+read the C++ class memory management subchapter
+before using runtime.SetFinalizer to know all of its gotchas.
+
+
+
+23.4.7.8 Complete FooBarGo example class
+
+
+
+The complete and annotated FooBarGo class looks like this:
+
+
+
+
+// FooBarGo is a superset of FooBarAbstract and hence FooBarGo can be used as a
+// drop in replacement for FooBarAbstract but the reverse causes a compile time
+// error.
+type FooBarGo interface {
+ FooBarAbstract
+ deleteFooBarAbstract()
+ IsFooBarGo()
+}
+
+// Via embedding fooBarGo "inherits" all methods of FooBarAbstract.
+type fooBarGo struct {
+ FooBarAbstract
+}
+
+func (fbgs *fooBarGo) deleteFooBarAbstract() {
+ DeleteDirectorFooBarAbstract(fbgs.FooBarAbstract)
+}
+
+// The IsFooBarGo method ensures that FooBarGo is a superset of FooBarAbstract.
+// This is also how the class hierarchy gets represented by the SWIG generated
+// wrapper code. For an instance FooBarCpp has the IsFooBarAbstract and
+// IsFooBarCpp methods.
+func (fbgs *fooBarGo) IsFooBarGo() {}
+
+// Go type that defines the DirectorInterface. It contains the Foo and Bar
+// methods that overwrite the respective virtual C++ methods on FooBarAbstract.
+type overwrittenMethodsOnFooBarAbstract struct {
+ // Backlink to FooBarAbstract so that the rest of the class can be used by
+ // the overridden methods.
+ fb FooBarAbstract
+
+ // If additional constructor arguments have been given they are typically
+ // stored here so that the overriden methods can use them.
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
+ // DirectorFooBarAbstractFoo calls the base method FooBarAbstract::Foo.
+ return "Go " + DirectorFooBarAbstractFoo(om.fb)
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Bar() string {
+ return "Go Bar"
+}
+
+func NewFooBarGo() FooBarGo {
+ // Instantiate FooBarAbstract with selected methods overridden. The methods
+ // that will be overwritten are defined on
+ // overwrittenMethodsOnFooBarAbstract and have a compatible signature to the
+ // respective virtual C++ methods. Furthermore additional constructor
+ // arguments will be typically stored in the
+ // overwrittenMethodsOnFooBarAbstract struct.
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb // Backlink causes cycle as fb.v = om!
+
+ fbgs := &fooBarGo{FooBarAbstract: fb}
+ // The memory of the FooBarAbstract director object instance can be
+ // automatically freed once the FooBarGo instance is garbage collected by
+ // uncommenting the following line. Please make sure to understand the
+ // runtime.SetFinalizer specific gotchas before doing this. Furthemore
+ // DeleteFooBarGo should be deleted if a finalizer is in use or the fooBarGo
+ // struct needs additional data to prevent double deletion.
+ // runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
+ return fbgs
+}
+
+// Recommended to be removed if runtime.SetFinalizer is in use.
+func DeleteFooBarGo(fbg FooBarGo) {
+ fbg.deleteFooBarAbstract()
+}
+
+
+
+
+Returned string by the FooBarGo.FooBar method is:
+
+
+
+
+
+For comparison the FooBarCpp class looks like this:
+
+
+
+
+class FooBarCpp : public FooBarAbstract
+{
+protected:
+ virtual std::string Foo() {
+ return "C++ " + FooBarAbstract::Foo();
+ }
+
+ virtual std::string Bar() {
+ return "C++ Bar";
+ }
+};
+
+
+
+
+For comparison the returned string by the FooBarCpp::FooBar method is:
+
+
+
+
+
+The complete source of this example can be found under
+
+SWIG/Examples/go/director/ .
+
+
+
+23.4.8 Default Go primitive type mappings
@@ -598,7 +1249,7 @@
23.4.8 Default Go primitive type ma
into Go types.
- 23.4.9 Output arguments
+23.4.9 Output arguments
Because of limitations in the way output arguments are processed in swig,
@@ -651,7 +1302,7 @@
23.4.9 Output arguments
- 23.4.10 Adding additional go code
+23.4.10 Adding additional go code
Often the APIs generated by swig are not very natural in go, especially if
@@ -746,7 +1397,7 @@
23.4.10 Adding additional go code
- 23.4.11 Go typemaps
+23.4.11 Go typemaps
@@ -795,7 +1446,8 @@
23.4.11 Go typemaps
Go code to convert from gotype to imtype when calling a C/C++
function. SWIG will then internally convert imtype to a C/C++ type
-and pass it down. If this is not defined no conversion is done.
+and pass it down. If this is not defined, or is the empty string, no
+conversion is done.
@@ -822,7 +1474,8 @@ 23.4.11 Go typemaps
goout
Go code to convert a value returned from a C/C++ function from imtype
-to gotype. If this is not defined no conversion is done.
+to gotype. If this is not defined, or is the empty string, no
+conversion is done.
@@ -843,7 +1496,7 @@ 23.4.11 Go typemaps
Go code to adjust an argument value when returning from a function.
This is called after the real C/C++ function has run. The value will
be in imtype. This is only useful for a pointer type of some sort.
-If this is not defined nothing will be done.
+If this is not defined, or is the empty string, nothing will be done.
@@ -861,7 +1514,8 @@ 23.4.11 Go typemaps
godirectorin
Go code to convert a value used to call a director method from imtype
-to gotype. If this is not defined no conversion is done.
+to gotype. If this is not defined, or is the empty string, no
+conversion is done.
@@ -869,7 +1523,8 @@ 23.4.11 Go typemaps
godirectorout
Go code to convert a value returned from a director method from gotype
-to imtype. If this is not defined no conversion is done.
+to imtype. If this is not defined, or is the empty string, no
+conversion is done.
diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html
index 4c1126c7fed..f30e139e590 100644
--- a/Doc/Manual/Guile.html
+++ b/Doc/Manual/Guile.html
@@ -1,14 +1,14 @@
-
-
+
SWIG and Guile
+
- 24 SWIG and Guile
+24 SWIG and Guile
@@ -47,7 +47,7 @@ 24 SWIG and Guile
This section details guile-specific support in SWIG.
-
24.1 Supported Guile Versions
+24.1 Supported Guile Versions
@@ -61,7 +61,7 @@
24.1 Supported Guile Versions
so your mileage may vary. To be safe set environment variable
GUILE_AUTO_COMPILE to 0 when using swig generated guile code.
- 24.2 Meaning of "Module"
+24.2 Meaning of "Module"
@@ -69,7 +69,7 @@
24.2 Meaning of "Module"
separately for SWIG, Guile, and Libtool. To avoid horrible confusion,
we explicitly prefix the context, e.g., "guile-module".
- 24.3 Old GH Guile API
+24.3 Old GH Guile API
Guile 1.8 and older could be interfaced using two different api's, the SCM
@@ -80,7 +80,7 @@
24.3 Old GH Guile API
version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please
use that version if you really need the GH wrapper code.
- 24.4 Linkage
+24.4 Linkage
@@ -88,7 +88,7 @@
24.4 Linkage
which manifests in multiple shared-library usage conventions. A set of
policies implementing a usage convention is called a linkage .
- 24.4.1 Simple Linkage
+24.4.1 Simple Linkage
@@ -158,8 +158,8 @@
24.4.1 Simple Linkage
(module-map (lambda (sym var)
- (module-export! (current-module) (list sym)))
- (current-module))
+ (module-export! (current-module) (list sym)))
+ (current-module))
@@ -193,7 +193,7 @@ 24.4.1 Simple Linkage
SWIG_init
via a preprocessor define to avoid symbol
clashes. For this case, however, passive linkage is available.
- 24.4.2 Passive Linkage
+24.4.2 Passive Linkage
Passive linkage is just like simple linkage, but it generates an
@@ -203,7 +203,7 @@
24.4.2 Passive Linkage
You should use passive linkage rather than simple linkage when you
are using multiple modules.
-
24.4.3 Native Guile Module Linkage
+24.4.3 Native Guile Module Linkage
SWIG can also generate wrapper code that does all the Guile module
@@ -244,7 +244,7 @@
24.4.3 Native Guile Module Linkage
- 24.4.4 Old Auto-Loading Guile Module Linkage
+24.4.4 Old Auto-Loading Guile Module Linkage
Guile used to support an autoloading facility for object-code
@@ -270,7 +270,7 @@
24.4.4 Old Auto-Loading Guile Module Linkage
an appropriate name.
- 24.4.5 Hobbit4D Linkage
+24.4.5 Hobbit4D Linkage
@@ -295,7 +295,7 @@
24.4.5 Hobbit4D Linkage
experimental; the (hobbit4d link) conventions are not well understood.
- 24.5 Underscore Folding
+24.5 Underscore Folding
@@ -307,7 +307,7 @@
24.5 Underscore Folding
%rename
to specify the Guile name of the wrapped
functions and variables (see CHANGES).
- 24.6 Typemaps
+24.6 Typemaps
@@ -399,7 +399,7 @@
24.6 Typemaps
Features and the %feature directive
for info on how to apply the %feature.
- 24.7 Representation of pointers as smobs
+24.7 Representation of pointers as smobs
@@ -420,7 +420,7 @@
24.7 Representation of pointers as smobs
If the Scheme object passed was not a SWIG smob representing a compatible
pointer, a wrong-type-arg
exception is raised.
- 24.7.1 Smobs
+24.7.1 Smobs
@@ -439,7 +439,7 @@
24.7.1 Smobs
the corresponding GOOPS class.
- 24.7.2 Garbage Collection
+24.7.2 Garbage Collection
Garbage collection is a feature of Guile since version 1.6. As SWIG now requires Guile > 1.8,
@@ -453,7 +453,7 @@
24.7.2 Garbage Collection
Object ownership and %newobject in the SWIG manual. All typemaps use an $owner var, and
the guile module replaces $owner with 0 or 1 depending on feature:new.
- 24.8 Exception Handling
+24.8 Exception Handling
@@ -462,16 +462,16 @@
24.8 Exception Handling
- MAP(SWIG_MemoryError, "swig-memory-error");
- MAP(SWIG_IOError, "swig-io-error");
- MAP(SWIG_RuntimeError, "swig-runtime-error");
- MAP(SWIG_IndexError, "swig-index-error");
- MAP(SWIG_TypeError, "swig-type-error");
- MAP(SWIG_DivisionByZero, "swig-division-by-zero");
- MAP(SWIG_OverflowError, "swig-overflow-error");
- MAP(SWIG_SyntaxError, "swig-syntax-error");
- MAP(SWIG_ValueError, "swig-value-error");
- MAP(SWIG_SystemError, "swig-system-error");
+ MAP(SWIG_MemoryError, "swig-memory-error");
+ MAP(SWIG_IOError, "swig-io-error");
+ MAP(SWIG_RuntimeError, "swig-runtime-error");
+ MAP(SWIG_IndexError, "swig-index-error");
+ MAP(SWIG_TypeError, "swig-type-error");
+ MAP(SWIG_DivisionByZero, "swig-division-by-zero");
+ MAP(SWIG_OverflowError, "swig-overflow-error");
+ MAP(SWIG_SyntaxError, "swig-syntax-error");
+ MAP(SWIG_ValueError, "swig-value-error");
+ MAP(SWIG_SystemError, "swig-system-error");
@@ -479,7 +479,7 @@ 24.8 Exception Handling
The default when not specified here is to use "swig-error".
See Lib/exception.i for details.
- 24.9 Procedure documentation
+24.9 Procedure documentation
If invoked with the command-line option -procdoc
@@ -514,7 +514,7 @@ 24.9 Procedure documentation
typemap argument doc
. See Lib/guile/typemaps.i
for
details.
- 24.10 Procedures with setters
+24.10 Procedures with setters
For global variables, SWIG creates a single wrapper procedure
@@ -542,7 +542,7 @@
24.10 Procedures with setters
pointer)
and (struct-member -set pointer
value)
are not generated.
-
24.11 GOOPS Proxy Classes
+24.11 GOOPS Proxy Classes
SWIG can also generate classes and generic functions for use with
@@ -688,7 +688,7 @@
24.11 GOOPS Proxy Classes
%import "foo.h"
before the %inline
block.
- 24.11.1 Naming Issues
+24.11.1 Naming Issues
As you can see in the example above, there are potential naming conflicts. The default exported
@@ -725,7 +725,7 @@
24.11.1 Naming Issues
(use-modules ((Test) #:renamer (symbol-prefix-proc 'goops:)))
- 24.11.2 Linking
+24.11.2 Linking
The guile-modules generated above all need to be linked together. GOOPS support requires
diff --git a/Doc/Manual/Introduction.html b/Doc/Manual/Introduction.html
index 19d59a4df85..1c29f476038 100644
--- a/Doc/Manual/Introduction.html
+++ b/Doc/Manual/Introduction.html
@@ -1,12 +1,13 @@
-
+
Introduction
+
- 2 Introduction
+2 Introduction
@@ -31,7 +32,7 @@ 2 Introduction
- 2.1 What is SWIG?
+2.1 What is SWIG?
@@ -71,7 +72,7 @@
2.1 What is SWIG?
in scientific and engineering projects. However, nowadays SWIG is known to be used in many
large open source and commercial projects.
- 2.2 Why use SWIG?
+2.2 Why use SWIG?
@@ -143,7 +144,7 @@
2.2 Why use SWIG?
every aspect of the language bindings. This is the main reason why SWIG has such a large
user manual ;-).
- 2.3 A SWIG example
+2.3 A SWIG example
@@ -157,14 +158,16 @@
2.3 A SWIG example
double My_variable = 3.0;
/* Compute factorial of n */
-int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
+int fact(int n) {
+ if (n <= 1)
+ return 1;
+ else
+ return n*fact(n-1);
}
/* Compute n mod m */
int my_mod(int n, int m) {
- return(n % m);
+ return(n % m);
}
@@ -174,7 +177,7 @@ 2.3 A SWIG example
interface file as shown below (by convention, these files carry a .i
suffix) :
- 2.3.1 SWIG interface file
+2.3.1 SWIG interface file
@@ -199,7 +202,7 @@ 2.3.1 SWIG interface file
provides a location for inserting additional code, such as C header
files or additional C declarations, into the generated C wrapper code.
- 2.3.2 The swig command
+2.3.2 The swig command
@@ -221,8 +224,7 @@
2.3.2 The swig command
7.5
%
-
-
+
The swig command produced a new file called
example_wrap.c that should be compiled along with the
example.c file. Most operating systems and scripting
@@ -233,7 +235,7 @@
2.3.2 The swig command
example_wrap.c reveals a hideous mess. However, you
almost never need to worry about it.
- 2.3.3 Building a Perl5 module
+2.3.3 Building a Perl5 module
@@ -244,8 +246,8 @@
2.3.3 Building a Perl5 module
unix > swig -perl5 example.i
unix > gcc -c example.c example_wrap.c \
- -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE
-unix > ld -G example.o example_wrap.o -o example.so # This is for Solaris
+ -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE
+unix > ld -G example.o example_wrap.o -o example.so # This is for Solaris
unix > perl5.003
use example;
print example::fact(4), "\n";
@@ -259,7 +261,7 @@ 2.3.3 Building a Perl5 module
- 2.3.4 Building a Python module
+2.3.4 Building a Python module
@@ -283,7 +285,7 @@
2.3.4 Building a Python module
7.5
- 2.3.5 Shortcuts
+2.3.5 Shortcuts
@@ -296,7 +298,7 @@
2.3.5 Shortcuts
unix > swig -perl5 -module example example.h
unix > gcc -c example.c example_wrap.c \
- -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE
+ -I/usr/local/lib/perl5/sun4-solaris/5.003/CORE
unix > ld -G example.o example_wrap.o -o example.so
unix > perl5.003
use example;
@@ -309,7 +311,7 @@ 2.3.5 Shortcuts
7.5
- 2.4 Supported C/C++ language features
+2.4 Supported C/C++ language features
@@ -334,8 +336,7 @@
2.4 Supported C/C++ language features
-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 C++11 section.
@@ -349,7 +350,7 @@
2.4 Supported C/C++ language features
stresses the very limits of many C++ compilers.
- 2.5 Non-intrusive interface building
+2.5 Non-intrusive interface building
@@ -361,7 +362,7 @@
2.5 Non-intrusive interface building
possible to support different types of interfaces depending on the application.
- 2.6 Incorporating SWIG into a build system
+2.6 Incorporating SWIG into a build system
@@ -384,7 +385,7 @@
2.6 Incorporating SWIG into a build
-There is growing support for SWIG in some build tools, for example CMake
+There is growing support for SWIG in some build tools, for example CMake
is a cross-platform, open-source build manager with built in support for SWIG. CMake can detect the SWIG executable
and many of the target language libraries for linking against.
CMake knows how to build shared libraries and loadable modules on many different operating systems.
@@ -419,7 +420,7 @@
2.6 Incorporating SWIG into a build
For other target languages on Windows a dll, instead of a .pyd file, is usually generated.
- 2.7 Hands off code generation
+2.7 Hands off code generation
@@ -432,7 +433,7 @@
2.7 Hands off code generation
details.
- 2.8 SWIG and freedom
+2.8 SWIG and freedom
@@ -458,6 +459,12 @@
2.8 SWIG and freedom
of the programmer's way----the last thing any developer wants to do is
to spend their time debugging the output of a tool that relies on
non-portable or unreliable programming features.
+Dependencies are often a source of incompatibilities and problems and so
+additional third party libraries are not used in the generated code.
+SWIG will also generally avoid generating code that introduces a dependency
+on the C++ Standard Template Library (STL).
+SWIG will generate code that depends on the C libraries though.
+
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index 3a4f7ee5d3a..dae6edc01ca 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -1,11 +1,12 @@
-
+
SWIG and Java
+
- 25 SWIG and Java
+25 SWIG and Java
Further details on the generated Java classes
@@ -157,7 +162,7 @@ 25 SWIG and Java
- 25.1 Overview
+25.1 Overview
@@ -192,7 +197,7 @@
25.1 Overview
The latter sections cover the advanced techniques of using typemaps for complete control of the wrapping process.
- 25.2 Preliminaries
+25.2 Preliminaries
@@ -209,10 +214,10 @@
25.2 Preliminaries
This is the commonly used method to load JNI code so your system will more than likely support this.
-Android uses Java JNI and also works with SWIG. Please read the Android chapter in conjunction with this one if you are targeting Android.
+Android uses Java JNI and also works with SWIG. Please read the Android chapter in conjunction with this one if you are targeting Android.
- 25.2.1 Running SWIG
+25.2.1 Running SWIG
@@ -271,7 +276,7 @@
25.2.1 Running SWIG
compiling and using the generated files.
- 25.2.2 Additional Commandline Options
+25.2.2 Additional Commandline Options
@@ -308,7 +313,7 @@
25.2.2 Additional Commandline Options
Their use will become clearer by the time you have finished reading this section on SWIG and Java.
- 25.2.3 Getting the right header files
+25.2.3 Getting the right header files
@@ -323,7 +328,7 @@
25.2.3 Getting the right header fil
The exact location may vary on your machine, but the above locations are typical.
- 25.2.4 Compiling a dynamic module
+25.2.4 Compiling a dynamic module
@@ -345,8 +350,6 @@
25.2.4 Compiling a dynamic module
your compiler and linker to get the right set of options. You might also
check the SWIG Wiki for
additional information.
-JNI compilation
-is a useful reference for compiling on different platforms.
@@ -360,7 +363,7 @@
25.2.4 Compiling a dynamic module
If the name of your SWIG module is "example ", the name of the corresponding shared library file should be "libexample.so " (or equivalent depending on your machine, see Dynamic linking problems for more information).
The name of the module is specified using the %module directive or -module command line option.
- 25.2.5 Using your module
+25.2.5 Using your module
@@ -395,7 +398,7 @@
25.2.5 Using your module
If it doesn't work have a look at the following section which discusses problems loading the shared library.
- 25.2.6 Dynamic linking problems
+25.2.6 Dynamic linking problems
@@ -461,9 +464,9 @@
25.2.6 Dynamic linking problems<
$ java runme
Exception in thread "main" java.lang.UnsatisfiedLinkError: exampleJNI.gcd(II)I
- at exampleJNI.gcd(Native Method)
- at example.gcd(example.java:12)
- at runme.main(runme.java:18)
+ at exampleJNI.gcd(Native Method)
+ at example.gcd(example.java:12)
+ at runme.main(runme.java:18)
@@ -482,7 +485,7 @@
25.2.6 Dynamic linking problems<
- 25.2.7 Compilation problems and compiling with C++
+25.2.7 Compilation problems and compiling with C++
@@ -534,7 +537,7 @@
25.2.7 Compilation problems and
- 25.2.8 Building on Windows
+25.2.8 Building on Windows
@@ -543,7 +546,7 @@
25.2.8 Building on Windows
This section covers the process of using SWIG with Microsoft Visual C++ 6 although the procedure may be similar with other compilers.
In order for everything to work, you will need to have a JDK installed on your machine in order to read the JNI header files.
- 25.2.8.1 Running SWIG from Visual Studio
+25.2.8.1 Running SWIG from Visual Studio
@@ -582,7 +585,7 @@
25.2.8.1 Running SWIG from Visual StudioDynamic linking problems.
- 25.2.8.2 Using NMAKE
+25.2.8.2 Using NMAKE
@@ -627,11 +630,11 @@
25.2.8.2 Using NMAKE
JAVA_INCLUDE = -ID:\jdk1.3\include -ID:\jdk1.3\include\win32
java::
- swig -java -o $(WRAPFILE) $(INTERFACE)
- $(CC) $(CFLAGS) $(JAVA_INCLUDE) $(SRCS) $(WRAPFILE)
- set LIB=$(TOOLS)\lib
- $(LINK) $(LOPT) -out:example.dll $(LIBS) example.obj example_wrap.obj
- javac *.java
+ swig -java -o $(WRAPFILE) $(INTERFACE)
+ $(CC) $(CFLAGS) $(JAVA_INCLUDE) $(SRCS) $(WRAPFILE)
+ set LIB=$(TOOLS)\lib
+ $(LINK) $(LOPT) -out:example.dll $(LIBS) example.obj example_wrap.obj
+ javac *.java
@@ -641,7 +644,7 @@
25.2.8.2 Using NMAKE
- 25.3 A tour of basic C/C++ wrapping
+25.3 A tour of basic C/C++ wrapping
@@ -651,7 +654,7 @@
25.3 A tour of basic C/C++ wrapping
This section briefly covers the essential aspects of this wrapping.
- 25.3.1 Modules, packages and generated Java classes
+25.3.1 Modules, packages and generated Java classes
@@ -687,7 +690,7 @@
25.3.1 Modules, packages and gene
SWIG won't create the directory, so make sure it exists beforehand.
- 25.3.2 Functions
+25.3.2 Functions
@@ -721,7 +724,7 @@
25.3.2 Functions
- 25.3.3 Global variables
+25.3.3 Global variables
@@ -808,7 +811,7 @@
25.3.3 Global variables
- 25.3.4 Constants
+25.3.4 Constants
@@ -948,7 +951,7 @@
25.3.4 Constants
- 25.3.5 Enumerations
+25.3.5 Enumerations
@@ -962,7 +965,7 @@
25.3.5 Enumerations
Before looking at the various approaches for wrapping named C/C++ enums, anonymous enums are considered.
- 25.3.5.1 Anonymous enums
+25.3.5.1 Anonymous enums
@@ -1025,7 +1028,7 @@
25.3.5.1 Anonymous enums
- 25.3.5.2 Typesafe enums
+25.3.5.2 Typesafe enums
@@ -1119,7 +1122,7 @@
25.3.5.2 Typesafe enums
The following section details proper Java enum generation.
- 25.3.5.3 Proper Java enums
+25.3.5.3 Proper Java enums
@@ -1172,7 +1175,7 @@
25.3.5.3 Proper Java enums
Simpler Java enums for enums without initializers section.
- 25.3.5.4 Type unsafe enums
+25.3.5.4 Type unsafe enums
@@ -1220,7 +1223,7 @@
25.3.5.4 Type unsafe enums
Thus the upgrade path to proper enums provided in JDK 1.5 is more painful.
- 25.3.5.5 Simple enums
+25.3.5.5 Simple enums
@@ -1239,7 +1242,7 @@
25.3.5.5 Simple enums
The type unsafe approach is preferable to this one and this simple approach is only included for backwards compatibility with these earlier versions of SWIG.
- 25.3.6 Pointers
+25.3.6 Pointers
@@ -1327,7 +1330,7 @@
25.3.6 Pointers
a NULL pointer if the conversion can't be performed.
- 25.3.7 Structures
+25.3.7 Structures
@@ -1337,7 +1340,7 @@
25.3.7 Structures
struct Vector {
- double x,y,z;
+ double x,y,z;
};
@@ -1495,7 +1498,7 @@ 25.3.7 Structures
- 25.3.8 C++ classes
+25.3.8 C++ classes
@@ -1558,7 +1561,7 @@
25.3.8 C++ classes
- 25.3.9 C++ inheritance
+25.3.9 C++ inheritance
@@ -1619,7 +1622,7 @@
25.3.9 C++ inheritance
A warning is given when multiple inheritance is detected and only the first base class is used.
- 25.3.10 Pointers, references, arrays and pass by value
+25.3.10 Pointers, references, arrays and pass by value
@@ -1674,7 +1677,7 @@
25.3.10 Pointers, references, arrays
when the returned object's finalizer is run by the garbage collector).
- 25.3.10.1 Null pointers
+25.3.10.1 Null pointers
@@ -1698,7 +1701,7 @@
25.3.10.1 Null pointers
The converse also occurs, that is, NULL pointers are translated into null Java objects when returned from a C/C++ function.
- 25.3.11 C++ overloaded functions
+25.3.11 C++ overloaded functions
@@ -1813,7 +1816,7 @@
25.3.11 C++ overloaded functions
- 25.3.12 C++ default arguments
+25.3.12 C++ default arguments
@@ -1856,7 +1859,7 @@
25.3.12 C++ default arguments
- 25.3.13 C++ namespaces
+25.3.13 C++ namespaces
@@ -1946,7 +1949,7 @@
25.3.13 C++ namespaces
you will need to open up the visibility for the pointer constructor and getCPtr method from the default 'protected' to 'public' with the SWIG_JAVABODY_PROXY macro. See Java code typemaps .
- 25.3.14 C++ templates
+25.3.14 C++ templates
@@ -1995,7 +1998,21 @@
25.3.14 C++ templates
More details can be found in the SWIG and C++ chapter.
- 25.3.15 C++ Smart Pointers
+25.3.15 C++ Smart Pointers
+
+
+25.3.15.1 The shared_ptr Smart Pointer
+
+
+
+The C++11 standard provides std::shared_ptr which was derived from the Boost
+implementation, boost::shared_ptr .
+Both of these are available for Java in the SWIG library and usage is outlined
+in the shared_ptr smart pointer library section.
+
+
+
+25.3.15.2 Generic Smart Pointers
@@ -2079,7 +2096,7 @@
25.3.15 C++ Smart Pointers
- 25.4 Further details on the generated Java classes
+25.4 Further details on the generated Java classes
@@ -2094,7 +2111,7 @@
25.4 Further details on the generated Jav
First, the crucial intermediary JNI class is considered.
- 25.4.1 The intermediary JNI class
+25.4.1 The intermediary JNI class
@@ -2214,7 +2231,7 @@
25.4.1 The intermediary JNI class
from modulename to modulenameModule .
- 25.4.1.1 The intermediary JNI class pragmas
+25.4.1.1 The intermediary JNI class pragmas
@@ -2296,7 +2313,7 @@
25.4.1.1 The intermediary JNI class pragm
All the methods in the intermediary JNI class will then not be callable outside of the package as the method modifiers have been changed from public access to default access. This is useful if you want to prevent users calling these low level functions.
- 25.4.2 The Java module class
+25.4.2 The Java module class
@@ -2327,7 +2344,7 @@
25.4.2 The Java module class
The primary reason for having the module class wrapping the calls in the intermediary JNI class is to implement static type checking. In this case only a Foo can be passed to the egg function, whereas any long can be passed to the egg function in the intermediary JNI class.
- 25.4.2.1 The Java module class pragmas
+25.4.2.1 The Java module class pragmas
@@ -2378,7 +2395,7 @@
25.4.2.1 The Java module class pragm
- 25.4.3 Java proxy classes
+25.4.3 Java proxy classes
@@ -2390,8 +2407,8 @@
25.4.3 Java proxy classes
public class Foo {
- private long swigCPtr;
- protected boolean swigCMemOwn;
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
protected Foo(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
@@ -2454,7 +2471,7 @@ 25.4.3 Java proxy classes
- 25.4.3.1 Memory management
+25.4.3.1 Memory management
@@ -2616,7 +2633,7 @@
25.4.3.1 Memory management
- 25.4.3.2 Inheritance
+25.4.3.2 Inheritance
@@ -2641,8 +2658,8 @@
25.4.3.2 Inheritance
public class Base {
- private long swigCPtr;
- protected boolean swigCMemOwn;
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
protected Base(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
@@ -2682,7 +2699,7 @@ 25.4.3.2 Inheritance
public class Derived extends Base {
- private long swigCPtr;
+ private transient long swigCPtr;
protected Derived(long cPtr, boolean cMemoryOwn) {
super(exampleJNI.SWIGDerivedUpcast(cPtr), cMemoryOwn);
@@ -2732,7 +2749,7 @@ 25.4.3.2 Inheritance
- 25.4.3.3 Proxy classes and garbage collection
+25.4.3.3 Proxy classes and garbage collection
@@ -2815,7 +2832,7 @@
25.4.3.3 Proxy classes and garbage colle
See the How to Handle Java Finalization's Memory-Retention Issues article for alternative approaches to managing memory by avoiding finalizers altogether.
- 25.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
+25.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling
@@ -2937,7 +2954,7 @@
25.4.3.4 The premature garbage collection preventio
Compatibility note: The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.
- 25.4.3.5 Single threaded applications and thread safety
+25.4.3.5 Single threaded applications and thread safety
@@ -2960,8 +2977,8 @@
25.4.3.5 Single threaded applicatio
public class Test {
- private long swigCPtr;
- protected boolean swigCMemOwn;
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
protected Test(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
@@ -3025,7 +3042,7 @@ 25.4.3.5 Single threaded applicatio
- 25.4.4 Type wrapper classes
+25.4.4 Type wrapper classes
@@ -3034,7 +3051,7 @@
25.4.4 Type wrapper classes
public class SWIGTYPE_p_int {
- private long swigCPtr;
+ private transient long swigCPtr;
protected SWIGTYPE_p_int(long cPtr, boolean bFutureUse) {
swigCPtr = cPtr;
@@ -3112,7 +3129,7 @@ 25.4.4 Type wrapper classes
- 25.4.5 Enum classes
+25.4.5 Enum classes
@@ -3121,7 +3138,7 @@
25.4.5 Enum classes
The following sub-sections detail the various types of enum classes that can be generated.
- 25.4.5.1 Typesafe enum classes
+25.4.5.1 Typesafe enum classes
@@ -3205,7 +3222,7 @@
25.4.5.1 Typesafe enum classes toString method is overridden so that the enum name is available.
- 25.4.5.2 Proper Java enum classes
+25.4.5.2 Proper Java enum classes
@@ -3283,7 +3300,7 @@
25.4.5.2 Proper Java enum classesSimpler Java enums for enums without initializers section describes how typemaps can be used to achieve this.
- 25.4.5.3 Type unsafe enum classes
+25.4.5.3 Type unsafe enum classes
@@ -3314,7 +3331,7 @@
25.4.5.3 Type unsafe enum classe
- 25.5 Cross language polymorphism using directors
+25.5 Cross language polymorphism using directors
@@ -3336,7 +3353,7 @@
25.5 Cross language polymorphism using director
Neither C++ code nor Java code needs to know where a particular method is implemented: the combination of proxy classes, director classes, and C wrapper functions transparently takes care of all the cross-language method routing.
- 25.5.1 Enabling directors
+25.5.1 Enabling directors
@@ -3404,7 +3421,7 @@
25.5.1 Enabling directors
- 25.5.2 Director classes
+25.5.2 Director classes
@@ -3431,7 +3448,7 @@
25.5.2 Director classes
- 25.5.3 Overhead and code bloat
+25.5.3 Overhead and code bloat
@@ -3449,7 +3466,7 @@
25.5.3 Overhead and code bloat
- 25.5.4 Simple directors example
+25.5.4 Simple directors example
@@ -3514,7 +3531,7 @@
25.5.4 Simple directors example
- 25.5.5 Director threading issues
+25.5.5 Director threading issues
@@ -3534,7 +3551,7 @@
25.5.5 Director threading issues
- 25.5.6 Director performance tuning
+25.5.6 Director performance tuning
@@ -3555,7 +3572,7 @@
25.5.6 Director performance tuning<
The disadvantage is that invocation of director methods from C++ when Java doesn't actually override the method will require an additional call up into Java and back to C++. As such, this option is only useful when overrides are extremely common and instantiation is frequent enough that its performance is critical.
- 25.5.7 Java exceptions from directors
+25.5.7 Java exceptions from directors
@@ -3752,7 +3769,7 @@
25.5.7 Java exceptions from dir
of the "directorthrows" typemaps. In this example, a
generic "directorthrows" typemap is appropriate for all three exceptions - all
take single string constructors. If the exceptions had different constructors,
-it would be neccessary to have separate typemaps for each exception type.
+it would be necessary to have separate typemaps for each exception type.
@@ -25,12 +26,12 @@ 26 SWIG and Javascript
Embedded Webkit
Creating Applications with node-webkit
-Examples
+Examples
Simple
Class
@@ -51,7 +52,7 @@ 26 SWIG and Javascript
This chapter describes SWIG's support of Javascript. It does not cover SWIG basics, but only information that is specific to this module.
- 26.1 Overview
+26.1 Overview
Javascript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development.
@@ -62,10 +63,10 @@
26.1 Overview
With node-webkit there is a platform which uses Google's Chromium
as Web-Browser widget and node.js
for javascript extensions.
- 26.2 Preliminaries
+26.2 Preliminaries
- 26.2.1 Running SWIG
+26.2.1 Running SWIG
Suppose that you defined a SWIG module such as the following:
@@ -89,11 +90,22 @@ 26.2.1 Running SWIG
$ swig -c++ -javascript -jsc example.i
The V8 code that SWIG generates should work with most versions from 3.11.10 up to 3.29.14 and later.
-Specify the V8 version when running SWIG (e.g. 3.25.30)
+The API headers for V8 >= 4.3.0 define constants which SWIG can use to
+determine the V8 version it is compiling for. For versions < 4.3.0, you
+need to specify the V8 version when running SWIG. This is specified as a hex
+constant, but the constant is read as pairs of decimal digits, so for V8
+3.25.30 use constant 0x032530. This scheme can't represent components > 99,
+but this constant is only useful for V8 < 4.3.0, and no V8 versions from
+that era had a component > 99. For example:
$ swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i
+If you're targetting V8 >= 4.3.0, you would just run swig like so:
+
+
+$ swig -c++ -javascript -v8 example.i
+
This creates a C/C++ source file example_wrap.c
or example_wrap.cxx
. The generated C source file contains the low-level wrappers that need to be compiled and linked with the rest of your C/C++ application to create an extension module.
The name of the wrapper file is derived from the name of the input file. For example, if the input file is example.i
, the name of the wrapper file is example_wrap.c
. To change this, you can use the -o option. The wrapped module will export one function which must be called to register the module with the Javascript interpreter. For example, if your module is named example
the corresponding initializer for JavascriptCore would be
@@ -109,7 +121,7 @@
26.2.1 Running SWIG
Note : be aware that
v8
has a C++ API, and thus, the generated modules must be compiled as C++.
-
26.2.2 Running Tests and Examples
+
26.2.2 Running Tests and Examples
The configuration for tests and examples currently supports Linux and Mac only and not MinGW (Windows) yet.
@@ -141,7 +153,7 @@
26.2.2 Running Tests and Exa
$ make check-javascript-examples V8_VERSION=0x032530 ENGINE=v8
- 26.2.3 Known Issues
+26.2.3 Known Issues
At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues.
@@ -156,17 +168,17 @@ 26.2.3 Known Issues
instanceOf
does not work under JSC
-The primary development environment has been Linux (Ubuntu 12.04). Windows and OSX have been tested sporadically. Therefore, the generators might have more issues on those platforms. Please report back any problem you observe to help us improving this module quickly.
+The primary development environment has been Linux (Ubuntu 12.04). Windows and Mac OS X have been tested sporadically. Therefore, the generators might have more issues on those platforms. Please report back any problem you observe to help us improving this module quickly.
- 26.3 Integration
+26.3 Integration
This chapter gives a short introduction how to use a native Javascript extension: as a node.js
module, and as an extension for an embedded Webkit.
- 26.3.1 Creating node.js Extensions
+26.3.1 Creating node.js Extensions
-To install node.js
you can download an installer from their web-site for OSX and Windows. For Linux you can either build the source yourself and run sudo checkinstall
or keep to the (probably stone-age) packaged version. For Ubuntu there is a PPA available.
+To install node.js
you can download an installer from their web-site for Mac OS X and Windows. For Linux you can either build the source yourself and run sudo checkinstall
or keep to the (probably stone-age) packaged version. For Ubuntu there is a PPA available.
$ sudo add-apt-repository ppa:chris-lea/node.js
@@ -197,10 +209,10 @@ 26.3.1 Creating node.js Extensions<
$ swig -javascript -node -c++ example.i
-Then run node-gyp
+Then run node-gyp build
to actually create the module:
-$ node-gyp
+$ node-gyp build
This will create a build
folder containing the native module. To use the extension you need to 'require' it in your Javascript source file:
@@ -209,7 +221,7 @@
26.3.1 Creating node.js Extensions<
A more detailed explanation is given in the Examples section.
- 26.3.1.1 Troubleshooting
+26.3.1.1 Troubleshooting
@@ -221,12 +233,12 @@ 26.3.1.1 Troubleshooting
$ sudo apt-get remove gyp
- 26.3.2 Embedded Webkit
+26.3.2 Embedded Webkit
-Webkit is pre-installed on OSX and available as a library for GTK.
+Webkit is pre-installed on Mac OS X and available as a library for GTK.
- 26.3.2.1 OSX
+26.3.2.1 Mac OS X
There is general information about programming with WebKit on Apple Developer Documentation . Details about Cocoa
programming are not covered here.
@@ -274,7 +286,7 @@ 26.3.2.1 OSX
@end
- 26.3.2.2 GTK
+26.3.2.2 GTK
There is general information about programming GTK at GTK documentation and in the GTK tutorial , and for Webkit there is a Webkit GTK+ API Reference .
@@ -319,7 +331,7 @@ 26.3.2.2 GTK
}
- 26.3.3 Creating Applications with node-webkit
+26.3.3 Creating Applications with node-webkit
To get started with node-webkit
there is a very informative set of wiki pages .
@@ -348,7 +360,7 @@ 26.3.3 Creating Applications wi
- package.json
:
+package.json
:
@@ -368,7 +380,7 @@ 26.3.3 Creating Applications wi
the main window.
- app.html
:
+app.html
:
@@ -395,7 +407,7 @@
26.3.3 Creating Applications wi
- app.js
:
+app.js
:
@@ -410,12 +422,12 @@
26.3.3 Creating Applications wi
};
-
26.4 Examples
+
26.4 Examples
Some basic examples are shown here in more detail.
-
26.4.1 Simple
+
26.4.1 Simple
The common example simple
looks like this:
@@ -465,7 +477,7 @@
26.4.1 Simple
Note : ECMAScript 5, the currently implemented Javascript standard, does not have modules. node.js
and other implementations provide this mechanism defined by the CommonJS group. For browsers this is provided by Browserify , for instance.
-
26.4.2 Class
+
26.4.2 Class
The common example class
defines three classes, Shape
, Circle
, and Square
:
@@ -595,12 +607,12 @@
26.4.2 Class
Note : In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property
prototype
of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in
Inheritance and the prototype chain , for instance.
-
26.5 Implementation
+
26.5 Implementation
The Javascript Module implementation has taken a very different approach compared to other language modules in order to support different Javascript interpreters.
-
26.5.1 Source Code
+
26.5.1 Source Code
The Javascript module is implemented in Source/Modules/javascript.cxx
. It dispatches the code generation to a JSEmitter
instance, V8Emitter
or JSCEmitter
. Additionally there are some helpers: Template
, for templated code generation, and JSEmitterState
, which is used to manage state information during AST traversal. This rough map shall make it easier to find a way through this huge source file:
@@ -701,7 +713,7 @@
26.5.1 Source Code
...
- 26.5.2 Code Templates
+26.5.2 Code Templates
All generated code is created on the basis of code templates. The templates for JavascriptCore can be found in Lib/javascript/jsc/javascriptcode.swg
, for v8 in Lib/javascript/v8/javascriptcode.swg
.
@@ -740,7 +752,7 @@ 26.5.2 Code Templates
Template
creates a copy of that string and Template::replace
uses Swig's Replaceall
to replace variables in the template. Template::trim
can be used to eliminate leading and trailing whitespaces. Template::print
is used to write the final template string to a Swig DOH
(based on Printv
). All methods allow chaining.
- 26.5.3 Emitter
+26.5.3 Emitter
The Javascript module delegates code generation to a JSEmitter
instance. The following extract shows the essential interface:
@@ -859,7 +871,7 @@ 26.5.3 Emitter
In enterClass
the emitter stores state information that is necessary when processing class members. In exitClass
the wrapper code for the whole class is generated.
- 26.5.4 Emitter states
+26.5.4 Emitter states
For storing information during the AST traversal the emitter provides a JSEmitterState
with different slots to store data representing the scopes global, class, function, and variable.
@@ -903,7 +915,7 @@ 26.5.4 Emitter states
State information can be retrieved using state.clazz(NAME)
or with Getattr
on state.clazz()
which actually returns a Hash
instance.
- 26.5.5 Handling Exceptions in JavascriptCore
+26.5.5 Handling Exceptions in JavascriptCore
Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.
diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html
index 740988e71eb..954de54f7a0 100644
--- a/Doc/Manual/Library.html
+++ b/Doc/Manual/Library.html
@@ -1,12 +1,13 @@
-
+
SWIG Library
+
- 9 SWIG library
+9 SWIG library
@@ -59,7 +60,7 @@ 9 SWIG library
carefully if you used the old libraries.
- 9.1 The %include directive and library search path
+9.1 The %include directive and library search path
@@ -91,7 +92,7 @@
9.1 The %include directive and library search path
The directories that are searched are displayed when using -verbose commandline option.
- 9.2 C Arrays and Pointers
+9.2 C Arrays and Pointers
@@ -103,7 +104,7 @@
9.2 C Arrays and Pointers
memory, their use is potentially unsafe and you should exercise caution.
- 9.2.1 cpointer.i
+9.2.1 cpointer.i
@@ -319,7 +320,7 @@
9.2.1 cpointer.i
Note: When working with simple pointers, typemaps can often be used to provide more seamless operation.
- 9.2.2 carrays.i
+9.2.2 carrays.i
@@ -497,7 +498,7 @@
9.2.2 carrays.i
used with types of char or char * .
- 9.2.3 cmalloc.i
+9.2.3 cmalloc.i
@@ -658,7 +659,7 @@
9.2.3 cmalloc.i
- 9.2.4 cdata.i
+9.2.4 cdata.i
@@ -760,7 +761,7 @@
9.2.4 cdata.i
Clearly they are unsafe.
- 9.3 C String Handling
+9.3 C String Handling
@@ -780,7 +781,7 @@
9.3 C String Handling
for manipulating raw C strings.
- 9.3.1 Default string handling
+9.3.1 Default string handling
@@ -821,7 +822,7 @@
9.3.1 Default string handling
not work well with binary data. Instead, strings are assumed to be NULL-terminated.
- 9.3.2 Passing binary data
+9.3.2 Passing binary data
@@ -863,7 +864,7 @@
9.3.2 Passing binary data
The (char *STRING, int LENGTH) multi-argument typemap is also available in addition to (char *STRING, size_t LENGTH) .
- 9.3.3 Using %newobject to release memory
+9.3.3 Using %newobject to release memory
@@ -904,7 +905,7 @@
9.3.3 Using %newobject to release memory
See Object ownership and %newobject for more details.
- 9.3.4 cstring.i
+9.3.4 cstring.i
@@ -1364,7 +1365,7 @@
9.3.4 cstring.i
- 9.4 STL/C++ Library
+9.4 STL/C++ Library
@@ -1392,7 +1393,8 @@
9.4 STL/C++ Library
std::set set std_set.i
std::string string std_string.i
std::vector vector std_vector.i
- std::shared_ptr shared_ptr std_shared_ptr.i
+ std::array array (C++11) std_array.i
+ std::shared_ptr shared_ptr (C++11) std_shared_ptr.i
@@ -1402,7 +1404,7 @@ 9.4 STL/C++ Library
- 9.4.1 std::string
+9.4.1 std::string
@@ -1486,7 +1488,7 @@
9.4.1 std::string
- 9.4.2 std::vector
+9.4.2 std::vector
@@ -1665,7 +1667,7 @@
9.4.2 std::vector
details and the public API exposed to the interpreter vary.
- 9.4.3 STL exceptions
+9.4.3 STL exceptions
@@ -1715,7 +1717,7 @@
9.4.3 STL exceptions
Any thrown STL exceptions will then be gracefully handled instead of causing a crash.
- 9.4.4 shared_ptr smart pointer
+9.4.4 shared_ptr smart pointer
@@ -1900,11 +1902,13 @@
9.4.4 shared_ptr smart pointer
-Note: There is currently no support for %shared_ptr and the director feature.
+Note: There is somewhat limited support for %shared_ptr and the director feature
+and the degress of success varies among the different target languages.
+Please help to improve this support by providing patches with improvements.
- 9.4.5 auto_ptr smart pointer
+9.4.5 auto_ptr smart pointer
@@ -1953,10 +1957,10 @@
9.4.5 auto_ptr smart pointer
- 9.5 Utility Libraries
+9.5 Utility Libraries
- 9.5.1 exception.i
+9.5.1 exception.i
diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html
index 0b8d47846b1..0867ba926b2 100644
--- a/Doc/Manual/Lisp.html
+++ b/Doc/Manual/Lisp.html
@@ -1,12 +1,13 @@
-
+
SWIG and Common Lisp
+
- 27 SWIG and Common Lisp
+27 SWIG and Common Lisp
@@ -41,7 +42,7 @@ 27 SWIG and Common Lisp
Lisp, Common Foreign Function Interface(CFFI), CLisp and UFFI
foreign function interfaces.
- 27.1 Allegro Common Lisp
+27.1 Allegro Common Lisp
@@ -50,7 +51,7 @@
27.1 Allegro Common Lisp
here
- 27.2 Common Foreign Function Interface(CFFI)
+27.2 Common Foreign Function Interface(CFFI)
@@ -77,7 +78,7 @@
27.2 Common Foreign Function Interface(CFFI)
files and the various things which you can do with them.
- 27.2.1 Additional Commandline Options
+27.2.1 Additional Commandline Options
@@ -118,7 +119,7 @@
27.2.1 Additional Commandline Options
- 27.2.2 Generating CFFI bindings
+27.2.2 Generating CFFI bindings
As we mentioned earlier the ideal way to use SWIG is to use interface
@@ -219,19 +220,19 @@ 27.2.2 Generating CFFI bindings
(cl:defconstant x (cl:ash 5 -1))
(cffi:defcstruct bar
- (p :short)
- (q :short)
- (a :char)
- (b :char)
- (z :pointer)
- (n :pointer))
+ (p :short)
+ (q :short)
+ (a :char)
+ (b :char)
+ (z :pointer)
+ (n :pointer))
(cffi:defcvar ("my_struct" my_struct)
:pointer)
(cffi:defcstruct foo
- (a :int)
- (b :pointer))
+ (a :int)
+ (b :pointer))
(cffi:defcfun ("pointer_func" pointer_func) :int
(ClosureFun :pointer)
@@ -247,9 +248,9 @@ 27.2.2 Generating CFFI bindings
(array :pointer))
(cffi:defcenum color
- :RED
- :BLUE
- :GREEN)
+ :RED
+ :BLUE
+ :GREEN)
@@ -284,9 +285,11 @@
27.2.2 Generating CFFI bindings
%feature("export");
%feature("inline") lispsort_double;
-
%feature("intern_function", "my-lispify") lispsort_double;
+%feature("export", package="'some-other-package") lispsort_double;
+
%rename func123 renamed_cool_func;
+
%ignore "pointer_func";
%include "test.h"
@@ -310,12 +313,13 @@ 27.2.2 Generating CFFI bindings
lispsort_double;, here we are using an additional feature
which allows us to use our lispify function.
-The export feature allows us to export the symbols. The inline
- feature declaims the declared function as inline. The rename
- directive allows us to change the name(it is useful when
- generating C wrapper code for handling overloaded
- functions). The ignore directive ignores a certain
- declaration.
+
The export feature allows us to export the symbols. If
+ the package argument is given, then the symbol will be exported to
+ the specified Lisp package. The inline feature declaims the
+ declared function as inline. The rename directive allows us to
+ change the name(it is useful when generating C wrapper code for handling
+ overloaded functions). The ignore directive ignores a certain
+ declaration.
There are several other things which are possible, to see some
example of usage of SWIG look at the Lispbuilder and wxCL
@@ -332,12 +336,12 @@
27.2.2 Generating CFFI bindings
(cl:export '#.(swig-lispify "x" 'constant))
(cffi:defcstruct #.(swig-lispify "bar" 'classname)
- (#.(swig-lispify "p" 'slotname) :short)
- (#.(swig-lispify "q" 'slotname) :short)
- (#.(swig-lispify "a" 'slotname) :char)
- (#.(swig-lispify "b" 'slotname) :char)
- (#.(swig-lispify "z" 'slotname) :pointer)
- (#.(swig-lispify "n" 'slotname) :pointer))
+ (#.(swig-lispify "p" 'slotname) :short)
+ (#.(swig-lispify "q" 'slotname) :short)
+ (#.(swig-lispify "a" 'slotname) :char)
+ (#.(swig-lispify "b" 'slotname) :char)
+ (#.(swig-lispify "z" 'slotname) :pointer)
+ (#.(swig-lispify "n" 'slotname) :pointer))
(cl:export '#.(swig-lispify "bar" 'classname))
@@ -359,8 +363,8 @@ 27.2.2 Generating CFFI bindings
(cl:export '#.(swig-lispify "my_struct" 'variable))
(cffi:defcstruct #.(swig-lispify "foo" 'classname)
- (#.(swig-lispify "a" 'slotname) :int)
- (#.(swig-lispify "b" 'slotname) :pointer))
+ (#.(swig-lispify "a" 'slotname) :int)
+ (#.(swig-lispify "b" 'slotname) :pointer))
(cl:export '#.(swig-lispify "foo" 'classname))
@@ -381,18 +385,18 @@ 27.2.2 Generating CFFI bindings
(n :int)
(array :pointer))
-(cl:export '#.(my-lispify "lispsort_double" 'function))
+(cl:export '#.(my-lispify "lispsort_double" 'function) 'some-other-package)
(cffi:defcenum #.(swig-lispify "color" 'enumname)
- #.(swig-lispify "RED" 'enumvalue :keyword)
- #.(swig-lispify "BLUE" 'enumvalue :keyword)
- #.(swig-lispify "GREEN" 'enumvalue :keyword))
+ #.(swig-lispify "RED" 'enumvalue :keyword)
+ #.(swig-lispify "BLUE" 'enumvalue :keyword)
+ #.(swig-lispify "GREEN" 'enumvalue :keyword))
(cl:export '#.(swig-lispify "color" 'enumname))
- 27.2.3 Generating CFFI bindings for C++ code
+27.2.3 Generating CFFI bindings for C++ code
This feature to SWIG (for CFFI) is very new and still far from
@@ -568,7 +572,7 @@
27.2.3 Generating CFFI bindings for C++ code
module feel free to contact us on the SWIG mailing list, and
also please add a "[CFFI]" tag in the subject line.
- 27.2.4 Inserting user code into generated files
+27.2.4 Inserting user code into generated files
@@ -608,7 +612,7 @@
27.2.4 Inserting user code into generated files
- 27.3 CLISP
+27.3 CLISP
@@ -638,7 +642,7 @@
27.3 CLISP
interface file for the CLISP module. The CLISP module tries to
produce code which is both human readable and easily modifyable.
- 27.3.1 Additional Commandline Options
+27.3.1 Additional Commandline Options
@@ -658,33 +662,33 @@
27.3.1 Additional Commandline Options
-extern-all
If this option is given then clisp definitions for all the functions
and global variables will be created otherwise only definitions for
- externed functions and variables are created.
+externed functions and variables are created.
-generate-typedef
If this option is given then def-c-type will be used to generate
- shortcuts according to the typedefs in the input.
+shortcuts according to the typedefs in the input.
- 27.3.2 Details on CLISP bindings
+27.3.2 Details on CLISP bindings
As mentioned earlier the CLISP bindings generated by SWIG may need
- some modifications. The clisp module creates a lisp file with
- the same name as the module name. This
- lisp file contains a 'defpackage' declaration, with the
- package name same as the module name. This package uses the
- 'common-lisp' and 'ffi' packages. Also, package exports all
- the functions, structures and variables for which an ffi
- binding was generated.
- After generating the defpackage statement, the clisp module also
- sets the default language.
+some modifications. The clisp module creates a lisp file with
+the same name as the module name. This
+lisp file contains a 'defpackage' declaration, with the
+package name same as the module name. This package uses the
+'common-lisp' and 'ffi' packages. Also, package exports all
+the functions, structures and variables for which an ffi
+binding was generated.
+After generating the defpackage statement, the clisp module also
+sets the default language.
(defpackage :test
@@ -734,18 +738,18 @@ 27.3.2 Details on CLISP bindings
(ffi:def-call-out pointer_func
(:name "pointer_func")
(:arguments (ClosureFun (ffi:c-function (:arguments (arg0 (ffi:c-pointer NIL))
- (arg1 (ffi:c-pointer NIL))
- (arg2 (ffi:c-pointer NIL)))
- (:return-type NIL)))
- (y ffi:int))
+ (arg1 (ffi:c-pointer NIL))
+ (arg2 (ffi:c-pointer NIL)))
+ (:return-type NIL)))
+ (y ffi:int))
(:return-type ffi:int)
(:library +library-name+))
(ffi:def-call-out func123
(:name "func123")
(:arguments (x (ffi:c-pointer div_t))
- (z (ffi:c-ptr (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100)))
- (y (ffi:c-ptr (ffi:c-ptr (ffi:c-array ffi:int (1000 10))))))
+ (z (ffi:c-ptr (ffi:c-array (ffi:c-ptr (ffi:c-ptr ffi:int)) 100)))
+ (y (ffi:c-ptr (ffi:c-ptr (ffi:c-array ffi:int (1000 10))))))
(:return-type ffi:int)
(:library +library-name+))
@@ -753,14 +757,14 @@ 27.3.2 Details on CLISP bindings
(ffi:def-call-out lispsort_double
(:name "lispsort_double")
(:arguments (n ffi:int)
- (array (ffi:c-ptr DOUBLE-FLOAT)))
+ (array (ffi:c-ptr DOUBLE-FLOAT)))
(:return-type NIL)
(:library +library-name+))
(ffi:def-call-out test123
(:name "test")
(:arguments (x SINGLE-FLOAT)
- (y DOUBLE-FLOAT))
+ (y DOUBLE-FLOAT))
(:return-type NIL)
(:library +library-name+))
@@ -795,7 +799,7 @@ 27.3.2 Details on CLISP bindings
- 27.4 UFFI
+27.4 UFFI
diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html
index 61f19be6849..004ca6f2b08 100644
--- a/Doc/Manual/Lua.html
+++ b/Doc/Manual/Lua.html
@@ -1,12 +1,13 @@
-
+
SWIG and Lua
+
- 28 SWIG and Lua
+28 SWIG and Lua
@@ -82,14 +83,14 @@ 28 SWIG and Lua
eLua stands for Embedded Lua (can be thought of as a flavor of Lua) and offers the full implementation of the Lua programming language to the embedded world, extending it with specific features for efficient and portable software embedded development. eLua runs on smaller devices like microcontrollers and provides the full features of the regular Lua desktop version. More information on eLua can be found here: http://www.eluaproject.net
- 28.1 Preliminaries
+28.1 Preliminaries
The current SWIG implementation is designed to work with Lua 5.0.x, 5.1.x and 5.2.x. It should work with later versions of Lua, but certainly not with Lua 4.0 due to substantial API changes. It is possible to either static link or dynamic link a Lua module into the interpreter (normally Lua static links its libraries, as dynamic linking is not available on all platforms). SWIG also has support for eLua starting from eLua 0.8. Due to substantial changes between SWIG 2.x and SWIG 3.0 and unavailability of testing platform, eLua status was downgraded to 'experimental'.
- 28.2 Running SWIG
+28.2 Running SWIG
@@ -137,7 +138,7 @@
28.2 Running SWIG
The -elua option puts all the C function wrappers and variable get/set wrappers in rotables. It also generates a metatable which will control the access to these variables from eLua. It also offers a significant amount of module size compression. On the other hand, the -eluac option puts all the wrappers in a single rotable. With this option, no matter how huge the module, it will consume no additional microcontroller SRAM (crass compression). There is a catch though: Metatables are not generated with -eluac . To access any value from eLua, one must directly call the wrapper function associated with that value.
- 28.2.1 Additional command line options
+28.2.1 Additional command line options
@@ -178,7 +179,7 @@
28.2.1 Additional command line options
- 28.2.2 Compiling and Linking and Interpreter
+28.2.2 Compiling and Linking and Interpreter
@@ -201,8 +202,8 @@
28.2.2 Compiling and Linking and Interpreter
return 0;
}
L=lua_open();
- luaopen_base(L); // load basic libs (eg. print)
- luaopen_example(L); // load the wrapped module
+ luaopen_base(L); // load basic libs (eg. print)
+ luaopen_example(L); // load the wrapped module
if (luaL_loadfile(L,argv[1])==0) // load and run the file
lua_pcall(L,0,0,0);
else
@@ -249,7 +250,7 @@ 28.2.2 Compiling and Linking and Interpreter
More information on building and configuring eLua can be found here: http://www.eluaproject.net/doc/v0.8/en_building.html
- 28.2.3 Compiling a dynamic module
+28.2.3 Compiling a dynamic module
@@ -317,7 +318,7 @@
28.2.3 Compiling a dynamic module
- 28.2.4 Using your module
+28.2.4 Using your module
@@ -335,19 +336,19 @@
28.2.4 Using your module
>
- 28.3 A tour of basic C/C++ wrapping
+28.3 A tour of basic C/C++ wrapping
By default, SWIG tries to build a very natural Lua interface to your C/C++ code. This section briefly covers the essential aspects of this wrapping.
- 28.3.1 Modules
+28.3.1 Modules
The SWIG module directive specifies the name of the Lua module. If you specify `module example', then everything is wrapped into a Lua table 'example' containing all the functions and variables. When choosing a module name, make sure you don't use the same name as a built-in Lua command or standard module name.
- 28.3.2 Functions
+28.3.2 Functions
@@ -388,7 +389,7 @@
28.3.2 Functions
24
- 28.3.3 Global variables
+28.3.3 Global variables
@@ -476,7 +477,7 @@
28.3.3 Global variables
In general, functions of the form "variable_get()" and "variable_set()" are automatically generated by SWIG for use with -eluac .
- 28.3.4 Constants and enums
+28.3.4 Constants and enums
@@ -511,7 +512,7 @@
28.3.4 Constants and enums
Hello World
- 28.3.4.1 Constants/enums and classes/structures
+28.3.4.1 Constants/enums and classes/structures
@@ -567,7 +568,7 @@
28.3.4.1 Constants/enums and classes/structures
It is worth mentioning, that example.Test.TEST1 and example.Test_TEST1 are different entities and changing one does not change the other.
Given the fact that these are constantes and they are not supposed to be changed, it is up to you to avoid such issues.
- 28.3.5 Pointers
+28.3.5 Pointers
@@ -605,7 +606,7 @@
28.3.5 Pointers
nil
- 28.3.6 Structures
+28.3.6 Structures
@@ -709,7 +710,7 @@
28.3.6 Structures
In general, functions of the form "new_struct()" , "struct_member_get()" , "struct_member_set()" and "free_struct()" are automatically generated by SWIG for each structure defined in C. (Please note: This doesn't apply for modules generated with the -elua option)
- 28.3.7 C++ classes
+28.3.7 C++ classes
@@ -784,7 +785,7 @@
28.3.7 C++ classes
However, if the -no-old-metatable-bindings option is used, then the backward compatible names are not generated in addition to ordinary ones.
- 28.3.8 C++ inheritance
+28.3.8 C++ inheritance
@@ -809,7 +810,7 @@
28.3.8 C++ inheritance
It is safe to use multiple inheritance with SWIG.
- 28.3.9 Pointers, references, values, and arrays
+28.3.9 Pointers, references, values, and arrays
@@ -840,7 +841,7 @@
28.3.9 Pointers, references, values, and arrays
then all three functions will return a pointer to some Foo object. Since the third function (spam7) returns a value, newly allocated memory is used to hold the result and a pointer is returned (Lua will release this memory when the return value is garbage collected). The other two are pointers which are assumed to be managed by the C code and so will not be garbage collected.
- 28.3.10 C++ overloaded functions
+28.3.10 C++ overloaded functions
@@ -891,7 +892,7 @@
28.3.10 C++ overloaded functions
or
-VOID FOO(bAR *B);
+void foo(Bar *b);
void foo(Bar &b);
@@ -926,7 +927,7 @@
28.3.10 C++ overloaded functions
Dealing with the Lua coercion mechanism, the priority is roughly (integers, floats, strings, userdata). But it is better to rename the functions rather than rely upon the ordering.
- 28.3.11 C++ operators
+28.3.11 C++ operators
@@ -1060,7 +1061,7 @@
28.3.11 C++ operators
No other lua metafunction is inherited. For example, __gc is not inherited and must be redefined in every class. __tostring is subject to a special handling. If absent in class and in class bases, a default one will be provided by SWIG.
- 28.3.12 Class extension with %extend
+28.3.12 Class extension with %extend
@@ -1116,7 +1117,7 @@
28.3.12 Class extension with %extend
Extend works with both C and C++ code, on classes and structs. It does not modify the underlying object in any way---the extensions only show up in the Lua interface. The only item to take note of is the code has to use the '$self' instead of 'this', and that you cannot access protected/private members of the code (as you are not officially part of the class).
- 28.3.13 Using %newobject to release memory
+28.3.13 Using %newobject to release memory
If you have a function that allocates memory like this,
@@ -1140,7 +1141,7 @@ 28.3.13 Using %newobject to release memory
This will release the allocated memory.
- 28.3.14 C++ templates
+28.3.14 C++ templates
@@ -1175,7 +1176,7 @@
28.3.14 C++ templates
Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter. Some more complicated examples will appear later.
- 28.3.15 C++ Smart Pointers
+28.3.15 C++ Smart Pointers
@@ -1227,7 +1228,7 @@
28.3.15 C++ Smart Pointers
> f = p:__deref__() -- Returns underlying Foo *
- 28.3.16 C++ Exceptions
+28.3.16 C++ Exceptions
@@ -1370,7 +1371,7 @@
28.3.16 C++ Exceptions
add exception specification to functions or globally (respectively).
- 28.3.17 Namespaces
+28.3.17 Namespaces
@@ -1421,7 +1422,7 @@
28.3.17 Namespaces
19
>
- 28.3.17.1 Compatibility Note
+28.3.17.1 Compatibility Note
@@ -1437,7 +1438,7 @@
28.3.17.1 Compatibility Note
- 28.3.17.2 Names
+28.3.17.2 Names
If SWIG is launched without -no-old-metatable-bindings option, then it enters backward-compatible mode. While in this mode, it tries
@@ -1481,7 +1482,7 @@
28.3.17.2 Names
>
- 28.3.17.3 Inheritance
+28.3.17.3 Inheritance
The internal organization of inheritance has changed.
@@ -1522,12 +1523,12 @@
28.3.17.3 Inheritance
>
- 28.4 Typemaps
+28.4 Typemaps
This section explains what typemaps are and how to use them. The default wrapping behaviour of SWIG is enough in most cases. However sometimes SWIG may need a little additional assistance to know which typemap to apply to provide the best wrapping. This section will be explaining how to use typemaps to best effect
- 28.4.1 What is a typemap?
+28.4.1 What is a typemap?
A typemap is nothing more than a code generation rule that is attached to a specific C datatype. For example, to convert integers from Lua to C, you might define a typemap like this:
@@ -1535,8 +1536,8 @@ 28.4.1 What is a typemap?
%module example
%typemap(in) int {
- $1 = (int) lua_tonumber(L,$input);
- printf("Received an integer : %d\n",$1);
+ $1 = (int) lua_tonumber(L,$input);
+ printf("Received an integer : %d\n",$1);
}
%inline %{
extern int fact(int n);
@@ -1555,7 +1556,7 @@ 28.4.1 What is a typemap?
720
- 28.4.2 Using typemaps
+28.4.2 Using typemaps
There are many ready written typemaps built into SWIG for all common types (int, float, short, long, char*, enum and more), which SWIG uses automatically, with no effort required on your part.
@@ -1608,7 +1609,7 @@ 28.4.2 Using typemaps
Note: C++ references must be handled exactly the same way. However SWIG will automatically wrap a const int& as an input parameter (since that it obviously input).
- 28.4.3 Typemaps and arrays
+28.4.3 Typemaps and arrays
Arrays present a challenge for SWIG, because like pointers SWIG does not know whether these are input or output values, nor
@@ -1672,7 +1673,7 @@
28.4.3 Typemaps and arrays
Note: SWIG also can support arrays of pointers in a similar manner.
- 28.4.4 Typemaps and pointer-pointer functions
+28.4.4 Typemaps and pointer-pointer functions
Several C++ libraries use a pointer-pointer functions to create its objects. These functions require a pointer to a pointer which is then filled with the pointer to the new object. Microsoft's COM and DirectX as well as many other libraries have this kind of function. An example is given below:
@@ -1706,7 +1707,7 @@ 28.4.4 Typemaps and pointer-poi
ptr=nil -- the iMath* will be GC'ed as normal
- 28.5 Writing typemaps
+28.5 Writing typemaps
This section describes how you can modify SWIG's default wrapping behavior for various C/C++ datatypes using the %typemap directive. This is an advanced topic that assumes familiarity with the Lua C API as well as the material in the "Typemaps " chapter.
@@ -1715,7 +1716,7 @@ 28.5 Writing typemaps
Before proceeding, you should read the previous section on using typemaps, and look at the existing typemaps found in luatypemaps.swg and typemaps.i. These are both well documented and fairly easy to read. You should not attempt to write your own typemaps until you have read and can understand both of these files (they may well also give you an idea to base your work on).
- 28.5.1 Typemaps you can write
+28.5.1 Typemaps you can write
There are many different types of typemap that can be written, the full list can be found in the "Typemaps " chapter. However the following are the most commonly used ones.
@@ -1728,7 +1729,7 @@ 28.5.1 Typemaps you can write
(the syntax for the typecheck is different from the typemap, see typemaps for details).
- 28.5.2 SWIG's Lua-C API
+28.5.2 SWIG's Lua-C API
This section explains the SWIG specific Lua-C API. It does not cover the main Lua-C api, as this is well documented and not worth covering.
@@ -1777,7 +1778,7 @@ 28.5.2 SWIG's Lua-C API
Similar to SWIG_fail_arg, except that it will display the swig_type_info information instead.
- 28.6 Customization of your Bindings
+28.6 Customization of your Bindings
@@ -1786,7 +1787,7 @@
28.6 Customization of your Bindings
- 28.6.1 Writing your own custom wrappers
+28.6.1 Writing your own custom wrappers
@@ -1805,7 +1806,7 @@
28.6.1 Writing your own custom wrappers
The %native directive in the above example, tells SWIG that there is a function int native_function(lua_State*L); which is to be added into the module under the name 'my_func '. SWIG will not add any wrapper for this function, beyond adding it into the function table. How you write your code is entirely up to you.
- 28.6.2 Adding additional Lua code
+28.6.2 Adding additional Lua code
@@ -1843,7 +1844,7 @@
28.6.2 Adding additional Lua code
See Examples/lua/arrays for an example of this code.
- 28.7 Details on the Lua binding
+28.7 Details on the Lua binding
@@ -1854,7 +1855,7 @@
28.7 Details on the Lua binding
- 28.7.1 Binding global data into the module.
+28.7.1 Binding global data into the module.
@@ -1914,7 +1915,7 @@
28.7.1 Binding global data into the module.
That way when you call 'a=example.Foo ', the interpreter looks at the table 'example' sees that there is no field 'Foo' and calls __index. This will in turn check in '.get' table and find the existence of 'Foo' and then return the value of the C function call 'Foo_get()'. Similarly for the code 'example.Foo=10 ', the interpreter will check the table, then call the __newindex which will then check the '.set' table and call the C function 'Foo_set(10)'.
- 28.7.2 Userdata and Metatables
+28.7.2 Userdata and Metatables
@@ -1994,7 +1995,7 @@
28.7.2 Userdata and Metatables
Note: Operator overloads are basically done in the same way, by adding functions such as '__add' & '__call' to the class' metatable. The current implementation is a bit rough as it will add any member function beginning with '__' into the metatable too, assuming its an operator overload.
- 28.7.3 Memory management
+28.7.3 Memory management
diff --git a/Doc/Manual/Makefile b/Doc/Manual/Makefile
index 5112afa3318..c7769dc9763 100644
--- a/Doc/Manual/Makefile
+++ b/Doc/Manual/Makefile
@@ -9,7 +9,7 @@
# validation.
#
# Additional html validation can be done using the validate target.
-# Additional link checking can be done using the linkchecker target.
+# Additional link checking can be done using the linkchecker1 and linkchecker2 target.
#
# Note the # and " are escaped
@@ -19,31 +19,34 @@ HTMLDOC_OPTIONS = "--book --toclevels 4 --no-numbered --toctitle \"Table of Cont
all: maketoc check generate
-maketoc: CCache.html
+maketoc:
python maketoc.py
+# Use this to regenerate CCache.html should this ever be needed
CCache.html: ../../CCache/ccache.yo
yodl2html -o CCache.html ../../CCache/ccache.yo
+# Tabs in the html files will stop the build as wkhtmltopdf does not expand them correctly - replace them with the appropriate number of tabs
# Use htmltidy to warn about some HTML errors. Note that it is not used to clean/tidy the HTML,
# it is just used as a primitive HTML checker.
# CCache.html is generated by yodl2html and has a few insignificant problems, so we don't put it through tidy
check:
- tidy -errors --gnu-emacs yes -quiet index.html
- tidy -errors --gnu-emacs yes -quiet Sections.html
- all=`sed '/^#/d' chapters | grep -v CCache.html`; for a in $$all; do tidy -errors --gnu-emacs yes -quiet $$a; done;
+ all="index.html Sections.html `sed '/^#/d' chapters | grep -v CCache.html`" && for a in $$all; do echo "Check for tabs $$a" && if grep -P '\t' $$a; then echo "Please delete the tabs from the lines above" && exit 1; fi; done && for a in $$all; do echo "HTML tidy check $$a" && tidy -errors --gnu-emacs yes -quiet $$a; done;
-generate: swightml.book swigpdf.book
+# Note wkhtmltopdf limitations for generating pdf docs:
+# 1)
Text style links don't work and need changing to
+# Text
+# 2) Tabs in elements should be expanded to 8 spaces by default, but
+# are expanded to just one space and css tab-size is not working.
+# 3) elements do not always select a fixed-width font - try installing the
+# Courier font to fix - these have been added to style.css.
+generate: SWIGDocumentation.html
+ wkhtmltopdf --margin-top 20mm --margin-bottom 20mm --margin-left 10mm --margin-right 10mm --header-font-size 6 --footer-font-size 6 --header-spacing 6 --footer-spacing 6 --header-center '[doctitle]' --footer-left '[subsection]' --footer-right '[page]' SWIGDocumentation.html SWIGDocumentation.pdf
+
+SWIGDocumentation.html: swightml.book
htmldoc --batch swightml.book || true
- htmldoc --batch swigpdf.book || true
python fixstyle.py SWIGDocumentation.html
-swigpdf.book: chapters Sections.html
- echo "#HTMLDOC 1.8.24" > swigpdf.book
- echo -t pdf13 -f SWIGDocumentation.pdf $(HTMLDOC_OPTIONS) --stylesheet style.css >> swigpdf.book
- echo "Sections.html" >> swigpdf.book
- cat chapters >> swigpdf.book
-
swightml.book: chapters Sections.html
echo "#HTMLDOC 1.8.24" > swightml.book
echo -t html -f SWIGDocumentation.html $(HTMLDOC_OPTIONS) >> swightml.book
@@ -52,10 +55,9 @@ swightml.book: chapters Sections.html
maintainer-clean: clean-baks
rm -f swightml.book
- rm -f swigpdf.book
- rm -f CCache.html
rm -f SWIGDocumentation.html
rm -f SWIGDocumentation.pdf
+ rm -rf linkchecker-tmp
clean-baks:
rm -f *.bak
@@ -69,9 +71,18 @@ test:
validate:
all=`sed '/^#/d' chapters`; for a in $$all; do validate --emacs $$a; done;
-# Link checking using linkchecker
-linkchecker:
+# Link checking using linkchecker of the index.html only file (including anchors)
+linkchecker1:
@echo -----------------------------------------------------------------------
@echo Note linkchecker versions prior to 6.1 do not work properly wrt anchors
@echo -----------------------------------------------------------------------
- linkchecker --config=./linkchecker.config index.html
+ linkchecker --config=./linkchecker.config --anchors index.html
+
+# Check for links which don't work including those generated from the individual .html files into SWIGDocumentation.html
+linkchecker2:
+ rm -rf linkchecker-tmp
+ mkdir linkchecker-tmp
+ cp SWIGDocumentation.html linkchecker-tmp
+ cp *.png linkchecker-tmp
+ (cd linkchecker-tmp && linkchecker --config=../linkchecker.config -F text --no-warnings SWIGDocumentation.html)
+
diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html
index ffbf6132dc4..f324495a39b 100644
--- a/Doc/Manual/Modula3.html
+++ b/Doc/Manual/Modula3.html
@@ -1,11 +1,12 @@
-
+
SWIG and Modula-3
+
- 29 SWIG and Modula-3
+29 SWIG and Modula-3
@@ -54,7 +55,7 @@ 29 SWIG and Modula-3
typemaps .
- 29.1 Overview
+29.1 Overview
@@ -84,7 +85,7 @@
29.1 Overview
- 29.1.1 Motivation
+29.1.1 Motivation
@@ -131,10 +132,10 @@
29.1.1 Motivation
a C/C++ project.
- 29.2 Conception
+29.2 Conception
- 29.2.1 Interfaces to C libraries
+29.2.1 Interfaces to C libraries
@@ -283,7 +284,7 @@
29.2.1 Interfaces to C libraries
- 29.2.2 Interfaces to C++ libraries
+29.2.2 Interfaces to C++ libraries
@@ -384,10 +385,10 @@
29.2.2 Interfaces to C++ libraries
so I'm not sure if this is possible or sensible, yet.
- 29.3 Preliminaries
+29.3 Preliminaries
- 29.3.1 Compilers
+29.3.1 Compilers
@@ -400,7 +401,7 @@
29.3.1 Compilers
- 29.3.2 Additional Commandline Options
+29.3.2 Additional Commandline Options
@@ -477,10 +478,10 @@
29.3.2 Additional Commandline Options
- 29.4 Modula-3 typemaps
+29.4 Modula-3 typemaps
- 29.4.1 Inputs and outputs
+29.4.1 Inputs and outputs
@@ -694,7 +695,7 @@
29.4.1 Inputs and outputs
- 29.4.2 Subranges, Enumerations, Sets
+29.4.2 Subranges, Enumerations, Sets
@@ -746,7 +747,7 @@
29.4.2 Subranges, Enumerations, Sets
- 29.4.3 Objects
+29.4.3 Objects
@@ -759,7 +760,7 @@
29.4.3 Objects
- 29.4.4 Imports
+29.4.4 Imports
@@ -792,7 +793,7 @@
29.4.4 Imports
- 29.4.5 Exceptions
+29.4.5 Exceptions
@@ -816,7 +817,7 @@
29.4.5 Exceptions
%typemap("m3wrapinconv:throws") blah * %{OSError.E%} .
- 29.4.6 Example
+29.4.6 Example
@@ -863,10 +864,10 @@
29.4.6 Example
- 29.5 More hints to the generator
+29.5 More hints to the generator
- 29.5.1 Features
+29.5.1 Features
@@ -903,7 +904,7 @@ 29.5.1 Features
- 29.5.2 Pragmas
+29.5.2 Pragmas
@@ -926,7 +927,7 @@ 29.5.2 Pragmas
- 29.6 Remarks
+29.6 Remarks
diff --git a/Doc/Manual/Modules.html b/Doc/Manual/Modules.html
index 551fd075040..089b1a4adf9 100644
--- a/Doc/Manual/Modules.html
+++ b/Doc/Manual/Modules.html
@@ -1,12 +1,13 @@
-
+
Working with Modules
+
- 16 Working with Modules
+16 Working with Modules
@@ -23,7 +24,7 @@ 16 Working with Modules
- 16.1 Modules Introduction
+16.1 Modules Introduction
@@ -77,7 +78,7 @@
16.1 Modules Introduction
Each module in the collection is created via separate invocations of SWIG.
- 16.2 Basics
+16.2 Basics
@@ -176,7 +177,7 @@
16.2 Basics
issue, read on.
- 16.3 The SWIG runtime code
+16.3 The SWIG runtime code
@@ -242,7 +243,7 @@
16.3 The SWIG runtime code
is empty. Only modules compiled with the same pair will share type information.
- 16.4 External access to the runtime
+16.4 External access to the runtime
As described in The run-time type checker ,
@@ -250,7 +251,9 @@
16.4 External access to the runtime<
to be called. Calling these functions from a typemap is supported, since the typemap code
is embedded into the _wrap.c file, which has those declarations available. If you need
to call the SWIG run-time functions from another C file, there is one header you need
-to include. To generate the header that needs to be included, run the following command:
+to include. To generate the header that needs to be included, SWIG can be run in a different
+mode via -external-runtime to generate the run-time instead of the normal mode of
+processing an input interface file. For example:
$ swig -python -external-runtime <filename>
@@ -279,7 +282,7 @@ 16.4 External access to the runtime<
access.
- 16.5 A word of caution about static libraries
+16.5 A word of caution about static libraries
@@ -290,7 +293,7 @@
16.5 A word of caution about static libraries
behavior. When working with dynamically loadable modules, you should try to work exclusively with shared libraries.
- 16.6 References
+16.6 References
@@ -298,7 +301,7 @@
16.6 References
an outside reference. John Levine's "Linkers and Loaders" is highly recommended.
- 16.7 Reducing the wrapper file size
+16.7 Reducing the wrapper file size
diff --git a/Doc/Manual/Mzscheme.html b/Doc/Manual/Mzscheme.html
index fadda5fc989..c5c199262ea 100644
--- a/Doc/Manual/Mzscheme.html
+++ b/Doc/Manual/Mzscheme.html
@@ -1,14 +1,14 @@
-
-
+
SWIG and MzScheme/Racket
+
- 30 SWIG and MzScheme/Racket
+30 SWIG and MzScheme/Racket
@@ -24,7 +24,7 @@ 30 SWIG and MzScheme/Racket
This section contains information on SWIG's support of Racket, formally known as MzScheme.
-
30.1 Creating native structures
+30.1 Creating native structures
@@ -56,16 +56,16 @@
30.1 Creating native structures
- ; suppose a function created a struct foo as
- ; (define foo (make-diag-cntrs (#x1 #x2 #x3) (make-inspector))
- ; Then you can do
- (format "0x~x" (diag-cntrs-field1 foo))
- (format "0x~x" (diag-cntrs-field2 foo))
- ;etc...
+ ; suppose a function created a struct foo as
+ ; (define foo (make-diag-cntrs (#x1 #x2 #x3) (make-inspector))
+ ; Then you can do
+ (format "0x~x" (diag-cntrs-field1 foo))
+ (format "0x~x" (diag-cntrs-field2 foo))
+ ;etc...
- 30.2 Simple example
+30.2 Simple example
@@ -166,7 +166,7 @@
30.2 Simple example
The above requests mzc to create an extension using the CGC garbage-collector. The alternative -- the 3m collector -- has generally better performance, but work is still required for SWIG to emit code which is compatible with it.
-
30.3 External documentation
+
30.3 External documentation
diff --git a/Doc/Manual/Ocaml.html b/Doc/Manual/Ocaml.html
index aa6679f9aa6..e489c41470d 100644
--- a/Doc/Manual/Ocaml.html
+++ b/Doc/Manual/Ocaml.html
@@ -1,12 +1,13 @@
-
+
-
SWIG and Ocaml
+
SWIG and Ocaml
+
-
-
-
31 SWIG and Ocaml
+
+
+
31 SWIG and Ocaml
Exceptions
@@ -59,74 +60,76 @@ 31 SWIG and Ocaml
- This chapter describes SWIG's
-support of Ocaml. Ocaml is a relatively recent addition to the ML family,
-and is a recent addition to SWIG. It's the second compiled, typed
-language to be added. Ocaml has widely acknowledged benefits for engineers,
-mostly derived from a sophisticated type system, compile-time checking
-which eliminates several classes of common programming errors, and good
-native performance. While all of this is wonderful, there are well-written
-C and C++ libraries that Ocaml users will want to take advantage of as
-part of their arsenal (such as SSL and gdbm), as well as their own mature
-C and C++ code. SWIG allows this code to be used in a natural, type-safe
-way with Ocaml, by providing the necessary, but repetitive glue code
-which creates and uses Ocaml values to communicate with C and C++ code.
- In addition, SWIG also produces the needed Ocaml source that binds
-variants, functions, classes, etc.
+This chapter describes SWIG's support of Ocaml.
+
+
+
+Ocaml is a relatively recent addition to the ML family,
+and is a recent addition to SWIG. It's the second compiled, typed
+language to be added. Ocaml has widely acknowledged benefits for engineers,
+mostly derived from a sophisticated type system, compile-time checking
+which eliminates several classes of common programming errors, and good
+native performance. While all of this is wonderful, there are well-written
+C and C++ libraries that Ocaml users will want to take advantage of as
+part of their arsenal (such as SSL and gdbm), as well as their own mature
+C and C++ code. SWIG allows this code to be used in a natural, type-safe
+way with Ocaml, by providing the necessary, but repetitive glue code
+which creates and uses Ocaml values to communicate with C and C++ code.
+In addition, SWIG also produces the needed Ocaml source that binds
+variants, functions, classes, etc.
If you're not familiar with the Objective Caml language, you can visit
-The Ocaml Website .
+The Ocaml Website .
- 31.1 Preliminaries
+31.1 Preliminaries
- SWIG 1.3 works with Ocaml 3.04 and above. Given the choice,
- you should use the latest stable release. The SWIG Ocaml module has
-been tested on Linux (x86,PPC,Sparc) and Cygwin on Windows. The
-best way to determine whether your system will work is to compile the
-examples and test-suite which come with SWIG. You can do this by running
-make check from the SWIG root directory after installing SWIG.
- The Ocaml module has been tested using the system's dynamic linking (the
-usual -lxxx against libxxx.so, as well as with Gerd Stolpmann's
-Dl package
- . The ocaml_dynamic and ocaml_dynamic_cpp targets in the
+SWIG 3.0 works with Ocaml 3.08.3 and above. Given the choice,
+you should use the latest stable release. The SWIG Ocaml module has
+been tested on Linux (x86,PPC,Sparc) and Cygwin on Windows. The
+best way to determine whether your system will work is to compile the
+examples and test-suite which come with SWIG. You can do this by running
+make check from the SWIG root directory after installing SWIG.
+The Ocaml module has been tested using the system's dynamic linking (the
+usual -lxxx against libxxx.so, as well as with Gerd Stolpmann's
+Dl package .
+The ocaml_dynamic and ocaml_dynamic_cpp targets in the
file Examples/Makefile illustrate how to compile and link SWIG modules that
will be loaded dynamically. This has only been tested on Linux so far.
- 31.1.1 Running SWIG
+31.1.1 Running SWIG
- The basics of getting a SWIG Ocaml module up and running
- can be seen from one of SWIG's example Makefiles, but is also described
- here. To build an Ocaml module, run SWIG using the -ocaml
-option.
+The basics of getting a SWIG Ocaml module up and running
+can be seen from one of SWIG's example Makefiles, but is also described
+here. To build an Ocaml module, run SWIG using the -ocaml
+option.
-
-
+
+
%swig -ocaml example.i
-
+
-
- This will produce 3 files. The file example_wrap.c contains
+
+
This will produce 3 files. The file example_wrap.c contains
all of the C code needed to build an Ocaml module. To build the module,
-you will compile the file example_wrap.c with ocamlc or
+you will compile the file example_wrap.c with ocamlc or
ocamlopt to create the needed .o file. You will need to compile
the resulting .ml and .mli files as well, and do the final link with -custom
-(not needed for native link).
-
- 31.1.2 Compiling the code
+(not needed for native link).
+
+31.1.2 Compiling the code
-The OCaml SWIG module now requires you to compile a module (Swig )
+The OCaml SWIG module now requires you to compile a module (Swig )
separately. In addition to aggregating common SWIG functionality, the Swig
module contains the data structure that represents C/C++ values. This allows
easier data sharing between modules if two or more are combined, because
@@ -134,39 +137,40 @@
31.1.2 Compiling the code
also allows SWIG to acquire new conversions painlessly, as well as giving
the user more freedom with respect to custom typing.
- Use ocamlc or ocamlopt to compile your
- SWIG interface like:
+Use ocamlc or ocamlopt to compile your SWIG interface like:
-
-
-
+
+
+
% swig -ocaml -co swig.mli ; swig -ocaml co swig.ml
% ocamlc -c swig.mli ; ocamlc -c swig.ml
% ocamlc -c -ccopt "-I/usr/include/foo" example_wrap.c
% ocamlc -c example.mli
% ocamlc -c example.ml
-
+
-
- ocamlc is aware of .c files and knows how to handle them. Unfortunately,
- it does not know about .cxx, .cc, or .cpp files, so when SWIG is invoked
- in C++ mode, you must:
-
-
-
-% cp example_wrap.cxx example_wrap.cxx.c % ocamlc -c ... -ccopt -xc++ example_wrap.cxx.c % ...
-
+
+
ocamlc is aware of .c files and knows how to handle them. Unfortunately,
+it does not know about .cxx, .cc, or .cpp files, so when SWIG is invoked
+in C++ mode, you must:
+
+
+
+% cp example_wrap.cxx example_wrap.cxx.c
+% ocamlc -c ... -ccopt -xc++ example_wrap.cxx.c
+% ...
+
-
31.1.3 The camlp4 module
+
31.1.3 The camlp4 module
The camlp4 module (swigp4.ml -> swigp4.cmo) contains a simple rewriter which
makes C++ code blend more seamlessly with objective caml code. Its use is
optional, but encouraged. The source file is included in the Lib/ocaml
-directory of the SWIG source distribution. You can checkout this file with
-"swig -ocaml -co swigp4.ml" . You should compile the file with
+directory of the SWIG source distribution. You can checkout this file with
+"swig -ocaml -co swigp4.ml" . You should compile the file with
"ocamlc -I `camlp4 -where` -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -c swigp4.ml"
@@ -192,7 +196,7 @@
31.1.3 The camlp4 module
(invoke object) "+=" argument as in
(invoke a) "+=" b
- Note that because camlp4 always recognizes <<
+ Note that because camlp4 always recognizes <<
and >>, they are replaced by lsl and lsr in operator names.
'unop object as in
@@ -234,21 +238,21 @@ 31.1.3 The camlp4 module
-
31.1.4 Using your module
+
31.1.4 Using your module
You can test-drive your module by building a
toplevel ocaml interpreter. Consult the ocaml manual for details.
-
+
When linking any ocaml bytecode with your module, use the -custom
- option to build your functions into the primitive list. This
- option is not needed when you build native code.
+option to build your functions into the primitive list. This
+option is not needed when you build native code.
-
31.1.5 Compilation problems and compiling with C++
+
31.1.5 Compilation problems and compiling with C++
@@ -259,7 +263,7 @@
31.1.5 Compilation problems and compiling with C++
Most code meant to be compiled as C++ will not have problems.
- 31.2 The low-level Ocaml/C interface
+31.2 The low-level Ocaml/C interface
@@ -273,9 +277,9 @@
31.2 The low-level Ocaml/C interface
writer, there is a value, swig_result, that always contains the
current return data. It is a list, and must be appended with the
caml_list_append function, or with functions and macros provided by
-objective caml.
+objective caml.
-
+
type c_obj =
C_void
@@ -299,68 +303,67 @@ 31.2 The low-level Ocaml/C interface
- A few functions exist which generate and return these:
+A few functions exist which generate and return these:
-
+
- caml_ptr_val receives a c_obj and returns a void *. This
- should be used for all pointer purposes.
- caml_long_val receives a c_obj and returns a long. This
- should be used for most integral purposes.
-
- caml_val_ptr receives a void * and returns a c_obj.
- caml_val_bool receives a C int and returns a c_obj representing
- its bool value.
- caml_val_(u)?(char|short|int|long|float|double) receives an
-appropriate C value and returns a c_obj representing it.
- caml_val_string receives a char * and returns a string value.
- caml_val_string_len receives a char * and a length and returns
- a string value.
- caml_val_obj receives a void * and an object type and returns
- a C_obj, which contains a closure giving method access.
-
+ caml_ptr_val receives a c_obj and returns a void *. This
+ should be used for all pointer purposes.
+ caml_long_val receives a c_obj and returns a long. This
+ should be used for most integral purposes.
+ caml_val_ptr receives a void * and returns a c_obj.
+ caml_val_bool receives a C int and returns a c_obj representing
+ its bool value.
+ caml_val_(u)?(char|short|int|long|float|double) receives an
+ appropriate C value and returns a c_obj representing it.
+ caml_val_string receives a char * and returns a string value.
+ caml_val_string_len receives a char * and a length and returns
+ a string value.
+ caml_val_obj receives a void * and an object type and returns
+ a C_obj, which contains a closure giving method access.
Because of this style, a typemap can return any kind of value it
-wants from a function. This enables out typemaps and inout typemaps
-to work well. The one thing to remember about outputting values
-is that you must append them to the return list with swig_result = caml_list_append(swig_result,v).
-
-
-
- This function will return a new list that has your element
- appended. Upon return to caml space, the fnhelper function
- beautifies the result. A list containing a single item degrades to
- only that item (i.e. [ C_int 3 ] -> C_int 3), and a list
- containing more than one item is wrapped in C_list (i.e. [ C_char
- 'a' ; C_char 'b' -> C_list [ C_char 'a' ; C_char b
- ]). This is in order to make return values easier to handle
- when functions have only one return value, such as constructors,
- and operators. In addition, string, pointer, and object
- values are interchangeable with respect to caml_ptr_val, so you can
- allocate memory as caml strings and still use the resulting
- pointers for C purposes, even using them to construct simple objects
- on. Note, though, that foreign C++ code does not respect the garbage
- collector, although the SWIG interface does.
-
-
- The wild card type that you can use in lots of different ways is
- C_obj. It allows you to wrap any type of thing you like as an
- object using the same mechanism that the ocaml module
- does. When evaluated in caml_ptr_val, the returned value is
- the result of a call to the object's "&" operator, taken as a pointer.
-
-
- You should only construct values using objective caml, or using the
- functions caml_val_* functions provided as static functions to a SWIG
- ocaml module, as well as the caml_list_* functions. These functions
- provide everything a typemap needs to produce values. In addition,
- value items pass through directly, but you must make your own type
- signature for a function that uses value in this way.
-
-
-
31.2.1 The generated module
+wants from a function. This enables out typemaps and inout typemaps
+to work well. The one thing to remember about outputting values
+is that you must append them to the return list with swig_result = caml_list_append(swig_result,v).
+
+
+
+This function will return a new list that has your element
+appended. Upon return to caml space, the fnhelper function
+beautifies the result. A list containing a single item degrades to
+only that item (i.e. [ C_int 3 ] -> C_int 3), and a list
+containing more than one item is wrapped in C_list (i.e. [ C_char
+'a' ; C_char 'b' -> C_list [ C_char 'a' ; C_char b
+]). This is in order to make return values easier to handle
+when functions have only one return value, such as constructors,
+and operators. In addition, string, pointer, and object
+values are interchangeable with respect to caml_ptr_val, so you can
+allocate memory as caml strings and still use the resulting
+pointers for C purposes, even using them to construct simple objects
+on. Note, though, that foreign C++ code does not respect the garbage
+collector, although the SWIG interface does.
+
+
+The wild card type that you can use in lots of different ways is
+C_obj. It allows you to wrap any type of thing you like as an
+object using the same mechanism that the ocaml module
+does. When evaluated in caml_ptr_val, the returned value is
+the result of a call to the object's "&" operator, taken as a pointer.
+
+
+
+You should only construct values using objective caml, or using the
+functions caml_val_* functions provided as static functions to a SWIG
+ocaml module, as well as the caml_list_* functions. These functions
+provide everything a typemap needs to produce values. In addition,
+value items pass through directly, but you must make your own type
+signature for a function that uses value in this way.
+
+
+
31.2.1 The generated module
@@ -376,7 +379,7 @@
31.2.1 The generated module
You can introduce extra code into the output wherever you like with SWIG.
These are the places you can introduce code:
-"header" This code is inserted near the beginning of the
+ "header" This code is inserted near the beginning of the
C wrapper file, before any function definitions.
"wrapper" This code is inserted in the function definition
section.
@@ -385,25 +388,25 @@ 31.2.1 The generated module
"mli" This code is inserted into the caml interface file.
Special signatures should be inserted here.
-"ml" This code is inserted in the caml code defining the
+ "ml" This code is inserted in the caml code defining the
interface to your C code. Special caml code, as well as any initialization
which should run when the module is loaded may be inserted here.
-
+
"classtemplate" The "classtemplate" place is special because
it describes the output SWIG will generate for class definitions.
-
-
31.2.2 Enums
+
+
31.2.2 Enums
SWIG will wrap enumerations as polymorphic variants in the output
-Ocaml code, as above in C_enum. In order to support all
+Ocaml code, as above in C_enum. In order to support all
C++-style uses of enums, the function int_to_enum and enum_to_int are
provided for ocaml code to produce and consume these values as
-integers. Other than that, correct uses of enums will not have
-a problem. Since enum labels may overlap between enums, the
+integers. Other than that, correct uses of enums will not have
+a problem. Since enum labels may overlap between enums, the
enum_to_int and int_to_enum functions take an enum type label as an
argument. Example:
@@ -416,9 +419,9 @@
31.2.2 Enums
enum c_enum_type { a = 1, b, c = 4, d = 8 };
-
+
The output mli contains:
-
+
type c_enum_type = [
@@ -435,16 +438,16 @@ 31.2.2 Enums
val int_to_enum c_enum_type -> int -> c_obj
val enum_to_int c_enum_type -> c_obj -> c_obj
-
+
- So it's possible to do this:
+So it's possible to do this:
-
-
+
+
bash-2.05a$ ocamlmktop -custom enum_test_wrap.o enum_test.cmo -o enum_test_top
-bash-2.05a$ ./enum_test_top
+bash-2.05a$ ./enum_test_top
Objective Caml version 3.04
# open Enum_test ;;
@@ -455,9 +458,9 @@ 31.2.2 Enums
# int_to_enum `c_enum_type 4 ;;
- : Enum_test.c_obj = C_enum `c
-
+
- 31.2.2.1 Enum typing in Ocaml
+31.2.2.1 Enum typing in Ocaml
@@ -470,10 +473,10 @@
31.2.2.1 Enum typing in Ocaml
values using the swig_val function before sharing them with another module.
- 31.2.3 Arrays
+31.2.3 Arrays
- 31.2.3.1 Simple types of bounded arrays
+31.2.3.1 Simple types of bounded arrays
@@ -485,7 +488,7 @@
31.2.3.1 Simple types of bounded arrays
By including "carray.i", you will get access to some macros that help you
-create typemaps for array types fairly easily.
+create typemaps for array types fairly easily.
@@ -494,7 +497,7 @@
31.2.3.1 Simple types of bounded arrays
for arrays whose bounds are completely specified.
- 31.2.3.2 Complex and unbounded arrays
+31.2.3.2 Complex and unbounded arrays
@@ -507,7 +510,7 @@
31.2.3.2 Complex and unbounded arrays
so you have to specify it for yourself in the form of a typemap.
- 31.2.3.3 Using an object
+31.2.3.3 Using an object
@@ -521,7 +524,7 @@
31.2.3.3 Using an object
such as using a required sentinel, etc.
- 31.2.3.4 Example typemap for a function taking float * and int
+31.2.3.4 Example typemap for a function taking float * and int
@@ -541,24 +544,24 @@
31.2.3.4 Example typemap for a function taking floa
#include <stdio.h>
void printfloats( float *tab, int len ) {
- int i;
+ int i;
- for( i = 0; i < len; i++ ) {
- printf( "%f ", tab[i] );
- }
+ for( i = 0; i < len; i++ ) {
+ printf( "%f ", tab[i] );
+ }
- printf( "\n" );
+ printf( "\n" );
}
%}
%typemap(in) (float *tab, int len) {
- int i;
- /* $*1_type */
- $2 = caml_array_len($input);
- $1 = ($*1_type *)malloc( $2 * sizeof( float ) );
- for( i = 0; i < $2; i++ ) {
- $1[i] = caml_double_val(caml_array_nth($input,i));
- }
+ int i;
+ /* $*1_type */
+ $2 = caml_array_len($input);
+ $1 = ($*1_type *)malloc( $2 * sizeof( float ) );
+ for( i = 0; i < $2; i++ ) {
+ $1[i] = caml_double_val(caml_array_nth($input,i));
+ }
}
void printfloats( float *tab, int len );
@@ -572,30 +575,30 @@ 31.2.3.4 Example typemap for a function taking floa
-
31.2.4 C++ Classes
+
31.2.4 C++ Classes
C++ classes, along with structs and unions are represented by C_obj
-(string -> c_obj -> c_obj) wrapped closures. These objects
+(string -> c_obj -> c_obj) wrapped closures. These objects
contain a method list, and a type, which allow them to be used like
C++ objects. When passed into typemaps that use pointers, they
-degrade to pointers through their "&" method. Every method
+degrade to pointers through their "&" method. Every method
an object has is represented as a string in the object's method table,
-and each method table exists in memory only once. In addition
+and each method table exists in memory only once. In addition
to any other operators an object might have, certain builtin ones are
-provided by SWIG: (all of these take no arguments (C_void))
+provided by SWIG: (all of these take no arguments (C_void))
"~" Delete this object
-"&" Return an ordinary C_ptr value representing this
+ "&" Return an ordinary C_ptr value representing this
object's address
"sizeof" If enabled with ("sizeof"="1") on the module node,
return the object's size in char.
":methods" Returns a list of strings containing the names of
the methods this object contains
-":classof" Returns the name of the class this object belongs
+ ":classof" Returns the name of the class this object belongs
to.
":parents" Returns a list of all direct parent classes which
have been wrapped by SWIG.
@@ -603,8 +606,8 @@ 31.2.4 C++ Classes
indicated parent class. This is mainly used internally by the SWIG module,
but may be useful to client programs.
"[member-variable]" Each member variable is wrapped as a
-method with an optional parameter.
-Called with one argument, the member variable is set to the value of the
+method with an optional parameter.
+Called with one argument, the member variable is set to the value of the
argument. With zero arguments, the value is returned.
@@ -615,7 +618,7 @@
31.2.4 C++ Classes
returned value for the same object.
-
31.2.4.1 STL vector and string Example
+
31.2.4.1 STL vector and string Example
@@ -637,7 +640,7 @@
31.2.4.1 STL vector and string Example
%include <stl.i>
namespace std {
- %template(StringVector) std::vector < string >;
+ %template(StringVector) std::vector < string >;
};
%include "example.h"
@@ -652,12 +655,12 @@
31.2.4.1 STL vector and string Example
Here's a sample transcript of an interactive session using a string vector
-after making a toplevel (make toplevel). This example uses the camlp4
+after making a toplevel (make toplevel). This example uses the camlp4
module.
-bash-2.05a$ ./example_top
+bash-2.05a$ ./example_top
Objective Caml version 3.06
Camlp4 Parsing version 3.06
@@ -685,17 +688,17 @@ 31.2.4.1 STL vector and string Example
- : Example.c_obj = C_void
# x '[1] ;;
- : Example.c_obj = C_string "spam"
-# for i = 0 to (x -> size() as int) - 1 do
- print_endline ((x '[i to int]) as string)
+# for i = 0 to (x -> size() as int) - 1 do
+ print_endline ((x '[i to int]) as string)
done ;;
foo
bar
baz
- : unit = ()
-#
+#
-
31.2.4.2 C++ Class Example
+
31.2.4.2 C++ Class Example
@@ -703,7 +706,7 @@
31.2.4.2 C++ Class Example
- qt.i
+qt.i
%module qt
%{
@@ -712,20 +715,20 @@ 31.2.4.2 C++ Class Example
%}
class QApplication {
public:
- QApplication( int argc, char **argv );
- void setMainWidget( QWidget *widget );
- void exec();
+ QApplication( int argc, char **argv );
+ void setMainWidget( QWidget *widget );
+ void exec();
};
class QPushButton {
public:
- QPushButton( char *str, QWidget *w );
- void resize( int x, int y );
- void show();
+ QPushButton( char *str, QWidget *w );
+ void resize( int x, int y );
+ void show();
};
-
31.2.4.3 Compiling the example
+
31.2.4.3 Compiling the example
@@ -733,9 +736,9 @@ 31.2.4.3 Compiling the example
bash-2.05a$ for file in swig.mli swig.ml swigp4.ml ; do swig -ocaml -co $file ; done
bash-2.05a$ ocamlc -c swig.mli ; ocamlc -c swig.ml
bash-2.05a$ ocamlc -I `camlp4 -where` -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
-bash-2.05a$ swig -ocaml -c++ -I$QTPATH/include qt.i
+bash-2.05a$ swig -ocaml -c++ -I$QTPATH/include qt.i
bash-2.05a$ mv qt_wrap.cxx qt_wrap.c
-bash-2.05a$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
+bash-2.05a$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
bash-2.05a$ ocamlc -c qt.mli
bash-2.05a$ ocamlc -c qt.ml
bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
@@ -743,11 +746,11 @@ 31.2.4.3 Compiling the example
-L$QTPATH/lib -cclib -lqt
-
31.2.4.4 Sample Session
+
31.2.4.4 Sample Session
-bash-2.05a$ ./qt_top
+bash-2.05a$ ./qt_top
Objective Caml version 3.06
Camlp4 Parsing version 3.06
@@ -767,13 +770,13 @@ 31.2.4.4 Sample Session
Assuming you have a working installation of QT, you will see a window
-containing the string "hi" in a button.
+containing the string "hi" in a button.
- 31.2.5 Director Classes
+31.2.5 Director Classes
- 31.2.5.1 Director Introduction
+31.2.5.1 Director Introduction
@@ -800,7 +803,7 @@
31.2.5.1 Director Introduction
};
-
31.2.5.2 Overriding Methods in Ocaml
+
31.2.5.2 Overriding Methods in Ocaml
@@ -828,7 +831,7 @@
31.2.5.2 Overriding Methods in Ocaml
an overloaded class. This example is contained in Examples/ocaml/shapes.
-
31.2.5.3 Director Usage Example
+
31.2.5.3 Director Usage Example
@@ -845,14 +848,14 @@ 31.2.5.3 Director Usage Example
"cover" ->
(match args with
C_list [ x_arg ; y_arg ] ->
- let xa = x_arg as float
- and ya = y_arg as float in
- (point_in_triangle pts xa ya) to bool
+ let xa = x_arg as float
+ and ya = y_arg as float in
+ (point_in_triangle pts xa ya) to bool
| _ -> raise (Failure "cover needs two double arguments."))
| _ -> (invoke ob) meth args ;;
let triangle =
- new_derived_object
+ new_derived_object
new_shape
(triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
'() ;;
@@ -887,7 +890,7 @@ 31.2.5.3 Director Usage Example
program in C++.
- 31.2.5.4 Creating director objects
+31.2.5.4 Creating director objects
@@ -896,7 +899,7 @@
31.2.5.4 Creating director objects
let triangle =
- new_derived_object
+ new_derived_object
new_shape
(triangle_class ((0.0,0.0),(0.5,1.0),(1.0,0.0)))
'()
@@ -904,13 +907,13 @@ 31.2.5.4 Creating director objects
The first argument to new_derived_object , new_shape is the method
-which returns a shape instance. This function will be invoked with the
+which returns a shape instance. This function will be invoked with the
third argument will be appended to the argument list [ C_void ]. In the
example, the actual argument list is sent as (C_list [ C_void ; C_void ]).
The augmented constructor for a director class needs the first argument
to determine whether it is being constructed as a derived object, or as
an object of the indicated type only (in this case shape ). The
-Second argument is a closure that will be added to the final C_obj.
+Second argument is a closure that will be added to the final C_obj.
@@ -928,7 +931,7 @@
31.2.5.4 Creating director objects
properly.
- 31.2.5.5 Typemaps for directors, directorin, directorout, directorargout
+31.2.5.5 Typemaps for directors, directorin, directorout, directorargout
@@ -939,7 +942,7 @@
31.2.5.5 Typemaps for directors, directorin, di
and to receive arguments the same way you normally receive function returns.
- 31.2.5.6 directorin typemap
+31.2.5.6 typemap
@@ -950,7 +953,7 @@
31.2.5.6 directorin typemap
can use the same body as a simple out typemap.
- 31.2.5.7 directorout typemap
+31.2.5.7 directorout typemap
@@ -961,7 +964,7 @@
31.2.5.7 directorout typemap
ownership, etc.
- 31.2.5.8 directorargout typemap
+31.2.5.8 directorargout typemap
@@ -978,7 +981,7 @@
31.2.5.8 directorargout typemap
values will read zero, and struct or object returns have undefined results.
- 31.2.6 Exceptions
+31.2.6 Exceptions
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index 46a8941c2e9..9b9744f658c 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -1,14 +1,15 @@
-
+
SWIG and Octave
+
- 32 SWIG and Octave
+32 SWIG and Octave
@@ -33,6 +34,10 @@ 32 SWIG and Octave
Class extension with %extend
C++ templates
C++ Smart Pointers
+
Directors (calling Octave from C++ code)
Threads
Memory management
@@ -55,15 +60,16 @@ 32 SWIG and Octave
Also, there are a dozen or so examples in the Examples/octave directory, and hundreds in the test suite (Examples/test-suite and Examples/test-suite/octave).
- 32.1 Preliminaries
+32.1 Preliminaries
-As of SWIG 3.0.3, the Octave module has been tested with Octave versions 3.2.4, 3.4.3, 3.6.4, and 3.8.1.
+As of SWIG 3.0.7, the Octave module is regularly tested with Octave versions 3.2.4, 3.8.1, and 4.0.0.
Use of older Octave versions is not recommended, as these versions are no longer tested with SWIG.
+The SWIG runtime exports the function swig_octave_prereq() for checking the version of Octave.
- 32.2 Running SWIG
+32.2 Running SWIG
@@ -95,7 +101,7 @@
32.2 Running SWIG
This creates a C++ source file "example_wrap.cpp". A C++ file is generated even when wrapping C code as Octave is itself written in C++ and requires wrapper code to be in the same language. The generated C++ source file contains the low-level wrappers that need to be compiled and linked with the rest of your C/C++ application (in this case, the gcd implementation) to create an extension module.
- 32.2.1 Command-line options
+32.2.1 Command-line options
@@ -118,7 +124,7 @@
32.2.1 Command-line options
The -opprefix options sets the prefix of the names of global/friend operator functions.
- 32.2.2 Compiling a dynamic module
+32.2.2 Compiling a dynamic module
@@ -145,7 +151,7 @@
32.2.2 Compiling a dynamic module
- 32.2.3 Using your module
+32.2.3 Using your module
@@ -163,10 +169,10 @@
32.2.3 Using your module
octave:5> swigexample.cvar.Foo
ans = 4
- 32.3 A tour of basic C/C++ wrapping
+32.3 A tour of basic C/C++ wrapping
- 32.3.1 Modules
+32.3.1 Modules
@@ -211,7 +217,7 @@
32.3.1 Modules
ans = 2
- 32.3.2 Functions
+32.3.2 Functions
@@ -228,7 +234,7 @@
32.3.2 Functions
octave:1> swigexample.fact(4)
24
- 32.3.3 Global variables
+32.3.3 Global variables
@@ -281,7 +287,7 @@
32.3.3 Global variables
octave:3> swigexample.PI
ans = 3.1420
- 32.3.4 Constants and enums
+32.3.4 Constants and enums
@@ -303,7 +309,7 @@
32.3.4 Constants and enums
swigexample.SUNDAY=0
....
- 32.3.5 Pointers
+32.3.5 Pointers
@@ -350,7 +356,7 @@
32.3.5 Pointers
error: value on right hand side of assignment is undefined
error: evaluating assignment expression near line 2, column 2
- 32.3.6 Structures and C++ classes
+32.3.6 Structures and C++ classes
@@ -485,7 +491,7 @@
32.3.6 Structures and C++ classes
Depending on the ownership setting of a swig_ref , it may call C++ destructors when its reference count goes to zero. See the section on memory management below for details.
- 32.3.7 C++ inheritance
+32.3.7 C++ inheritance
@@ -494,7 +500,7 @@
32.3.7 C++ inheritance
the tree is walked to find a match in the current class as well as any of its bases. The lookup is then cached in the swig_ref .
- 32.3.8 C++ overloaded functions
+32.3.8 C++ overloaded functions
@@ -504,7 +510,7 @@
32.3.8 C++ overloaded functions
typecheck typemaps are used to analyze each argument, as well as assign precedence. See the chapter on typemaps for details.
- 32.3.9 C++ operators
+32.3.9 C++ operators
@@ -512,7 +518,7 @@
32.3.9 C++ operators
The swig_ref type supports all unary and binary operators between itself and all other types that exist in the system at module load time. When an operator is used (where one of the operands is a swig_ref ), the runtime routes the call to either a member function of the given object, or to a global function whose named is derived from the types of the operands (either both or just the lhs or rhs).
-For example, if a and b are SWIG variables in Octave, a+b becomes a.__add(b) . The wrapper is then free to implement __add to do whatever it wants. A wrapper may define the __add function manually, %rename some other function to it, or %rename a C++ operator to it.
+For example, if a and b are SWIG variables in Octave, a+b becomes a.__add__(b) . The wrapper is then free to implement __add__ to do whatever it wants. A wrapper may define the __add__ function manually, %rename some other function to it, or %rename a C++ operator to it.
By default the C++ operators are renamed to their corresponding Octave operators. So without doing any work, the following interface
@@ -539,87 +545,87 @@
32.3.9 C++ operators
Octave operators are mapped in the following way:
-__brace a{args}
-__brace_asgn a{args} = rhs
-__paren a(args)
-__paren_asgn a(args) = rhs
-__str generates string rep
-__not !a
-__uplus +a
-__uminus -a
-__transpose a.'
-__hermitian a'
-__incr a++
-__decr a--
-__add a + b
-__sub a - b
-__mul a * b
-__div a / b
-__pow a ^ b
-__ldiv a \ b
-__lshift a << b
-__rshift a >> b
-__lt a < b
-__le a <= b
-__eq a == b
-__ge a >= b
-__gt a > b
-__ne a != b
-__el_mul a .* b
-__el_div a ./ b
-__el_pow a .^ b
-__el_ldiv a .\ b
-__el_and a & b
-__el_or a | b
+__brace__ a{args}
+__brace_asgn__ a{args} = rhs
+__paren__ a(args)
+__paren_asgn__ a(args) = rhs
+__str__ generates string rep
+__not__ !a
+__uplus__ +a
+__uminus__ -a
+__transpose__ a.'
+__hermitian__ a'
+__incr__ a++
+__decr__ a--
+__add__ a + b
+__sub__ a - b
+__mul__ a * b
+__div__ a / b
+__pow__ a ^ b
+__ldiv__ a \ b
+__lshift__ a << b
+__rshift__ a >> b
+__lt__ a < b
+__le__ a <= b
+__eq__ a == b
+__ge__ a >= b
+__gt__ a > b
+__ne__ a != b
+__el_mul__ a .* b
+__el_div__ a ./ b
+__el_pow__ a .^ b
+__el_ldiv__ a .\ b
+__el_and__ a & b
+__el_or__ a | b
On the C++ side, the default mappings are as follows:
-%rename(__add) *::operator+;
-%rename(__add) *::operator+();
-%rename(__add) *::operator+() const;
-%rename(__sub) *::operator-;
-%rename(__uminus) *::operator-();
-%rename(__uminus) *::operator-() const;
-%rename(__mul) *::operator*;
-%rename(__div) *::operator/;
-%rename(__mod) *::operator%;
-%rename(__lshift) *::operator<<;
-%rename(__rshift) *::operator>>;
-%rename(__el_and) *::operator&&;
-%rename(__el_or) *::operator||;
-%rename(__xor) *::operator^;
-%rename(__invert) *::operator~;
-%rename(__lt) *::operator<;
-%rename(__le) *::operator<=;
-%rename(__gt) *::operator>;
-%rename(__ge) *::operator>=;
-%rename(__eq) *::operator==;
-%rename(__ne) *::operator!=;
-%rename(__not) *::operator!;
-%rename(__incr) *::operator++;
-%rename(__decr) *::operator--;
-%rename(__paren) *::operator();
-%rename(__brace) *::operator[];
+%rename(__add__) *::operator+;
+%rename(__add__) *::operator+();
+%rename(__add__) *::operator+() const;
+%rename(__sub__) *::operator-;
+%rename(__uminus__) *::operator-();
+%rename(__uminus__) *::operator-() const;
+%rename(__mul__) *::operator*;
+%rename(__div__) *::operator/;
+%rename(__mod__) *::operator%;
+%rename(__lshift__) *::operator<<;
+%rename(__rshift__) *::operator>>;
+%rename(__el_and__) *::operator&&;
+%rename(__el_or__) *::operator||;
+%rename(__xor__) *::operator^;
+%rename(__invert__) *::operator~;
+%rename(__lt__) *::operator<;
+%rename(__le__) *::operator<=;
+%rename(__gt__) *::operator>;
+%rename(__ge__) *::operator>=;
+%rename(__eq__) *::operator==;
+%rename(__ne__) *::operator!=;
+%rename(__not__) *::operator!;
+%rename(__incr__) *::operator++;
+%rename(__decr__) *::operator--;
+%rename(__paren__) *::operator();
+%rename(__brace__) *::operator[];
Octave can also utilise friend (i.e. non-member) operators with a simple %rename: see the example in the Examples/octave/operator directory.
- 32.3.10 Class extension with %extend
+32.3.10 Class extension with %extend
The %extend directive works the same as in other modules.
-You can use it to define special behavior, like for example defining Octave operators not mapped to C++ operators, or defining certain Octave mechanisms such as how an object prints. For example, the octave_value::{is_string,string_value,print} functions are routed to a special method __str that can be defined inside an %extend.
+You can use it to define special behavior, like for example defining Octave operators not mapped to C++ operators, or defining certain Octave mechanisms such as how an object prints. For example, the octave_value::{is_string,string_value,print} functions are routed to a special method __str__ that can be defined inside an %extend.
%extend A {
-string __str() {
+string __str__() {
stringstream sout;
sout<<$self->value;
return sout.str();
@@ -635,10 +641,19 @@ 32.3.10 Class extension with %extend
a = 4
octave:3> printf("%s\n",a);
4
-octave:4> a.__str()
+octave:4> a.__str__()
4
- 32.3.11 C++ templates
+
+
+Similarly, Octave can use the __float__ method to convert an object to a numeric value.
+
+
+
+Octave 3.8.0 and later versions will also map unary functions X() to the corresponding __X__ method, where X includes: abs(), acos(), acosh(), angle(), arg(), asin(), asinh(), atan(), atanh(), cbrt(), ceil(), conj(), cos(), cosh(), dawson(), erf(), erfc(), erfcinv(), erfcx(), erfi(), erfinv(), exp(), expm1(), finite(), fix(), floor(), gamma(), imag(), isalnum(), isalpha(), isascii(), iscntrl(), isdigit(), isgraph(), isinf(), islower(), isna(), isnan(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), lgamma(), log(), log10(), log1p(), log2(), real(), round(), roundb(), signbit(), signum(), sin(), sinh(), sqrt(), tan(), tanh(), toascii(), tolower(), toupper()
+
+
+32.3.11 C++ templates
@@ -687,7 +702,7 @@
32.3.11 C++ templates
s+=_s;
return *this;
}
- std::string __str() const {
+ std::string __str__() const {
std::stringstream sout;
sout<<s;
return sout.str();
@@ -715,14 +730,28 @@ 32.3.11 C++ templates
- 32.3.12 C++ Smart Pointers
+32.3.12 C++ Smart Pointers
+
+
+32.3.12.1 The shared_ptr Smart Pointer
+
+
+
+The C++11 standard provides std::shared_ptr which was derived from the Boost
+implementation, boost::shared_ptr .
+Both of these are available for Octave in the SWIG library and usage is outlined
+in the shared_ptr smart pointer library section.
+
+
+
+32.3.12.2 Generic Smart Pointers
C++ smart pointers are fully supported as in other modules.
- 32.3.13 Directors (calling Octave from C++ code)
+32.3.13 Directors (calling Octave from C++ code)
@@ -803,14 +832,14 @@
32.3.13 Directors (calling Octave from C++ code)
octave-side routine called
- 32.3.14 Threads
+32.3.14 Threads
The use of threads in wrapped Director code is not supported; i.e., an Octave-side implementation of a C++ class must be called from the Octave interpreter's thread. Anything fancier (apartment/queue model, whatever) is left to the user. Without anything fancier, this amounts to the limitation that Octave must drive the module... like, for example, an optimization package that calls Octave to evaluate an objective function.
- 32.3.15 Memory management
+32.3.15 Memory management
@@ -844,14 +873,14 @@
32.3.15 Memory management
In the case where one wishes for the C++ side to own an object that was created in Octave (especially a Director object), one can use the __disown() method to invert this logic. Then letting the Octave reference count go to zero will not destroy the object, but destroying the object will invalidate the Octave-side object if it still exists (and call destructors of other C++ bases in the case of multiple inheritance/subclass() 'ing).
- 32.3.16 STL support
+32.3.16 STL support
Various STL library files are provided for wrapping STL containers.
- 32.3.17 Matrix typemaps
+32.3.17 Matrix typemaps
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index 8bc7cbfd3dc..8d7b866d61e 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -1,12 +1,13 @@
-
+
SWIG and Perl5
+
- 33 SWIG and Perl5
+33 SWIG and Perl5
@@ -96,7 +97,7 @@ 33 SWIG and Perl5
Perl 5.6 seems to mostly work, while older versions don't.
- 33.1 Overview
+33.1 Overview
@@ -117,7 +118,7 @@
33.1 Overview
options are found near the end of the chapter.
- 33.2 Preliminaries
+33.2 Preliminaries
@@ -142,7 +143,7 @@
33.2 Preliminaries
example_wrap.c and link it with the rest of your program.
- 33.2.1 Getting the right header files
+33.2.1 Getting the right header files
@@ -174,7 +175,7 @@
33.2.1 Getting the right header files
- 33.2.2 Compiling a dynamic module
+33.2.2 Compiling a dynamic module
@@ -207,7 +208,7 @@
33.2.2 Compiling a dynamic module
`example.sl ', or the appropriate dynamic module name on your system.
- 33.2.3 Building a dynamic module with MakeMaker
+33.2.3 Building a dynamic module with MakeMaker
@@ -219,9 +220,9 @@
33.2.3 Building a dynamic module with MakeMaker
# File : Makefile.PL
use ExtUtils::MakeMaker;
WriteMakefile(
- `NAME' => `example', # Name of package
- `LIBS' => [`-lm'], # Name of custom libraries
- `OBJECT' => `example.o example_wrap.o' # Object files
+ `NAME' => `example', # Name of package
+ `LIBS' => [`-lm'], # Name of custom libraries
+ `OBJECT' => `example.o example_wrap.o' # Object files
);
@@ -241,7 +242,7 @@ 33.2.3 Building a dynamic module with MakeMaker
found in "Programming Perl, 2nd ed." by Larry Wall, Tom Christiansen,
and Randal Schwartz.
- 33.2.4 Building a static version of Perl
+33.2.4 Building a static version of Perl
@@ -300,7 +301,7 @@
33.2.4 Building a static version of Perl
$ gcc example.o example_wrap.o -L/usr/lib/perl/5.14/CORE \
- -lperl -lsocket -lnsl -lm -o myperl
+ -lperl -lsocket -lnsl -lm -o myperl
@@ -310,7 +311,7 @@
33.2.4 Building a static version of Perl
additional libraries such as -lsocket, -lnsl, -ldl , etc.
- 33.2.5 Using the module
+33.2.5 Using the module
@@ -463,7 +464,7 @@
33.2.5 Using the module
read the man pages).
- 33.2.6 Compilation problems and compiling with C++
+33.2.6 Compilation problems and compiling with C++
@@ -606,7 +607,7 @@
33.2.6 Compilation problems and compiling with C++
any conflicting macros you find to swig-user mailing list .
- 33.2.7 Compiling for 64-bit platforms
+33.2.7 Compiling for 64-bit platforms
@@ -633,7 +634,7 @@
33.2.7 Compiling for 64-bit platforms
linking standard (e.g., -o32 and -n32 on Irix).
- 33.3 Building Perl Extensions under Windows
+33.3 Building Perl Extensions under Windows
@@ -644,7 +645,7 @@
33.3 Building Perl Extensions under Windows
although the procedure may be similar with other compilers.
- 33.3.1 Running SWIG from Developer Studio
+33.3.1 Running SWIG from Developer Studio
@@ -707,7 +708,7 @@
33.3.1 Running SWIG from Developer Studio
- 33.3.2 Using other compilers
+33.3.2 Using other compilers
@@ -715,7 +716,7 @@
33.3.2 Using other compilers
For general hints and suggestions refer to the Windows chapter.
- 33.4 The low-level interface
+33.4 The low-level interface
@@ -725,7 +726,7 @@
33.4 The low-level interface
construct more user-friendly proxy classes as described in the next section.
- 33.4.1 Functions
+33.4.1 Functions
@@ -748,7 +749,7 @@
33.4.1 Functions
$a = &example::fact(2);
- 33.4.2 Global variables
+33.4.2 Global variables
@@ -818,7 +819,7 @@
33.4.2 Global variables
- 33.4.3 Constants
+33.4.3 Constants
@@ -858,7 +859,7 @@
33.4.3 Constants
- 33.4.4 Pointers
+33.4.4 Pointers
@@ -891,9 +892,9 @@
33.4.4 Pointers
if (defined($ptr)) {
- print "Not a NULL pointer.";
+ print "Not a NULL pointer.";
} else {
- print "Is a NULL pointer.";
+ print "Is a NULL pointer.";
}
@@ -916,9 +917,9 @@ 33.4.4 Pointers
if ($$a == $$b) {
- print "a and b point to the same thing in C";
+ print "a and b point to the same thing in C";
} else {
- print "a and b point to different objects.";
+ print "a and b point to different objects.";
}
@@ -967,7 +968,7 @@ 33.4.4 Pointers
SWIG and XS, this is no longer supported.
- 33.4.5 Structures
+33.4.5 Structures
@@ -977,7 +978,7 @@
33.4.5 Structures
struct Vector {
- double x,y,z;
+ double x,y,z;
};
@@ -1101,7 +1102,7 @@ 33.4.5 Structures
- 33.4.6 C++ classes
+33.4.6 C++ classes
@@ -1166,7 +1167,7 @@
33.4.6 C++ classes
can be built using these low-level accessors. This is described shortly.
- 33.4.7 C++ classes and type-checking
+33.4.7 C++ classes and type-checking
@@ -1202,7 +1203,7 @@
33.4.7 C++ classes and type-checking
multiple inheritance is used).
- 33.4.8 C++ overloaded functions
+33.4.8 C++ overloaded functions
@@ -1246,7 +1247,7 @@
33.4.8 C++ overloaded functions
Please refer to the "SWIG Basics" chapter for more information.
- 33.4.9 Operators
+33.4.9 Operators
@@ -1258,22 +1259,22 @@
33.4.9 Operators
-operator++
-operator--
-operator+
-operator-
-operator*
-operator/
-operator==
-operator!=
-operator%
-operator>
-operator<
+operator++
+operator--
+operator+
+operator-
+operator*
+operator/
+operator==
+operator!=
+operator%
+operator>
+operator<
operator and
operator or
- 33.4.10 Modules and packages
+33.4.10 Modules and packages
@@ -1368,7 +1369,7 @@
33.4.10 Modules and packages
-->
- 33.5 Input and output parameters
+33.5 Input and output parameters
@@ -1587,7 +1588,7 @@
33.5 Input and output parameters
Note: The REFERENCE feature is only currently supported for numeric types (integers and floating point).
- 33.6 Exception handling
+33.6 Exception handling
@@ -1752,7 +1753,7 @@
33.6 Exception handling
functionality, but it has additional capabilities that make it more powerful.
- 33.7 Remapping datatypes with typemaps
+33.7 Remapping datatypes with typemaps
@@ -1769,7 +1770,7 @@
33.7 Remapping datatypes with typemaps
C-Perl interface.
- 33.7.1 A simple typemap example
+33.7.1 A simple typemap example
@@ -1782,8 +1783,8 @@
33.7.1 A simple typemap example
%module example
%typemap(in) int {
- $1 = (int) SvIV($input);
- printf("Received an integer : %d\n", $1);
+ $1 = (int) SvIV($input);
+ printf("Received an integer : %d\n", $1);
}
...
%inline %{
@@ -1828,8 +1829,8 @@ 33.7.1 A simple typemap example
%typemap(in) int n {
- $1 = (int) SvIV($input);
- printf("n = %d\n",$1);
+ $1 = (int) SvIV($input);
+ printf("n = %d\n",$1);
}
%inline %{
typedef int Integer;
@@ -1873,7 +1874,7 @@ 33.7.1 A simple typemap example
- 33.7.2 Perl5 typemaps
+33.7.2 Perl5 typemaps
@@ -1978,7 +1979,7 @@
33.7.2 Perl5 typemaps
Check value of input parameter.
- 33.7.3 Typemap variables
+33.7.3 Typemap variables
@@ -2049,7 +2050,7 @@
33.7.3 Typemap variables
The Perl name of the wrapper function being created.
- 33.7.4 Useful functions
+33.7.4 Useful functions
@@ -2118,7 +2119,7 @@
33.7.4 Useful functions
- 33.8 Typemap Examples
+33.8 Typemap Examples
@@ -2127,7 +2128,7 @@
33.8 Typemap Examples
the SWIG library.
- 33.8.1 Converting a Perl5 array to a char **
+33.8.1 Converting a Perl5 array to a char **
@@ -2142,47 +2143,47 @@
33.8.1 Converting a Perl5 array to a char **
// This tells SWIG to treat char ** as a special case
%typemap(in) char ** {
- AV *tempav;
- I32 len;
- int i;
- SV **tv;
- if (!SvROK($input))
- croak("Argument $argnum is not a reference.");
- if (SvTYPE(SvRV($input)) != SVt_PVAV)
- croak("Argument $argnum is not an array.");
- tempav = (AV*)SvRV($input);
- len = av_len(tempav);
- $1 = (char **) malloc((len+2)*sizeof(char *));
- for (i = 0; i <= len; i++) {
- tv = av_fetch(tempav, i, 0);
- $1[i] = (char *) SvPV(*tv,PL_na);
- }
- $1[i] = NULL;
+ AV *tempav;
+ I32 len;
+ int i;
+ SV **tv;
+ if (!SvROK($input))
+ croak("Argument $argnum is not a reference.");
+ if (SvTYPE(SvRV($input)) != SVt_PVAV)
+ croak("Argument $argnum is not an array.");
+ tempav = (AV*)SvRV($input);
+ len = av_len(tempav);
+ $1 = (char **) malloc((len+2)*sizeof(char *));
+ for (i = 0; i <= len; i++) {
+ tv = av_fetch(tempav, i, 0);
+ $1[i] = (char *) SvPV(*tv,PL_na);
+ }
+ $1[i] = NULL;
};
// This cleans up the char ** array after the function call
%typemap(freearg) char ** {
- free($1);
+ free($1);
}
// Creates a new Perl array and places a NULL-terminated char ** into it
%typemap(out) char ** {
- AV *myav;
- SV **svs;
- int i = 0,len = 0;
- /* Figure out how many elements we have */
- while ($1[len])
- len++;
- svs = (SV **) malloc(len*sizeof(SV *));
- for (i = 0; i < len ; i++) {
- svs[i] = sv_newmortal();
- sv_setpv((SV*)svs[i],$1[i]);
- };
- myav = av_make(len,svs);
- free(svs);
- $result = newRV_noinc((SV*)myav);
- sv_2mortal($result);
- argvi++;
+ AV *myav;
+ SV **svs;
+ int i = 0,len = 0;
+ /* Figure out how many elements we have */
+ while ($1[len])
+ len++;
+ svs = (SV **) malloc(len*sizeof(SV *));
+ for (i = 0; i < len ; i++) {
+ svs[i] = sv_newmortal();
+ sv_setpv((SV*)svs[i],$1[i]);
+ };
+ myav = av_make(len,svs);
+ free(svs);
+ $result = newRV_noinc((SV*)myav);
+ sv_2mortal($result);
+ argvi++;
}
// Now a few test functions
@@ -2219,7 +2220,7 @@ 33.8.1 Converting a Perl5 array to a char **
- 33.8.2 Return values
+33.8.2 Return values
@@ -2239,16 +2240,16 @@
33.8.2 Return values
%typemap(argout) int *OUTPUT {
- if (argvi >= items) {
- EXTEND(sp,1); /* Extend the stack by 1 object */
- }
- $result = sv_newmortal();
- sv_setiv($target,(IV) *($1));
- argvi++;
+ if (argvi >= items) {
+ EXTEND(sp,1); /* Extend the stack by 1 object */
+ }
+ $result = sv_newmortal();
+ sv_setiv($target,(IV) *($1));
+ argvi++;
}
- 33.8.3 Returning values from arguments
+33.8.3 Returning values from arguments
@@ -2263,24 +2264,24 @@
33.8.3 Returning values from arguments
// an output value.
%typemap(argout) double *OUTPUT {
- $result = sv_newmortal();
- sv_setnv($result, *$input);
- argvi++; /* Increment return count -- important! */
+ $result = sv_newmortal();
+ sv_setnv($result, *$input);
+ argvi++; /* Increment return count -- important! */
}
// We don't care what the input value is. Ignore, but set to a temporary variable
%typemap(in,numinputs=0) double *OUTPUT(double junk) {
- $1 = &junk;
+ $1 = &junk;
}
// Now a function to test it
%{
/* Returns the first two input arguments */
int multout(double a, double b, double *out1, double *out2) {
- *out1 = a;
- *out2 = b;
- return 0;
+ *out1 = a;
+ *out2 = b;
+ return 0;
};
%}
@@ -2302,7 +2303,7 @@ 33.8.3 Returning values from arguments
($x,$y) = multout(7,13);
- 33.8.4 Accessing array structure members
+33.8.4 Accessing array structure members
@@ -2365,7 +2366,7 @@
33.8.4 Accessing array structure members
to copy the converted array into a C data structure.
- 33.8.5 Turning Perl references into C pointers
+33.8.5 Turning Perl references into C pointers
@@ -2376,7 +2377,7 @@
33.8.5 Turning Perl references into C pointers
void add(double a, double b, double *c) {
- *c = a + b;
+ *c = a + b;
}
@@ -2430,7 +2431,7 @@ 33.8.5 Turning Perl references into C pointers
- 33.8.6 Pointer handling
+33.8.6 Pointer handling
@@ -2509,7 +2510,7 @@
33.8.6 Pointer handling
- 33.9 Proxy classes
+33.9 Proxy classes
@@ -2525,7 +2526,7 @@
33.9 Proxy classes
details of the proxy interface.
- 33.9.1 Preliminaries
+33.9.1 Preliminaries
@@ -2547,7 +2548,7 @@
33.9.1 Preliminaries
high level wrappers. The wrappers, in turn, interact with the low-level procedural module.
- 33.9.2 Structure and class wrappers
+33.9.2 Structure and class wrappers
@@ -2557,9 +2558,9 @@
33.9.2 Structure and class wrappers
%module example
struct Vector {
- Vector(double x, double y, double z);
- ~Vector();
- double x,y,z;
+ Vector(double x, double y, double z);
+ ~Vector();
+ double x,y,z;
};
@@ -2609,8 +2610,9 @@ 33.9.2 Structure and class wrappers
my $self = tied(%{$_[0]});
delete $ITERATORS{$self};
if (exists $OWNER{$self}) {
- examplec::delete_Vector($self));
- delete $OWNER{$self};
+ examplec::delete_Vector($self));
+ delete $OWNER{$self};
+ }
}
sub FETCH {
@@ -2662,8 +2664,8 @@ 33.9.2 Structure and class wrappers
# Assignment of all members
%$v = ( x=>3,
- y=>9,
- z=>-2);
+ y=>9,
+ z=>-2);
# Reading members
$x = $v->{x};
@@ -2673,7 +2675,7 @@ 33.9.2 Structure and class wrappers
- 33.9.3 Object Ownership
+33.9.3 Object Ownership
@@ -2684,7 +2686,7 @@
33.9.3 Object Ownership
Vector *Vector_get(Vector *v, int index) {
- return &v[i];
+ return &v[i];
}
@@ -2697,9 +2699,9 @@ 33.9.3 Object Ownership
Vector *new_Vector(double x, double y, double z) {
- Vector *v;
- v = new Vector(x,y,z); // Call C++ constructor
- return v;
+ Vector *v;
+ v = new Vector(x,y,z); // Call C++ constructor
+ return v;
}
@@ -2760,7 +2762,7 @@ 33.9.3 Object Ownership
sophisticated languages.
- 33.9.4 Nested Objects
+33.9.4 Nested Objects
@@ -2769,10 +2771,10 @@
33.9.4 Nested Objects
struct Particle {
- Vector r;
- Vector v;
- Vector f;
- int type;
+ Vector r;
+ Vector v;
+ Vector f;
+ int type;
}
@@ -2788,9 +2790,9 @@ 33.9.4 Nested Objects
package Particle;
...
%BLESSEDMEMBERS = (
- r => `Vector',
- v => `Vector',
- f => `Vector',
+ r => `Vector',
+ v => `Vector',
+ f => `Vector',
);
@@ -2813,7 +2815,7 @@ 33.9.4 Nested Objects
%${$p->{v}} = ( x=>0, y=>0, z=>0);
- 33.9.5 Proxy Functions
+33.9.5 Proxy Functions
@@ -2847,7 +2849,7 @@
33.9.5 Proxy Functions
identical manner.
- 33.9.6 Inheritance
+33.9.6 Inheritance
@@ -2866,23 +2868,23 @@
33.9.6 Inheritance
class Shape {
public:
- virtual double area() = 0;
- virtual double perimeter() = 0;
- void set_location(double x, double y);
+ virtual double area() = 0;
+ virtual double perimeter() = 0;
+ void set_location(double x, double y);
};
class Circle : public Shape {
public:
- Circle(double radius);
- ~Circle();
- double area();
- double perimeter();
+ Circle(double radius);
+ ~Circle();
+ double area();
+ double perimeter();
};
class Square : public Shape {
public:
- Square(double size);
- ~Square();
- double area();
- double perimeter();
+ Square(double size);
+ ~Square();
+ double area();
+ double perimeter();
}
@@ -2923,7 +2925,7 @@ 33.9.6 Inheritance
not even sure if it really works).
- 33.9.7 Modifying the proxy methods
+33.9.7 Modifying the proxy methods
@@ -2951,7 +2953,7 @@
33.9.7 Modifying the proxy methods
};
- 33.10 Adding additional Perl code
+33.10 Adding additional Perl code
@@ -3002,7 +3004,7 @@
33.10 Adding additional Perl code
- 33.11 Cross language polymorphism
+33.11 Cross language polymorphism
@@ -3036,7 +3038,7 @@
33.11 Cross language polymorphism
all the cross-language method routing transparently.
- 33.11.1 Enabling directors
+33.11.1 Enabling directors
@@ -3126,7 +3128,7 @@
33.11.1 Enabling directors
- 33.11.2 Director classes
+33.11.2 Director classes
@@ -3206,7 +3208,7 @@ 33.11.2 Director classes
calls through Perl.
- 33.11.3 Ownership and object destruction
+33.11.3 Ownership and object destruction
@@ -3255,7 +3257,7 @@
33.11.3 Ownership and object destruction
- 33.11.4 Exception unrolling
+33.11.4 Exception unrolling
@@ -3311,7 +3313,7 @@
33.11.4 Exception unrolling
exception as soon as the C wrapper function returns.
- 33.11.5 Overhead and code bloat
+33.11.5 Overhead and code bloat
@@ -3345,7 +3347,7 @@
33.11.5 Overhead and code bloat
Perl.
- 33.11.6 Typemaps
+33.11.6 Typemaps
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 623adb68ad0..8c483b7a076 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -1,13 +1,13 @@
-
-
+
SWIG and PHP
+
- 34 SWIG and PHP
+34 SWIG and PHP
@@ -25,7 +25,7 @@ 34 SWIG and PHP
Pointers and References
Structures and C++ classes
-Using -noproxy
+Using -noproxy
Constructors and Destructors
Static Member Variables
Static Member Functions
@@ -80,7 +80,7 @@ 34 SWIG and PHP
available.
- 34.1 Generating PHP Extensions
+34.1 Generating PHP Extensions
@@ -125,7 +125,7 @@
34.1 Generating PHP Extensions
this approach, or provide explicit support for it.
- 34.1.1 Building a loadable extension
+34.1.1 Building a loadable extension
@@ -136,11 +136,11 @@
34.1.1 Building a loadable extension
- gcc `php-config --includes` -fpic -c example_wrap.c example.c
- gcc -shared example_wrap.o example.o -o example.so
+ gcc `php-config --includes` -fpic -c example_wrap.c example.c
+ gcc -shared example_wrap.o example.o -o example.so
- 34.1.2 Using PHP Extensions
+34.1.2 Using PHP Extensions
@@ -150,7 +150,7 @@
34.1.2 Using PHP Extensions
- extension=/path/to/modulename.so
+ extension=/path/to/modulename.so
@@ -165,7 +165,7 @@
34.1.2 Using PHP Extensions
- dl("/path/to/modulename.so"); // Load the module
+ dl("/path/to/modulename.so"); // Load the module
@@ -180,7 +180,7 @@
34.1.2 Using PHP Extensions
- include("example.php");
+ include("example.php");
@@ -188,7 +188,7 @@
34.1.2 Using PHP Extensions
almost certainly want to include it anyway.
- 34.2 Basic PHP interface
+34.2 Basic PHP interface
@@ -199,7 +199,7 @@
34.2 Basic PHP interface
SWIG doesn't have support for the namespace feature added in PHP 5.3.
- 34.2.1 Constants
+34.2.1 Constants
@@ -249,7 +249,7 @@
34.2.1 Constants
%module example
-#define EASY_TO_MISPELL 0
+#define EASY_TO_MISPELL 0
@@ -262,9 +262,9 @@ 34.2.1 Constants
include("example.php");
if(EASY_TO_MISPEL) {
- ....
+ ...
} else {
- ....
+ ...
}
@@ -276,7 +276,7 @@ 34.2.1 Constants
would be treated as false!
- 34.2.2 Global Variables
+34.2.2 Global Variables
@@ -303,7 +303,7 @@
34.2.2 Global Variables
include("example.php");
print seki_get();
-seki_set( seki_get() * 2); # The C variable is now 4.
+seki_set( seki_get() * 2); # The C variable is now 4.
print seki_get();
@@ -325,7 +325,7 @@ 34.2.2 Global Variables
At this time SWIG does not support custom accessor methods.
- 34.2.3 Functions
+34.2.3 Functions
@@ -348,7 +348,7 @@
34.2.3 Functions
include("example.php");
$a = foo(2);
$b = bar(3.5, -1.5);
-$c = bar(3.5); # Use default argument for 2nd parameter
+$c = bar(3.5); # Use default argument for 2nd parameter
@@ -378,7 +378,7 @@ 34.2.3 Functions
-->
- 34.2.4 Overloading
+34.2.4 Overloading
@@ -434,7 +434,7 @@
34.2.4 Overloading
-->
- 34.2.5 Pointers and References
+34.2.5 Pointers and References
@@ -579,7 +579,7 @@
34.2.5 Pointers and References
variable, or assigning NULL to a variable.
- 34.2.6 Structures and C++ classes
+34.2.6 Structures and C++ classes
@@ -599,10 +599,10 @@
34.2.6 Structures and C++ classes
class Vector {
public:
- double x,y,z;
- Vector();
- ~Vector();
- double magnitude();
+ double x,y,z;
+ Vector();
+ ~Vector();
+ double magnitude();
};
struct Complex {
@@ -640,7 +640,7 @@ 34.2.6 Structures and C++ classes
Member variables and methods are accessed using the -> operator.
- 34.2.6.1 Using -noproxy
+34.2.6.1 Using -noproxy
@@ -666,7 +666,7 @@
34.2.6.1 Using -noproxy
Complex_im_get($obj);
- 34.2.6.2 Constructors and Destructors
+34.2.6.2 Constructors and Destructors
@@ -707,7 +707,7 @@
34.2.6.2 Constructors and Destructors
unset($v)
- 34.2.6.3 Static Member Variables
+34.2.6.3 Static Member Variables
@@ -722,7 +722,7 @@
34.2.6.3 Static Member Variables
%module example
class Ko {
- static int threats;
+ static int threats;
};
@@ -750,7 +750,7 @@ 34.2.6.3 Static Member Variables
echo "There have now been " . Ko::threats() . " threats\n";
- 34.2.6.4 Static Member Functions
+34.2.6.4 Static Member Functions
@@ -772,7 +772,7 @@
34.2.6.4 Static Member Functions
- 34.2.6.5 Specifying Implemented Interfaces
+34.2.6.5 Specifying Implemented Interfaces
@@ -790,7 +790,7 @@
34.2.6.5 Specifying Implemented Interfaces
If there are multiple interfaces, just list them separated by commas.
- 34.2.7 PHP Pragmas, Startup and Shutdown code
+34.2.7 PHP Pragmas, Startup and Shutdown code
@@ -878,7 +878,7 @@
34.2.7 PHP Pragmas, Startup and Shutdown code
into the request init (PHP_RINIT_FUNCTION) and request shutdown (PHP_RSHUTDOWN_FUNCTION) code respectively.
- 34.3 Cross language polymorphism
+34.3 Cross language polymorphism
@@ -913,7 +913,7 @@
34.3 Cross language polymorphism
transparently.
- 34.3.1 Enabling directors
+34.3.1 Enabling directors
@@ -1002,7 +1002,7 @@
34.3.1 Enabling directors
- 34.3.2 Director classes
+34.3.2 Director classes
@@ -1082,7 +1082,7 @@ 34.3.2 Director classes
calls through PHP.
- 34.3.3 Ownership and object destruction
+34.3.3 Ownership and object destruction
@@ -1138,7 +1138,7 @@
34.3.3 Ownership and object destruction
deleting all the Foo pointers it contains at some point.
- 34.3.4 Exception unrolling
+34.3.4 Exception unrolling
@@ -1197,7 +1197,7 @@
34.3.4 Exception unrolling
as soon as the C wrapper function returns.
- 34.3.5 Overhead and code bloat
+34.3.5 Overhead and code bloat
@@ -1230,7 +1230,7 @@
34.3.5 Overhead and code bloat
directive) for only those methods that are likely to be extended in PHP.
- 34.3.6 Typemaps
+34.3.6 Typemaps
@@ -1244,7 +1244,7 @@
34.3.6 Typemaps
- 34.3.7 Miscellaneous
+34.3.7 Miscellaneous
Director typemaps for STL classes are mostly in place, and hence you
diff --git a/Doc/Manual/Pike.html b/Doc/Manual/Pike.html
index 44c6930f876..22ab4e2a2b1 100644
--- a/Doc/Manual/Pike.html
+++ b/Doc/Manual/Pike.html
@@ -1,12 +1,13 @@
-
+
SWIG and Pike
+
- 35 SWIG and Pike
+35 SWIG and Pike
- 35.2 Basic C/C++ Mapping
+35.2 Basic C/C++ Mapping
- 35.2.1 Modules
+35.2.1 Modules
@@ -143,7 +144,7 @@
35.2.1 Modules
significance.
- 35.2.2 Functions
+35.2.2 Functions
@@ -168,7 +169,7 @@
35.2.2 Functions
(1) Result: 24
- 35.2.3 Global variables
+35.2.3 Global variables
@@ -197,7 +198,7 @@
35.2.3 Global variables
(3) Result: 3.141590
- 35.2.4 Constants and enumerated types
+35.2.4 Constants and enumerated types
@@ -205,7 +206,7 @@
35.2.4 Constants and enumerated types
not as Pike enums.
- 35.2.5 Constructors and Destructors
+35.2.5 Constructors and Destructors
@@ -213,7 +214,7 @@
35.2.5 Constructors and Destructors
wrapped as destroy() methods, for Pike classes.
- 35.2.6 Static Members
+35.2.6 Static Members
diff --git a/Doc/Manual/Preface.html b/Doc/Manual/Preface.html
index d17dc229c91..4a9ad5ba9c4 100644
--- a/Doc/Manual/Preface.html
+++ b/Doc/Manual/Preface.html
@@ -1,12 +1,13 @@
-
+
Preface
+
- 1 Preface
+1 Preface
@@ -35,7 +36,7 @@ 1 Preface
- 1.1 Introduction
+1.1 Introduction
@@ -58,7 +59,7 @@
1.1 Introduction
variety of applications--in fact almost anything where C/C++ programming
is involved.
- 1.2 SWIG Versions
+1.2 SWIG Versions
@@ -70,7 +71,7 @@
1.2 SWIG Versions
license changes and this gave rise to version 2.0.0 in 2010.
- 1.3 SWIG License
+1.3 SWIG License
@@ -86,7 +87,7 @@
1.3 SWIG License
source was placed under the GNU General Public License version 3.
- 1.4 SWIG resources
+1.4 SWIG resources
@@ -126,7 +127,7 @@
1.4 SWIG resources
- 1.5 Prerequisites
+1.5 Prerequisites
@@ -151,7 +152,7 @@
1.5 Prerequisites
of the gory details, you will almost certainly want to consult a good C++ reference. If you don't program
in C++, you may just want to skip those parts of the manual.
- 1.6 Organization of this manual
+1.6 Organization of this manual
@@ -163,7 +164,7 @@
1.6 Organization of this manual
to know.
- 1.7 How to avoid reading the manual
+1.7 How to avoid reading the manual
@@ -175,7 +176,7 @@
1.7 How to avoid reading the manual
examples that illustrate different topics.
- 1.8 Backwards compatibility
+1.8 Backwards compatibility
@@ -211,7 +212,7 @@
1.8 Backwards compatibility
wrapper file. The SWIG preprocessor has defined SWIG_VERSION since SWIG-1.3.11.
- 1.9 Release notes
+1.9 Release notes
@@ -220,7 +221,7 @@
1.9 Release notes
detailed release notes for previous releases and summary release notes from SWIG-1.3.22 onwards.
- 1.10 Credits
+1.10 Credits
@@ -233,7 +234,7 @@
1.10 Credits
are mentioned either in the COPYRIGHT file or CHANGES files shipped with SWIG or in submitted bugs.
- 1.11 Bug reports
+1.11 Bug reports
@@ -248,21 +249,21 @@
1.11 Bug reports
can only fix bugs if we know about them.
- 1.12 Installation
+1.12 Installation
- 1.12.1 Windows installation
+1.12.1 Windows installation
-Please see the dedicated Windows chapter for instructions on installing
+Please see the dedicated Windows chapter for instructions on installing
SWIG on Windows and running the examples. The Windows distribution is
called swigwin and includes a prebuilt SWIG executable, swig.exe, included in
the top level directory. Otherwise it is exactly the same as
the main SWIG distribution. There is no need to download anything else.
- 1.12.2 Unix installation
+1.12.2 Unix installation
@@ -332,7 +333,7 @@
1.12.2 Unix installation
SWIG used to include a set of runtime libraries for some languages for working
with multiple modules. These are no longer built during the installation stage.
However, users can build them just like any wrapper module as described in
-the Modules chapter .
+the Modules chapter .
The CHANGES file shipped with SWIG in the top level directory
also lists some examples which build the runtime library.
@@ -350,7 +351,7 @@ 1.12.2 Unix installation
-
1.12.3 Macintosh OS X installation
+
1.12.3 Macintosh OS X installation
@@ -370,7 +371,7 @@
1.12.3 Macintosh OS X installationhttp://developer.apple.com/documentation/ReleaseNotes/DeveloperTools/TwoLevelNamespaces.html.
+Understanding Two-Level Namespaces .
@@ -378,7 +379,7 @@ 1.12.3 Macintosh OS X installation
- 1.12.4 Testing
+1.12.4 Testing
@@ -432,7 +433,7 @@
1.12.4 Testing
might take more than an hour to run the test-suite.
-
1.12.5 Examples
+
1.12.5 Examples
diff --git a/Doc/Manual/Preprocessor.html b/Doc/Manual/Preprocessor.html
index 745570ca466..2538f8f18de 100644
--- a/Doc/Manual/Preprocessor.html
+++ b/Doc/Manual/Preprocessor.html
@@ -1,12 +1,13 @@
-
+
SWIG Preprocessor
+
-
8 Preprocessing
+
8 Preprocessing
@@ -37,7 +38,7 @@ 8 Preprocessing
chapter describes some of these modifications.
- 8.1 File inclusion
+8.1 File inclusion
@@ -63,7 +64,7 @@
8.1 File inclusion
is that you often don't want SWIG to try and wrap everything included
in standard header system headers and auxiliary files.
- 8.2 File imports
+8.2 File imports
@@ -92,7 +93,7 @@
8.2 File imports
as imports. This might be useful if you want to extract type definitions from system
header files without generating any wrappers.
- 8.3 Conditional Compilation
+8.3 Conditional Compilation
@@ -120,7 +121,7 @@
8.3 Conditional Compilation
SWIG_JAVASCRIPT_V8 Defined when using Javascript for v8 or node.js
SWIGLUA Defined when using Lua
SWIGMODULA3 Defined when using Modula-3
-SWIGMZSCHEME Defined when using Mzscheme
+SWIGMZSCHEME Defined when using Mzscheme
SWIGOCAML Defined when using Ocaml
SWIGOCTAVE Defined when using Octave
SWIGPERL Defined when using Perl
@@ -129,6 +130,7 @@ 8.3 Conditional Compilation
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
@@ -155,7 +157,7 @@ 8.3 Conditional Compilation
within the SWIG compiler).
- 8.4 Macro Expansion
+8.4 Macro Expansion
@@ -210,7 +212,7 @@
8.4 Macro Expansion
-
8.5 SWIG Macros
+
8.5 SWIG Macros
@@ -256,7 +258,7 @@
8.5 SWIG Macros
support).
-
8.6 C99 and GNU Extensions
+
8.6 C99 and GNU Extensions
@@ -312,14 +314,14 @@
8.6 C99 and GNU Extensions
SWIG directives and are provided to make SWIG more compatible with C99 code.
-
8.7 Preprocessing and delimiters
+
8.7 Preprocessing and delimiters
The preprocessor handles { }, " " and %{ %} delimiters differently.
-
8.7.1 Preprocessing and %{ ... %} & " ... " delimiters
+
8.7.1 Preprocessing and %{ ... %} & " ... " delimiters
@@ -344,7 +346,7 @@
8.7.1 Preprocessing and %{ ... %} & " ...
modification to the output (including all preprocessor directives).
- 8.7.2 Preprocessing and { ... } delimiters
+8.7.2 Preprocessing and { ... } delimiters
@@ -386,7 +388,7 @@
8.7.2 Preprocessing and { ... } delimiters% and leave the preprocessor directive in the code.
- 8.8 Preprocessor and Typemaps
+8.8 Preprocessor and Typemaps
@@ -457,7 +459,7 @@
8.8 Preprocessor and Typemaps<
-
8.9 Viewing preprocessor output
+
8.9 Viewing preprocessor output
@@ -467,7 +469,7 @@
8.9 Viewing preprocessor output
This might be useful as an aid to debugging and viewing the results of macro expansions.
-
8.10 The #error and #warning directives
+
8.10 The #error and #warning directives
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index eb102aa3e13..1dce1806c5a 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -1,12 +1,13 @@
-
+
SWIG and Python
+
-
36 SWIG and Python
+
36 SWIG and Python
@@ -142,7 +149,7 @@
36 SWIG and Python
Basics" chapter.
-
36.1 Overview
+
36.1 Overview
@@ -169,10 +176,10 @@
36.1 Overview
details.
-
36.2 Preliminaries
+
36.2 Preliminaries
-
36.2.1 Running SWIG
+
36.2.1 Running SWIG
@@ -270,13 +277,13 @@
36.2.1 Running SWIG
how you might go about compiling and using the generated files.
-
36.2.2 Using distutils
+
36.2.2 Using distutils
The preferred approach to building an extension module for python is to compile it with
distutils, which comes with all recent versions of python
-(Distutils Docs ).
+(Distutils Docs ).
@@ -362,7 +369,7 @@
36.2.2 Using distutils
can even build extensions to the standard Windows Python using MingGW)
-
36.2.3 Hand compiling a dynamic module
+
36.2.3 Hand compiling a dynamic module
@@ -410,7 +417,7 @@
36.2.3 Hand compiling a dynamic module
-
36.2.4 Static linking
+
36.2.4 Static linking
@@ -455,14 +462,14 @@
36.2.4 Static linking
-$ swig -python example.i
+$ swig -python -lembed.i example.i
$ gcc example.c example_wrap.c \
-Xlinker -export-dynamic \
- -DHAVE_CONFIG_H -I/usr/local/include/python2.1 \
- -I/usr/local/lib/python2.1/config \
- -L/usr/local/lib/python2.1/config -lpython2.1 -lm -ldl \
- -o mypython
-
+ -DHAVE_CONFIG_H -I/usr/include/python2.7 \
+ -I/usr/lib/python2.7/config-x86_64-linux-gnu \
+ -I/usr/lib/python2.7/config \
+ -L/usr/lib/python2.7/config -lpython2.7 -lm -ldl \
+ -o mypython
You will need to supply the same libraries that were used to build Python the first
@@ -483,13 +490,13 @@
36.2.4 Static linking
Compatibility note: The embed.i library file is
-deprecated and has not been maintained for several years. Even though it
-appears to "work" with Python 2.1, no future support is guaranteed.
+deprecated and has not been actively maintained for many years. Even though it
+appears to "work" with Python 2.7, no future support is guaranteed.
If using static linking, you might want to rely on a different approach
(perhaps using distutils).
-
36.2.5 Using your module
+
36.2.5 Using your module
@@ -646,7 +653,7 @@
36.2.5 Using your module
read the man pages).
-
36.2.6 Compilation of C++ extensions
+
36.2.6 Compilation of C++ extensions
@@ -738,7 +745,7 @@
36.2.6 Compilation of C++ extensions
might want to investigate using a more formal standard such as COM.
-
36.2.7 Compiling for 64-bit platforms
+
36.2.7 Compiling for 64-bit platforms
@@ -775,7 +782,7 @@
36.2.7 Compiling for 64-bit platforms
extension.
-
36.2.8 Building Python Extensions under Windows
+
36.2.8 Building Python Extensions under Windows
@@ -904,7 +911,7 @@
36.2.8 Building Python Extensions under Windows
- 36.3 A tour of basic C/C++ wrapping
+36.3 A tour of basic C/C++ wrapping
@@ -913,7 +920,7 @@
36.3 A tour of basic C/C++ wrapping
This section briefly covers the essential aspects of this wrapping.
-
36.3.1 Modules
+
36.3.1 Modules
@@ -926,7 +933,7 @@
36.3.1 Modules
Python command or standard module name.
-
36.3.2 Functions
+
36.3.2 Functions
@@ -950,7 +957,7 @@
36.3.2 Functions
>>>
- 36.3.3 Global variables
+36.3.3 Global variables
@@ -1088,7 +1095,7 @@
36.3.3 Global variables
if there are no global variables in a module.
- 36.3.4 Constants and enums
+36.3.4 Constants and enums
@@ -1128,7 +1135,7 @@
36.3.4 Constants and enums
generate code that prevents this. You will just have to be careful.
- 36.3.5 Pointers
+36.3.5 Pointers
@@ -1269,7 +1276,7 @@
36.3.5 Pointers
None if the conversion can't be performed.
- 36.3.6 Structures
+36.3.6 Structures
@@ -1279,7 +1286,7 @@
36.3.6 Structures
struct Vector {
- double x,y,z;
+ double x,y,z;
};
@@ -1458,7 +1465,7 @@ 36.3.6 Structures
- 36.3.7 C++ classes
+36.3.7 C++ classes
@@ -1547,7 +1554,7 @@
36.3.7 C++ classes
- 36.3.8 C++ inheritance
+36.3.8 C++ inheritance
@@ -1602,7 +1609,7 @@
36.3.8 C++ inheritance
It is safe to use multiple inheritance with SWIG.
- 36.3.9 Pointers, references, values, and arrays
+36.3.9 Pointers, references, values, and arrays
@@ -1663,7 +1670,7 @@
36.3.9 Pointers, references, values, and arrays
- 36.3.10 C++ overloaded functions
+36.3.10 C++ overloaded functions
@@ -1786,7 +1793,7 @@
36.3.10 C++ overloaded functions
Please refer to the "SWIG and C++" chapter for more information about overloading.
- 36.3.11 C++ operators
+36.3.11 C++ operators
@@ -1875,7 +1882,7 @@
36.3.11 C++ operators
overloaded assignment operators don't map to Python semantics and will be ignored.
- 36.3.12 C++ namespaces
+36.3.12 C++ namespaces
@@ -1942,7 +1949,7 @@
36.3.12 C++ namespaces
identical symbol names, well, then you get what you deserve.
- 36.3.13 C++ templates
+36.3.13 C++ templates
@@ -1996,7 +2003,21 @@
36.3.13 C++ templates
examples will appear later.
- 36.3.14 C++ Smart Pointers
+36.3.14 C++ Smart Pointers
+
+
+36.3.14.1 The shared_ptr Smart Pointer
+
+
+
+The C++11 standard provides std::shared_ptr which was derived from the Boost
+implementation, boost::shared_ptr .
+Both of these are available for Python in the SWIG library and usage is outlined
+in the shared_ptr smart pointer library section.
+
+
+
+36.3.14.2 Generic Smart Pointers
@@ -2080,7 +2101,7 @@
36.3.14 C++ Smart Pointers
- 36.3.15 C++ reference counted objects
+36.3.15 C++ reference counted objects
@@ -2089,7 +2110,7 @@
36.3.15 C++ reference counted objects
- 36.4 Further details on the Python class interface
+36.4 Further details on the Python class interface
@@ -2112,7 +2133,7 @@
36.4 Further details on the Python class interface
section.
- 36.4.1 Proxy classes
+36.4.1 Proxy classes
@@ -2169,15 +2190,15 @@
36.4.1 Proxy classes
import _example
class Foo(object):
- def __init__(self):
- self.this = _example.new_Foo()
- self.thisown = 1
- def __del__(self):
- if self.thisown:
- _example.delete_Foo(self.this)
- def spam(self,arg1):
- return _example.Foo_spam(self.this,arg1)
- x = property(_example.Foo_x_get, _example.Foo_x_set)
+ def __init__(self):
+ self.this = _example.new_Foo()
+ self.thisown = 1
+ def __del__(self):
+ if self.thisown:
+ _example.delete_Foo(self.this)
+ def spam(self,arg1):
+ return _example.Foo_spam(self.this,arg1)
+ x = property(_example.Foo_x_get, _example.Foo_x_set)
@@ -2201,7 +2222,7 @@ 36.4.1 Proxy classes
by Python built-in types until Python 2.2).
- 36.4.2 Built-in Types
+36.4.2 Built-in Types
@@ -2219,9 +2240,9 @@
36.4.2 Built-in Types
class Foo(object):
- def __init__(self):
- self.this = _example.new_Foo()
- self.thisown = 1
+ def __init__(self):
+ self.this = _example.new_Foo()
+ self.thisown = 1
@@ -2245,7 +2266,7 @@ 36.4.2 Built-in Types
http://docs.python.org/extending/newtypes.html
- 36.4.2.1 Limitations
+36.4.2.1 Limitations
Use of the -builtin option implies a couple of limitations:
@@ -2313,11 +2334,11 @@
36.4.2.1 Limitations
-class MyPyException (Exception) :
- def __init__(self, msg, *args) :
+class MyPyException(Exception):
+ def __init__(self, msg, *args):
Exception.__init__(self, *args)
self.myexc = MyException(msg)
- def what (self) :
+ def what(self):
return self.myexc.what()
@@ -2413,7 +2434,7 @@ 36.4.2.1 Limitations
- 36.4.2.2 Operator overloads -- use them!
+36.4.2.2 Operator overloads -- use them!
The entire justification for the -builtin option is improved
@@ -2514,7 +2535,7 @@
36.4.2.2 Operator overloads -- use th
- 36.4.3 Memory management
+36.4.3 Memory management
NOTE: Although this section refers to proxy objects, everything here also applies
@@ -2709,7 +2730,7 @@
36.4.3 Memory management
typemaps--an advanced topic discussed later.
- 36.4.4 Python 2.2 and classic classes
+36.4.4 Python 2.2 and classic classes
@@ -2719,7 +2740,7 @@
36.4.4 Python 2.2 and classic classes
This new-style class system offers many enhancements including static
member functions, properties (managed attributes), and class methods.
Details about all of these changes can be found on www.python.org and is not repeated here.
+href="https://www.python.org">www.python.org and is not repeated here.
@@ -2734,7 +2755,7 @@
36.4.4 Python 2.2 and classic classes
This dual-nature of the wrapper code means that you can create extension
modules with SWIG and those modules will work with all versions of Python
-ranging from Python-1.4 to the very latest release. Moreover, the wrappers take
+ranging from Python-2.0 to the very latest release. Moreover, the wrappers take
advantage of Python-2.2 features when available.
@@ -2746,7 +2767,7 @@ 36.4.4 Python 2.2 and classic classes
function or through an instance (see the earlier section).
- 36.5 Cross language polymorphism
+36.5 Cross language polymorphism
@@ -2780,7 +2801,7 @@
36.5 Cross language polymorphism
all the cross-language method routing transparently.
- 36.5.1 Enabling directors
+36.5.1 Enabling directors
@@ -2841,6 +2862,7 @@
36.5.1 Enabling directors
class Foo {
public:
Foo(int foo);
+ virtual ~Foo();
virtual void one();
virtual void two();
};
@@ -2861,16 +2883,17 @@ 36.5.1 Enabling directors
import mymodule
class MyFoo(mymodule.Foo):
- def __init__(self, foo):
- mymodule.Foo(self, foo)
+ def __init__(self, foo):
+ mymodule.Foo.__init__(self, foo)
+# super().__init__(foo) # Alternative construction for Python3
- def one(self):
- print "one from python"
+ def one(self):
+ print "one from python"
- 36.5.2 Director classes
+36.5.2 Director classes
@@ -2952,7 +2975,7 @@ 36.5.2 Director classes
calls through Python.
- 36.5.3 Ownership and object destruction
+36.5.3 Ownership and object destruction
@@ -3019,7 +3042,7 @@
36.5.3 Ownership and object destruction
references to the Foo objects remain in Python.
- 36.5.4 Exception unrolling
+36.5.4 Exception unrolling
@@ -3078,7 +3101,7 @@
36.5.4 Exception unrolling
exception as soon as the C wrapper function returns.
- 36.5.5 Overhead and code bloat
+36.5.5 Overhead and code bloat
@@ -3112,7 +3135,7 @@
36.5.5 Overhead and code bloat
Python.
- 36.5.6 Typemaps
+36.5.6 Typemaps
@@ -3126,7 +3149,7 @@
36.5.6 Typemaps
- 36.5.7 Miscellaneous
+36.5.7 Miscellaneous
@@ -3173,7 +3196,7 @@
36.5.7 Miscellaneous
- 36.6 Common customization features
+36.6 Common customization features
@@ -3186,7 +3209,7 @@
36.6 Common customization features
improve your the interface to an extension module.
- 36.6.1 C/C++ helper functions
+36.6.1 C/C++ helper functions
@@ -3267,7 +3290,7 @@
36.6.1 C/C++ helper functions
customization features as covered in later sections.
- 36.6.2 Adding additional Python code
+36.6.2 Adding additional Python code
@@ -3380,6 +3403,18 @@
36.6.2 Adding additional Python code
an error for invalid preprocessor directives, so you may have to update
existing interface files to delimit blocks of Python code correctly.
+As an alternative to providing a block containing Python code, you can
+include python code from a file. The code is inserted exactly as in the
+file, so this avoids any issues with the SWIG preprocessor. It's a good
+approach if you have a non-trivial chunk of Python code to insert. To
+use this feature you specify a filename in double quotes, for example:
+
+
+
+%pythoncode "somecode.py"
+
+
+
Sometimes you may want to replace or modify the wrapper function
that SWIG creates in the proxy .py file. The Python module
in SWIG provides some features that enable you to do this. First, to
@@ -3402,7 +3437,7 @@
36.6.2 Adding additional Python code
class Foo {
public:
int bar(int x);
-}
+};
@@ -3439,7 +3474,7 @@ 36.6.2 Adding additional Python code
class Foo {
public:
int bar(int x);
-}
+};
@@ -3468,7 +3503,7 @@ 36.6.2 Adding additional Python code
class Foo {
public:
int bar(int x);
-}
+};
@@ -3498,7 +3533,7 @@ 36.6.2 Adding additional Python code
public:
int bar(int x);
int bar();
-}
+};
@@ -3507,7 +3542,7 @@ 36.6.2 Adding additional Python code
- 36.6.3 Class extension with %extend
+36.6.3 Class extension with %extend
@@ -3596,7 +3631,7 @@
36.6.3 Class extension with %extend
in any way---the extensions only show up in the Python interface.
- 36.6.4 Exception handling with %exception
+36.6.4 Exception handling with %exception
@@ -3722,7 +3757,7 @@
36.6.4 Exception handling with %exception
to raise exceptions. See the SWIG Library chapter.
- 36.7 Tips and techniques
+36.7 Tips and techniques
@@ -3732,7 +3767,7 @@
36.7 Tips and techniques
solving these problems.
- 36.7.1 Input and output parameters
+36.7.1 Input and output parameters
@@ -3945,7 +3980,7 @@
36.7.1 Input and output parameters
may not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar .
- 36.7.2 Simple pointers
+36.7.2 Simple pointers
@@ -4014,7 +4049,7 @@
36.7.2 Simple pointers
See the SWIG Library chapter for further details.
- 36.7.3 Unbounded C Arrays
+36.7.3 Unbounded C Arrays
@@ -4076,7 +4111,7 @@
36.7.3 Unbounded C Arrays
package binary data, etc.
- 36.7.4 String handling
+36.7.4 String handling
@@ -4145,7 +4180,107 @@
36.7.4 String handling
also be used to extra binary data from arbitrary pointers.
- 36.8 Typemaps
+
+36.7.5 Default arguments
+
+
+
+C++ default argument code generation is documented in the main
+Default arguments section.
+There is also an optional Python specific feature that can be used called the python:cdefaultargs
+feature flag .
+By default, SWIG attempts to convert C++ default argument values
+into Python values and generates code into the Python layer containing these values.
+For example:
+
+
+
+
+struct CDA {
+ int fff(int a = 1, bool b = false);
+};
+
+
+
+
+From Python this can be called as follows:
+
+
+
+
+>>> CDA().fff() # C++ layer receives a=1 and b=false
+>>> CDA().fff(2) # C++ layer receives a=2 and b=false
+>>> CDA().fff(3, True) # C++ layer receives a=3 and b=true
+
+
+
+
+The default code generation in the Python layer is:
+
+
+
+
+class CDA(object):
+ ...
+ def fff(self, a=1, b=False):
+ return _default_args.CDA_fff(self, a, b)
+
+
+
+
+Adding the feature:
+
+
+
+
+%feature("python:cdefaultargs") CDA::fff;
+struct CDA {
+ int fff(int a = 1, bool b = false);
+
+
+
+
+results in identical behaviour when called from Python, however, it results in different code generation:
+
+
+
+
+class CDA(object):
+ ...
+ def fff(self, *args):
+ return _default_args.CDA_fff(self, *args)
+
+
+
+
+The default arguments are obtained in the C++ wrapper layer instead of the Python layer.
+Some code generation modes are quite different, eg -builtin and -fastproxy ,
+and are unaffected by python:cdefaultargs as the default values are always obtained from the C++ layer.
+
+
+
+Note that not all default arguments can be converted into a Python equivalent.
+When SWIG does not convert them, it will generate code to obtain them from the C++ layer as if
+python:cdefaultargs was specified.
+This will happen if just one argument cannot be converted into a Python equivalent.
+This occurs typically when the argument is not fully numeric, such as int(1) :
+
+
+
+
+struct CDA {
+ int fff(int a = int(1), bool b = false);
+};
+
+
+
+
+Compatibility Note: SWIG-3.0.6 introduced the python:cdefaultargs feature.
+Versions of SWIG prior to this varied in their ability to convert C++ default values into
+equivalent Python default argument values.
+
+
+36.8 Typemaps
@@ -4162,7 +4297,7 @@
36.8 Typemaps
C-Python interface or if you want to elevate your guru status.
- 36.8.1 What is a typemap?
+36.8.1 What is a typemap?
@@ -4175,8 +4310,8 @@
36.8.1 What is a typemap?
%module example
%typemap(in) int {
- $1 = (int) PyLong_AsLong($input);
- printf("Received an integer : %d\n",$1);
+ $1 = (int) PyLong_AsLong($input);
+ printf("Received an integer : %d\n",$1);
}
%inline %{
extern int fact(int n);
@@ -4213,11 +4348,11 @@ 36.8.1 What is a typemap?
%module example
%typemap(in) int nonnegative {
- $1 = (int) PyLong_AsLong($input);
- if ($1 < 0) {
- PyErr_SetString(PyExc_ValueError,"Expected a nonnegative value.");
- return NULL;
- }
+ $1 = (int) PyLong_AsLong($input);
+ if ($1 < 0) {
+ PyErr_SetString(PyExc_ValueError,"Expected a nonnegative value.");
+ return NULL;
+ }
}
%inline %{
extern int fact(int nonnegative);
@@ -4239,8 +4374,8 @@ 36.8.1 What is a typemap?
%typemap(in) int n {
- $1 = (int) PyLong_AsLong($input);
- printf("n = %d\n",$1);
+ $1 = (int) PyLong_AsLong($input);
+ printf("n = %d\n",$1);
}
%inline %{
typedef int Integer;
@@ -4278,7 +4413,7 @@ 36.8.1 What is a typemap?
- 36.8.2 Python typemaps
+36.8.2 Python typemaps
@@ -4319,7 +4454,7 @@
36.8.2 Python typemaps
- 36.8.3 Typemap variables
+36.8.3 Typemap variables
@@ -4390,7 +4525,7 @@
36.8.3 Typemap variables
The Python name of the wrapper function being created.
- 36.8.4 Useful Python Functions
+36.8.4 Useful Python Functions
@@ -4518,7 +4653,7 @@
36.8.4 Useful Python Functions
- 36.9 Typemap Examples
+36.9 Typemap Examples
@@ -4527,7 +4662,7 @@
36.9 Typemap Examples
the SWIG library.
- 36.9.1 Converting Python list to a char **
+36.9.1 Converting Python list to a char **
@@ -4550,11 +4685,11 @@
36.9.1 Converting Python list to a char **
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem($input,i);
if (PyString_Check(o))
- $1[i] = PyString_AsString(PyList_GetItem($input,i));
+ $1[i] = PyString_AsString(PyList_GetItem($input,i));
else {
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
- free($1);
- return NULL;
+ PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ free($1);
+ return NULL;
}
}
$1[i] = 0;
@@ -4607,7 +4742,7 @@ 36.9.1 Converting Python list to a char **
the C function.
- 36.9.2 Expanding a Python object into multiple arguments
+36.9.2 Expanding a Python object into multiple arguments
@@ -4649,11 +4784,11 @@
36.9.2 Expanding a Python object into multiple arg
for (i = 0; i < $1; i++) {
PyObject *o = PyList_GetItem($input,i);
if (PyString_Check(o))
- $2[i] = PyString_AsString(PyList_GetItem($input,i));
+ $2[i] = PyString_AsString(PyList_GetItem($input,i));
else {
- PyErr_SetString(PyExc_TypeError,"list must contain strings");
- free($2);
- return NULL;
+ PyErr_SetString(PyExc_TypeError,"list must contain strings");
+ free($2);
+ return NULL;
}
}
$2[i] = 0;
@@ -4686,7 +4821,7 @@ 36.9.2 Expanding a Python object into multiple arg
- 36.9.3 Using typemaps to return arguments
+36.9.3 Using typemaps to return arguments
@@ -4697,10 +4832,10 @@
36.9.3 Using typemaps to return arguments
/* Returns a status value and two values in out1 and out2 */
int spam(double a, double b, double *out1, double *out2) {
- ... Do a bunch of stuff ...
- *out1 = result1;
- *out2 = result2;
- return status;
+ ... Do a bunch of stuff ...
+ *out1 = result1;
+ *out2 = result2;
+ return status;
}
@@ -4774,7 +4909,7 @@ 36.9.3 Using typemaps to return arguments
>>>
- 36.9.4 Mapping Python tuples into small arrays
+36.9.4 Mapping Python tuples into small arrays
@@ -4823,7 +4958,7 @@
36.9.4 Mapping Python tuples into small arrays
- 36.9.5 Mapping sequences to C arrays
+36.9.5 Mapping sequences to C arrays
@@ -4912,7 +5047,7 @@
36.9.5 Mapping sequences to C arrays
- 36.9.6 Pointer handling
+36.9.6 Pointer handling
@@ -5009,7 +5144,7 @@
36.9.6 Pointer handling
- 36.10 Docstring Features
+36.10 Docstring Features
@@ -5037,7 +5172,7 @@
36.10 Docstring Features
- 36.10.1 Module docstring
+36.10.1 Module docstring
@@ -5071,7 +5206,7 @@
36.10.1 Module docstring
- 36.10.2 %feature("autodoc")
+36.10.2 %feature("autodoc")
@@ -5099,7 +5234,7 @@
36.10.2 %feature("autodoc")
feature, %feature("autodoc", "level ") .
The four values for level are covered in the following sub-sections.
- 36.10.2.1 %feature("autodoc", "0")
+36.10.2.1 %feature("autodoc", "0")
@@ -5128,7 +5263,7 @@
36.10.2.1 %feature("autodoc", "0")
- 36.10.2.2 %feature("autodoc", "1")
+36.10.2.2 %feature("autodoc", "1")
@@ -5153,13 +5288,13 @@
36.10.2.2 %feature("autodoc", "1")
- 36.10.2.3 %feature("autodoc", "2")
+36.10.2.3 %feature("autodoc", "2")
Level "2" results in the function prototype as per level "0". In addition, a line of
-documentation is generated for each parameter. Using the previous example, the generated
-code will be:
+documentation is generated for each parameter using numpydoc style.
+Using the previous example, the generated code will be:
@@ -5168,11 +5303,12 @@
36.10.2.3 %feature("autodoc", "2")
"""
function_name(x, y, foo=None, bar=None) -> bool
- Parameters:
- x: int
- y: int
- foo: Foo *
- bar: Bar *
+ Parameters
+ ----------
+ x: int
+ y: int
+ foo: Foo *
+ bar: Bar *
"""
...
@@ -5203,17 +5339,18 @@
36.10.2.3 %feature("autodoc", "2")
"""
function_name(x, y, foo=None, bar=None) -> bool
- Parameters:
- x (C++ type: int) -- Input x dimension
- y: int
- foo: Foo *
- bar: Bar *
+ Parameters
+ ----------
+ x (C++ type: int) -- Input x dimension
+ y: int
+ foo: Foo *
+ bar: Bar *
"""
- 36.10.2.4 %feature("autodoc", "3")
+36.10.2.4 %feature("autodoc", "3")
@@ -5226,11 +5363,12 @@
36.10.2.4 %feature("autodoc", "3")
"""
function_name(int x, int y, Foo foo=None, Bar bar=None) -> bool
- Parameters:
- x: int
- y: int
- foo: Foo *
- bar: Bar *
+ Parameters
+ ----------
+ x: int
+ y: int
+ foo: Foo *
+ bar: Bar *
"""
...
@@ -5238,7 +5376,7 @@ 36.10.2.4 %feature("autodoc", "3")
- 36.10.2.5 %feature("autodoc", "docstring")
+36.10.2.5 %feature("autodoc", "docstring")
@@ -5257,7 +5395,7 @@
36.10.2.5 %feature("autodoc", "docstring")
- 36.10.3 %feature("docstring")
+36.10.3 %feature("docstring")
@@ -5289,7 +5427,7 @@
36.10.3 %feature("docstring")
- 36.11 Python Packages
+36.11 Python Packages
Python has concepts of modules and packages. Modules are separate units of
@@ -5347,7 +5485,7 @@
36.11 Python Packages
%module directive or import related command line options. These are
explained in the following sections.
- 36.11.1 Setting the Python package
+36.11.1 Setting the Python package
@@ -5401,7 +5539,7 @@
36.11.1 Setting the Python package
- 36.11.2 Absolute and relative imports
+36.11.2 Absolute and relative imports
Suppose, we have the following hierarchy of files:
@@ -5540,7 +5678,7 @@ 36.11.2 Absolute and relative imports __init__.py to import symbols from submodules or subpackages and the
submodule depends on other submodules (discussed later).
- 36.11.3 Enforcing absolute import semantics
+36.11.3 Enforcing absolute import semantics
As you may know, there is an incompatibility in import semantics (for the
@@ -5554,7 +5692,7 @@
36.11.3 Enforcing absolute import semantics
refers to a top-level module or to another module inside the current
package. In Python 3 it always refers to a top-level module
-(see PEP 328 ).
+(see PEP 328 ).
To instruct Python 2.5 through 2.7 to use new semantics (that is import
foo is interpreted as absolute import), one has to put the following
line
@@ -5577,7 +5715,7 @@
36.11.3 Enforcing absolute import semantics
- 36.11.4 Importing from __init__.py
+36.11.4 Importing from __init__.py
Imports in __init__.py are handy when you want to populate a
@@ -5688,7 +5826,7 @@
36.11.4 Importing from __init__.py
workaround).
- 36.12 Python 3 Support
+36.12 Python 3 Support
@@ -5715,7 +5853,7 @@
36.12 Python 3 Support
SWIG.
- 36.12.1 Function annotation
+36.12.1 Function annotation
@@ -5745,10 +5883,10 @@
36.12.1 Function annotation
For detailed usage of function annotation, see
-PEP 3107 .
+PEP 3107 .
- 36.12.2 Buffer interface
+36.12.2 Buffer interface
@@ -5900,7 +6038,7 @@
36.12.2 Buffer interface
- 36.12.3 Abstract base classes
+36.12.3 Abstract base classes
@@ -5938,10 +6076,10 @@
36.12.3 Abstract base classes
For details of abstract base class, please see
-PEP 3119 .
+PEP 3119 .
- 36.12.4 Byte string output conversion
+36.12.4 Byte string output conversion
@@ -6024,7 +6162,157 @@
36.12.4 Byte string output conversion
For more details about the surrogateescape error handler, please see
-PEP 383 .
+PEP 383 .
+
+
+
+In some cases, users may wish to instead handle all byte strings as bytes
+objects in Python 3. This can be accomplished by adding
+SWIG_PYTHON_STRICT_BYTE_CHAR to the generated code:
+
+
+
+%module char_to_bytes
+%begin %{
+#define SWIG_PYTHON_STRICT_BYTE_CHAR
+%}
+
+char *charstring(char *s) {
+ return s;
+}
+
+
+
+This will modify the behavior so that only Python 3 bytes objects will be
+accepted and converted to a C/C++ string, and any string returned from C/C++
+will be converted to a bytes object in Python 3:
+
+
+
+>>> from char_to_bytes import *
+>>> charstring(b"hi") # Byte string
+b'hi'
+>>> charstring("hi") # Unicode string
+Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+TypeError: in method 'charstring', argument 1 of type 'char *'
+
+
+
+Note that in Python 2, defining SWIG_PYTHON_STRICT_BYTE_CHAR has no
+effect, since strings in Python 2 are equivalent to Python 3 bytes objects.
+However, there is a similar capability to force unicode-only handling for
+wide characters C/C++ strings (wchar_t * or std::wstring
+types) in Python 2. By default, in Python 2 both strings and unicode strings
+are converted to C/C++ wide strings, and returned wide strings are converted
+to a Python unicode string. To instead only convert unicode strings to wide
+strings, users can add SWIG_PYTHON_STRICT_UNICODE_WCHAR to the
+generated code:
+
+
+
+%module wchar_to_unicode
+%begin %{
+#define SWIG_PYTHON_STRICT_UNICODE_WCHAR
+%}
+
+wchar_t *wcharstring(wchar_t *s) {
+ return s;
+}
+
+
+
+This ensures that only unicode strings are accepted by wcharstring in both
+Python 2 and Python 3:
+
+
+
+>>> from wchar_to_unicode import *
+>>> wcharstring(u"hi") # Unicode string
+u'hi'
+>>> wcharstring(b"hi") # Byte string
+Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+TypeError: in method 'charstring', argument 1 of type 'wchar_t *'
+
+
+
+By defining both SWIG_PYTHON_STRICT_BYTE_CHAR and
+SWIG_PYTHON_STRICT_UNICODE_WCHAR , Python wrapper code can support
+overloads taking both std::string (as Python bytes) and std::wstring
+(as Python unicode).
+
+
+36.12.5 Python 2 Unicode
+
+
+
+A Python 3 string is a Unicode string so by default a Python 3 string that contains Unicode
+characters passed to C/C++ will be accepted and converted to a C/C++ string
+(char * or std::string types).
+A Python 2 string is not a unicode string by default and should a Unicode string be
+passed to C/C++ it will fail to convert to a C/C++ string
+(char * or std::string types).
+The Python 2 behavior can be made more like Python 3 by defining
+SWIG_PYTHON_2_UNICODE when compiling the generated C/C++ code.
+By default when the following is wrapped:
+
+
+
+%module unicode_strings
+char *charstring(char *s) {
+ return s;
+}
+
+
+
+An error will occur when using Unicode strings in Python 2:
+
+
+
+>>> from unicode_strings import *
+>>> charstring("hi")
+'hi'
+>>> charstring(u"hi")
+Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+TypeError: in method 'charstring', argument 1 of type 'char *'
+
+
+
+When the SWIG_PYTHON_2_UNICODE macro is added to the generated code:
+
+
+
+%module unicode_strings
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
+
+char *charstring(char *s) {
+ return s;
+}
+
+
+
+Unicode strings will be successfully accepted and converted from UTF-8,
+but note that they are returned as a normal Python 2 string:
+
+
+
+>>> from unicode_strings import *
+>>> charstring("hi")
+'hi'
+>>> charstring(u"hi")
+'hi'
+>>>
+
+
+
+Note that defining both SWIG_PYTHON_2_UNICODE and
+SWIG_PYTHON_STRICT_BYTE_CHAR at the same time is not allowed, since
+the first is allowing unicode conversion and the second is explicitly
+prohibiting it.
diff --git a/Doc/Manual/R.html b/Doc/Manual/R.html
index 5de390eab7c..9b5993bff0b 100644
--- a/Doc/Manual/R.html
+++ b/Doc/Manual/R.html
@@ -1,12 +1,13 @@
-
+
SWIG and R
+
- 37 SWIG and R
+37 SWIG and R
@@ -33,7 +34,7 @@ 37 SWIG and R
with gcc. The R bindings also work on Microsoft Windows using Visual C++.
- 37.1 Bugs
+37.1 Bugs
@@ -45,7 +46,7 @@
37.1 Bugs
C Array wrappings
-
37.2 Using R and SWIG
+
37.2 Using R and SWIG
@@ -119,7 +120,24 @@
37.2 Using R and SWIG
These two files can be loaded in any order
-
37.3 Precompiling large R files
+
+ If you are compiling code yourself (not using R itself), there are a few things to watch out for:
+
+
+
+The output shared library name (to the left of the file extension) MUST match the module name, or alternatively, you can also set the -package NAME command line argument. See swig -r -help for more information
+ If you do not set the output file name appropriately, you might see errors like
+
+
+> fact(4)
+Error in .Call("R_swig_fact", s_arg1, as.logical(.copy), PACKAGE = "example") :
+ "R_swig_fact" not available for .Call() for package "example"
+
+
+ Make sure the architecture of the shared library(x64 for instance), matches the architecture of the R program you want to load your shared library into
+
+
+
37.3 Precompiling large R files
In cases where the R file is large, one make save a lot of loading
@@ -137,7 +155,7 @@
37.3 Precompiling large R files
-
37.4 General policy
+
37.4 General policy
@@ -146,7 +164,7 @@
37.4 General policy
to provide R syntax.
-
37.5 Language conventions
+
37.5 Language conventions
@@ -155,7 +173,7 @@
37.5 Language conventions
slices)
-
37.6 C++ classes
+
37.6 C++ classes
@@ -167,7 +185,7 @@
37.6 C++ classes
of the proxy class baggage you see in other languages.
-
37.7 Enumerations
+
37.7 Enumerations
diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html
index e78447b92c1..cfb99e792b8 100644
--- a/Doc/Manual/Ruby.html
+++ b/Doc/Manual/Ruby.html
@@ -1,13 +1,14 @@
-
+
-
SWIG and Ruby
-
+
SWIG and Ruby
+
+
-
38 SWIG and Ruby
+
38 SWIG and Ruby
@@ -42,6 +43,10 @@ 38 SWIG and Ruby
C++ STL Functors
C++ STL Iterators
C++ Smart Pointers
+
Cross-Language Polymorphism
Exception Unrolling
@@ -144,7 +149,7 @@ 38 SWIG and Ruby
This chapter describes SWIG's support of Ruby.
- 38.1 Preliminaries
+38.1 Preliminaries
SWIG 3.0 is known to work with Ruby versions 1.8 and later.
@@ -159,7 +164,7 @@
38.1 Preliminaries
chapter. It is also assumed that the reader has a basic understanding
of Ruby.
- 38.1.1 Running SWIG
+38.1.1 Running SWIG
To build a Ruby module, run SWIG using the -ruby
@@ -183,7 +188,7 @@
38.1.1 Running SWIG
build a Ruby extension module. To finish building the module, you need
to compile this file and link it with the rest of your program.
- 38.1.2 Getting the right header files
+38.1.2 Getting the right header files
In order to compile the wrapper code, the compiler needs the ruby.h
@@ -212,7 +217,7 @@
38.1.2 Getting the right header files
-
38.1.3 Compiling a dynamic module
+
38.1.3 Compiling a dynamic module
Ruby extension modules are typically compiled into shared
@@ -285,7 +290,7 @@
38.1.3 Compiling a dynamic module
of options. You might also check the
SWIG Wiki
for additional information.
-
38.1.4 Using your module
+
38.1.4 Using your module
Ruby module names must be capitalized,
@@ -315,7 +320,7 @@
38.1.4 Using your module
will result in an extension module using the feature name
"example" and Ruby module name "Example".
-
38.1.5 Static linking
+
38.1.5 Static linking
An alternative approach to dynamic linking is to rebuild the
@@ -330,7 +335,7 @@
38.1.5 Static linking
file, adding your directory to the list of extensions in the file, and
finally rebuilding Ruby.
-
38.1.6 Compilation of C++ extensions
+
38.1.6 Compilation of C++ extensions
On most machines, C++ extension modules should be linked
@@ -362,7 +367,7 @@
38.1.6 Compilation of C++ extensions
create_makefile('example')
- 38.2 Building Ruby Extensions under Windows 95/NT
+38.2 Building Ruby Extensions under Windows 95/NT
Building a SWIG extension to Ruby under Windows 95/NT is
@@ -387,7 +392,7 @@
38.2 Building Ruby Extensions under Windows 95/NT
- 38.2.1 Running SWIG from Developer Studio
+38.2.1 Running SWIG from Developer Studio
If you are developing your application within Microsoft
@@ -451,13 +456,13 @@
38.2.1 Running SWIG from Developer Studio
- 38.3 The Ruby-to-C/C++ Mapping
+38.3 The Ruby-to-C/C++ Mapping
This section describes the basics of how SWIG maps C or C++
declarations in your SWIG interface files to Ruby constructs.
- 38.3.1 Modules
+38.3.1 Modules
The SWIG %module directive specifies
@@ -529,7 +534,7 @@
38.3.1 Modules
names of your constants, classes and methods don't conflict with any of
Ruby's built-in names.
- 38.3.2 Functions
+38.3.2 Functions
Global functions are wrapped as Ruby module methods. For
@@ -563,7 +568,7 @@
38.3.2 Functions
24
- 38.3.3 Variable Linking
+38.3.3 Variable Linking
C/C++ global variables are wrapped as a pair of singleton
@@ -625,7 +630,7 @@
38.3.3 Variable Linking
effect until it is explicitly disabled using %mutable .
- 38.3.4 Constants
+38.3.4 Constants
C/C++ constants are wrapped as module constants initialized
@@ -653,7 +658,7 @@
38.3.4 Constants
3.14159
- 38.3.5 Pointers
+38.3.5 Pointers
"Opaque" pointers to arbitrary C/C++ types (i.e. types that
@@ -677,7 +682,7 @@
38.3.5 Pointers
A NULL pointer is always represented by
the Ruby nil object.
- 38.3.6 Structures
+38.3.6 Structures
C/C++ structs are wrapped as Ruby classes, with accessor
@@ -782,7 +787,7 @@
38.3.6 Structures
}
- 38.3.7 C++ classes
+38.3.7 C++ classes
Like structs, C++ classes are wrapped by creating a new Ruby
@@ -837,7 +842,7 @@
38.3.7 C++ classes
3
- 38.3.8 C++ Inheritance
+38.3.8 C++ Inheritance
The SWIG type-checker is fully aware of C++ inheritance.
@@ -990,7 +995,7 @@
38.3.8 C++ Inheritance
(i.e. they exhibit "Duck
Typing" ).
- 38.3.9 C++ Overloaded Functions
+38.3.9 C++ Overloaded Functions
C++ overloaded functions, methods, and constructors are
@@ -1080,7 +1085,7 @@
38.3.9 C++ Overloaded Functions
Please refer to the "SWIG
and C++" chapter for more information about overloading.
- 38.3.10 C++ Operators
+38.3.10 C++ Operators
For the most part, overloaded operators are handled
@@ -1122,7 +1127,7 @@
38.3.10 C++ Operators
is discussed in the section
on operator overloading .
- 38.3.11 C++ namespaces
+38.3.11 C++ namespaces
SWIG is aware of C++ namespaces, but namespace names do not
@@ -1179,7 +1184,7 @@
38.3.11 C++ namespaces
program utilizes thousands of small deeply nested namespaces each with
identical symbol names, well, then you get what you deserve.
- 38.3.12 C++ templates
+38.3.12 C++ templates
C++ templates don't present a huge problem for SWIG. However,
@@ -1221,7 +1226,7 @@
38.3.12 C++ templates
4
- 38.3.13 C++ Standard Template Library (STL)
+38.3.13 C++ Standard Template Library (STL)
On a related note, the standard SWIG library contains a
@@ -1314,7 +1319,7 @@
38.3.13 C++ Standard Template Library (STL)
shown in these examples. More details can be found in the SWIG and C++
chapter.
- 38.3.14 C++ STL Functors
+38.3.14 C++ STL Functors
Some containers in the STL allow you to modify their default
@@ -1347,7 +1352,7 @@
38.3.14 C++ STL Functors
%include <std_set.i>
-%typemap(IntSet) std::set< int, swig::BinaryPredicate >;
+%template(IntSet) std::set< int, swig::BinaryPredicate >;
You can then use the set from Ruby with or without a proc
@@ -1375,7 +1380,7 @@
38.3.14 C++ STL Functors
- 38.3.15 C++ STL Iterators
+38.3.15 C++ STL Iterators
The STL is well known for the use of iterators. There
@@ -1458,7 +1463,21 @@
38.3.15 C++ STL Iterators
If you'd rather have STL classes without any iterators, you should define -DSWIG_NO_EXPORT_ITERATOR_METHODS when running swig.
- 38.3.16 C++ Smart Pointers
+38.3.16 C++ Smart Pointers
+
+
+38.3.16.1 The shared_ptr Smart Pointer
+
+
+
+The C++11 standard provides std::shared_ptr which was derived from the Boost
+implementation, boost::shared_ptr .
+Both of these are available for Ruby in the SWIG library and usage is outlined
+in the shared_ptr smart pointer library section.
+
+
+
+38.3.16.2 Generic Smart Pointers
In certain C++ programs, it is common to use classes that
@@ -1523,7 +1542,7 @@
38.3.16 C++ Smart Pointers
irb(main):004:0> f = p.__deref__() # Returns underlying Foo *
- 38.3.17 Cross-Language Polymorphism
+38.3.17 Cross-Language Polymorphism
SWIG's Ruby module supports cross-language polymorphism
@@ -1532,7 +1551,7 @@
38.3.17 Cross-Language Polymorphism
section just notes the differences that you need to be aware of when
using this feature with Ruby.
- 38.3.17.1 Exception Unrolling
+38.3.17.1 Exception Unrolling
Whenever a C++ director class routes one of its virtual
@@ -1555,7 +1574,7 @@
38.3.17.1 Exception Unrolling
function from Ruby's C API. If any Ruby exception is raised, it will be
caught here and a C++ exception is raised in its place.
- 38.4 Naming
+38.4 Naming
Ruby has several common naming conventions. Constants are
@@ -1593,7 +1612,7 @@
38.4 Naming
by SWIG, it is turned off by default in SWIG 1.3.28. However, it is
planned to become the default option in future releases.
- 38.4.1 Defining Aliases
+38.4.1 Defining Aliases
It's a fairly common practice in the Ruby built-ins and
@@ -1663,7 +1682,7 @@
38.4.1 Defining Aliases
on "Customization
Features" ) for more details).
- 38.4.2 Predicate Methods
+38.4.2 Predicate Methods
Ruby methods that return a boolean value and end in a
@@ -1712,7 +1731,7 @@
38.4.2 Predicate Methods
used for other kinds of features apply (see the chapter on "Customization
Features" ) for more details).
- 38.4.3 Bang Methods
+38.4.3 Bang Methods
Ruby methods that modify an object in-place and end in an
@@ -1744,7 +1763,7 @@
38.4.3 Bang Methods
used for other kinds of features apply (see the chapter on "Customization
Features" ) for more details).
- 38.4.4 Getters and Setters
+38.4.4 Getters and Setters
Often times a C++ library will expose properties through
@@ -1779,7 +1798,7 @@
38.4.4 Getters and Setters
%rename("value=") Foo::setValue(int value);
- 38.5 Input and output parameters
+38.5 Input and output parameters
A common problem in some C programs is handling parameters
@@ -1918,10 +1937,10 @@
38.5 Input and output parameters
r, c = Example.get_dimensions(m)
- 38.6 Exception handling
+38.6 Exception handling
- 38.6.1 Using the %exception directive
+38.6.1 Using the %exception directive
The SWIG %exception directive can be
@@ -2030,7 +2049,7 @@
38.6.1 Using the %exception directive
limited to C++ exception handling. See the chapter on Customization
Features for more examples.
- 38.6.2 Handling Ruby Blocks
+38.6.2 Handling Ruby Blocks
One of the highlights of Ruby and most of its standard library
@@ -2097,7 +2116,7 @@
38.6.2 Handling Ruby Blocks
For more information on typemaps, see Typemaps .
- 38.6.3 Raising exceptions
+38.6.3 Raising exceptions
There are three ways to raise exceptions from C++ code to
@@ -2254,7 +2273,7 @@
38.6.3 Raising exceptions
is the exception type. You can raise a custom exception type or one of
the built-in Ruby exception types.
- 38.6.4 Exception classes
+38.6.4 Exception classes
Starting with SWIG 1.3.28, the Ruby module supports the %exceptionclass
@@ -2291,7 +2310,7 @@
38.6.4 Exception classes
For another example look at swig/Examples/ruby/exception_class.
- 38.7 Typemaps
+38.7 Typemaps
This section describes how you can modify SWIG's default
@@ -2306,7 +2325,7 @@
38.7 Typemaps
in most cases. Typemaps are only used if you want to change some aspect
of the primitive C-Ruby interface.
- 38.7.1 What is a typemap?
+38.7.1 What is a typemap?
A typemap is nothing more than a code generation rule that is
@@ -2463,7 +2482,7 @@
38.7.1 What is a typemap?
2
- 38.7.2 Typemap scope
+38.7.2 Typemap scope
Once defined, a typemap remains in effect for all of the
@@ -2509,7 +2528,7 @@
38.7.2 Typemap scope
};
- 38.7.3 Copying a typemap
+38.7.3 Copying a typemap
A typemap is copied by using assignment. For example:
@@ -2551,7 +2570,7 @@ 38.7.3 Copying a typemap
%apply (char *buf, int len) { (char *buffer, int size) }; // Multiple arguments
- 38.7.4 Deleting a typemap
+38.7.4 Deleting a typemap
A typemap can be deleted by simply defining no code. For
@@ -2576,7 +2595,7 @@
38.7.4 Deleting a typemap
will make that type unusable unless you also define a new set of
typemaps immediately after the clear operation.
- 38.7.5 Placement of typemaps
+38.7.5 Placement of typemaps
Typemap declarations can be declared in the global scope,
@@ -2647,13 +2666,13 @@
38.7.5 Placement of typemaps
string
.
- 38.7.6 Ruby typemaps
+38.7.6 Ruby typemaps
The following list details all of the typemap methods that
can be used by the Ruby module:
- 38.7.6.1 "in" typemap
+38.7.6.1 "in" typemap
Converts Ruby objects to input
@@ -2720,7 +2739,7 @@
38.7.6.1 "in" typemap
At this time, only zero or one arguments may be converted.
- 38.7.6.2 "typecheck" typemap
+38.7.6.2 "typecheck" typemap
The "typecheck" typemap is used to support overloaded
@@ -2742,7 +2761,7 @@
38.7.6.2 "typecheck" typemap
"typecheck" typemaps. More details about this follow in a later section
on "Typemaps and Overloading."
- 38.7.6.3 "out" typemap
+38.7.6.3 "out" typemap
Converts return value of a C function
@@ -2793,7 +2812,7 @@
38.7.6.3 "out" typemap
- 38.7.6.4 "arginit" typemap
+38.7.6.4 "arginit" typemap
The "arginit" typemap is used to set the initial value of a
@@ -2808,7 +2827,7 @@
38.7.6.4 "arginit" typemap
}
-
38.7.6.5 "default" typemap
+
38.7.6.5 "default" typemap
The "default" typemap is used to turn an argument into a
@@ -2833,7 +2852,7 @@
38.7.6.5 "default" typemap
Default/optional arguments section for further information on
default argument wrapping.
-
38.7.6.6 "check" typemap
+
38.7.6.6 "check" typemap
The "check" typemap is used to supply value checking code
@@ -2848,7 +2867,7 @@
38.7.6.6 "check" typemap
}
- 38.7.6.7 "argout" typemap
+38.7.6.7 "argout" typemap
The "argout" typemap is used to return values from arguments.
@@ -2902,7 +2921,7 @@
38.7.6.7 "argout" typemap
See the typemaps.i library for examples.
- 38.7.6.8 "freearg" typemap
+38.7.6.8 "freearg" typemap
The "freearg" typemap is used to cleanup argument data. It is
@@ -2929,7 +2948,7 @@
38.7.6.8 "freearg" typemap
that may be used in other typemaps whenever a wrapper function needs to
abort prematurely.
- 38.7.6.9 "newfree" typemap
+38.7.6.9 "newfree" typemap
The "newfree" typemap is used in conjunction with the %newobject
@@ -2953,7 +2972,7 @@
38.7.6.9 "newfree" typemap
See Object
ownership and %newobject for further details.
- 38.7.6.10 "memberin" typemap
+38.7.6.10 "memberin" typemap
The "memberin" typemap is used to copy data from an
@@ -2971,21 +2990,21 @@ 38.7.6.10 "memberin" typemap
already provides a default implementation for arrays, strings, and
other objects.
- 38.7.6.11 "varin" typemap
+38.7.6.11 "varin" typemap
The "varin" typemap is used to convert objects in the target
language to C for the purposes of assigning to a C/C++ global variable.
This is implementation specific.
- 38.7.6.12 "varout" typemap
+38.7.6.12 "varout" typemap
The "varout" typemap is used to convert a C/C++ object to an
object in the target language when reading a C/C++ global variable.
This is implementation specific.
- 38.7.6.13 "throws" typemap
+38.7.6.13 "throws" typemap
The "throws" typemap is only used when SWIG parses a C++
@@ -3026,7 +3045,7 @@
38.7.6.13 "throws" typemap
deal with them. For a neat way to handle these, see the Exception
handling with %exception section.
- 38.7.6.14 directorin typemap
+38.7.6.14 directorin typemap
Converts C++ objects in director
@@ -3085,7 +3104,7 @@
38.7.6.14 directorin typemap
- 38.7.6.15 directorout typemap
+38.7.6.15 directorout typemap
Converts Ruby objects in director
@@ -3158,7 +3177,7 @@
38.7.6.15 directorout typemap
- 38.7.6.16 directorargout typemap
+38.7.6.16 directorargout typemap
Output argument processing in director
@@ -3216,19 +3235,19 @@
38.7.6.16 directorargout typemap
- 38.7.6.17 ret typemap
+38.7.6.17 ret typemap
Cleanup of function return values
- 38.7.6.18 globalin typemap
+38.7.6.18 globalin typemap
Setting of C global variables
- 38.7.7 Typemap variables
+38.7.7 Typemap variables
@@ -3278,7 +3297,7 @@
38.7.7 Typemap variables
The Ruby name of the wrapper function
being created.
- 38.7.8 Useful Functions
+38.7.8 Useful Functions
When you write a typemap, you usually have to work directly
@@ -3293,7 +3312,7 @@
38.7.8 Useful Functions
That should help you avoid having to rewrite a lot of typemaps
across multiple languages.
- 38.7.8.1 C Datatypes to Ruby Objects
+38.7.8.1 C Datatypes to Ruby Objects
@@ -3335,7 +3354,7 @@
38.7.8.1 C Datatypes to Ruby Objects
- 38.7.8.2 Ruby Objects to C Datatypes
+38.7.8.2 Ruby Objects to C Datatypes
Here, while the Ruby versions return the value directly, the SWIG
@@ -3403,7 +3422,7 @@
38.7.8.2 Ruby Objects to C Datatypes
- 38.7.8.3 Macros for VALUE
+38.7.8.3 Macros for VALUE
RSTRING_LEN(str)
@@ -3426,7 +3445,7 @@ 38.7.8.3 Macros for VALUE
pointer to array storage
- 38.7.8.4 Exceptions
+38.7.8.4 Exceptions
void rb_raise(VALUE exception, const char *fmt,
@@ -3505,7 +3524,7 @@ 38.7.8.4 Exceptions
flag. The given format string fmt and remaining
arguments are interpreted as with printf() .
- 38.7.8.5 Iterators
+38.7.8.5 Iterators
void rb_iter_break()
@@ -3551,14 +3570,14 @@ 38.7.8.5 Iterators
Equivalent to Ruby's throw .
- 38.7.9 Typemap Examples
+38.7.9 Typemap Examples
This section includes a few examples of typemaps. For more
examples, you might look at the examples in the Example/ruby
directory.
- 38.7.10 Converting a Ruby array to a char **
+38.7.10 Converting a Ruby array to a char **
A common problem in many C programs is the processing of
@@ -3623,7 +3642,7 @@
38.7.10 Converting a Ruby array to a char **
the array, the "freearg" typemap is used to later release this memory
after the execution of the C function.
- 38.7.11 Collecting arguments in a hash
+38.7.11 Collecting arguments in a hash
Ruby's solution to the "keyword arguments" capability of some
@@ -3837,7 +3856,7 @@
38.7.11 Collecting arguments in a hash
program that uses the extension, can be found in the Examples/ruby/hashargs
directory of the SWIG distribution.
- 38.7.12 Pointer handling
+38.7.12 Pointer handling
Occasionally, it might be necessary to convert pointer values
@@ -3896,7 +3915,7 @@
38.7.12 Pointer handling
}
- 38.7.12.1 Ruby Datatype Wrapping
+38.7.12.1 Ruby Datatype Wrapping
VALUE Data_Wrap_Struct(VALUE class, void
@@ -3923,7 +3942,7 @@ 38.7.12.1 Ruby Datatype Wrapping
type c-type from the data object obj
and assigns that pointer to ptr .
- 38.7.13 Example: STL Vector to Ruby Array
+38.7.13 Example: STL Vector to Ruby Array
Another use for macros and type maps is to create a Ruby array
@@ -4015,7 +4034,7 @@
38.7.13 Example: STL Vector to Ruby Array
which does much more than this. Refer to the section called
the C++ Standard Template Library .
- 38.8 Docstring Features
+38.8 Docstring Features
@@ -4049,7 +4068,7 @@
38.8 Docstring Features
$ rdoc -r file_wrap.c
- 38.8.1 Module docstring
+38.8.1 Module docstring
@@ -4079,7 +4098,7 @@
38.8.1 Module docstring
%module(docstring=DOCSTRING) xrc
- 38.8.2 %feature("autodoc")
+38.8.2 %feature("autodoc")
Since SWIG does know everything about the function it wraps,
@@ -4100,7 +4119,7 @@
38.8.2 %feature("autodoc")
feature, described below.
- 38.8.2.1 %feature("autodoc", "0")
+38.8.2.1 %feature("autodoc", "0")
@@ -4124,7 +4143,7 @@
38.8.2.1 %feature("autodoc", "0")
...
- 38.8.2.2 %feature("autodoc", "1")
+38.8.2.2 %feature("autodoc", "1")
@@ -4144,7 +4163,7 @@
38.8.2.2 %feature("autodoc", "1")
...
- 38.8.2.3 %feature("autodoc", "2")
+38.8.2.3 %feature("autodoc", "2")
@@ -4156,7 +4175,7 @@
38.8.2.3 %feature("autodoc", "2")
this:
- 38.8.2.4 %feature("autodoc", "3")
+38.8.2.4 %feature("autodoc", "3")
@@ -4171,13 +4190,13 @@
38.8.2.4 %feature("autodoc", "3")
function_name(int x, int y, Foo foo=nil, Bar bar=nil) -> bool
Parameters:
- x - int
- y - int
- foo - Foo
- bar - Bar
+ x - int
+ y - int
+ foo - Foo
+ bar - Bar
- 38.8.2.5 %feature("autodoc", "docstring")
+38.8.2.5 %feature("autodoc", "docstring")
@@ -4193,7 +4212,7 @@
38.8.2.5 %feature("autodoc", "docstring")
void GetPosition(int* OUTPUT, int* OUTPUT);
- 38.8.3 %feature("docstring")
+38.8.3 %feature("docstring")
@@ -4204,10 +4223,10 @@
38.8.3 %feature("docstring")
If an item already has an autodoc string then it is combined with the
docstring and they are output together.
- 38.9 Advanced Topics
+38.9 Advanced Topics
- 38.9.1 Operator overloading
+38.9.1 Operator overloading
SWIG allows operator overloading with, by using the %extend
@@ -4388,7 +4407,7 @@
38.9.1 Operator overloading
parses the expression a != b as !(a == b) .
- 38.9.2 Creating Multi-Module Packages
+38.9.2 Creating Multi-Module Packages
The chapter on Working
@@ -4514,7 +4533,7 @@ 38.9.2 Creating Multi-Module Packages
5.0
- 38.9.3 Specifying Mixin Modules
+38.9.3 Specifying Mixin Modules
The Ruby language doesn't support multiple inheritance, but
@@ -4581,7 +4600,7 @@
38.9.3 Specifying Mixin Modules
on "Customization
Features" ) for more details).
- 38.10 Memory Management
+38.10 Memory Management
One of the most common issues in generating SWIG bindings for
@@ -4604,7 +4623,7 @@
38.10 Memory Management
invoked. Clearly, developing a SWIG wrapper requires a thorough
understanding of how the underlying library manages memory.
- 38.10.1 Mark and Sweep Garbage Collector
+38.10.1 Mark and Sweep Garbage Collector
Ruby uses a mark and sweep garbage collector. When the garbage
@@ -4618,8 +4637,7 @@
38.10.1 Mark and Sweep Garbage Collector
reference other objects. This process will continue until all active
objects have been "marked." After the mark phase comes the sweep phase.
In the sweep phase, all objects that have not been marked will be
-garbage collected. For more information about the Ruby garbage
-collector please refer to http://rubygarden.org/ruby/ruby?GCAndExtensions .
+garbage collected.
The Ruby C/API provides extension developers two hooks into
the garbage collector - a "mark" function and a "sweep" function. By
@@ -4636,7 +4654,7 @@
38.10.1 Mark and Sweep Garbage Collector
C++ struct, then a "free" function must be defined that deallocates
this memory.
- 38.10.2 Object Ownership
+38.10.2 Object Ownership
As described above, memory management depends on clearly
@@ -4781,7 +4799,7 @@
38.10.2 Object Ownership
This code can be seen in swig/examples/ruby/tracking.
- 38.10.3 Object Tracking
+38.10.3 Object Tracking
The remaining parts of this section will use the class library
@@ -4818,7 +4836,7 @@
38.10.3 Object Tracking
class Zoo
{
protected:
- std::vector<animal *=""> animals;
+ std::vector<Animal *> animals;
public:
// Construct an empty zoo
@@ -4941,7 +4959,8 @@ 38.10.3 Object Tracking
/* Tell SWIG that create_animal creates a new object */
%newobject Zoo::create_animal;
-/* Tell SWIG to keep track of mappings between C/C++ structs/classes. */ %trackobjects;
+/* Tell SWIG to keep track of mappings between C/C++ structs/classes. */
+%trackobjects;
%include "example.h"
@@ -5006,7 +5025,7 @@ 38.10.3 Object Tracking
also have to call the SWIG_RubyRemoveTracking and RubyUnlinkObjects
methods.
- 38.10.4 Mark Functions
+38.10.4 Mark Functions
With a bit more testing, we see that our class library still
@@ -5101,7 +5120,7 @@
38.10.4 Mark Functions
Note the mark function is dependent on
the SWIG_RUBY_InstanceFor method, and thus
requires that %trackobjects is enabled. For more
-information, please refer to the track_object.i test case in the SWIG
+information, please refer to the ruby_track_objects.i test case in the SWIG
test suite.
When this code is compiled we now see:
@@ -5135,7 +5154,7 @@ 38.10.4 Mark Functions
This code can be seen in swig/examples/ruby/mark_function.
- 38.10.5 Free Functions
+38.10.5 Free Functions
By default, SWIG creates a "free" function that is called when
@@ -5168,21 +5187,23 @@
38.10.5 Free Functions
To show how to use the %freefunc
directive, let's slightly change our example. Assume that the zoo
-object is responsible for freeing animal that it contains. This means
+object is responsible for freeing any animal that it contains. This means
that the Zoo::add_animal
function should be marked with a DISOWN typemap
and the destructor should be updated as below:
-
Zoo::~Zoo() {
- IterType iter = this->animals.begin();
- IterType end = this->animals.end();
-
- for(iter; iter != end; ++iter) {
- Animal* animal = *iter;
- delete animal;
- }
-}
+
+Zoo::~Zoo() {
+ IterType iter = this->animals.begin();
+ IterType end = this->animals.end();
+
+ for(iter; iter != end; ++iter) {
+ Animal* animal = *iter;
+ delete animal;
+ }
+}
+
When we use these objects in IRB we see:
@@ -5230,8 +5251,7 @@ 38.10.5 Free Functions
#include "example.h"
%}
-/* Specify that ownership is transferred to the zoo
- when calling add_animal */
+/* Specify that ownership is transferred to the zoo when calling add_animal */
%apply SWIGTYPE *DISOWN { Animal* animal };
/* Track objects */
@@ -5302,7 +5322,7 @@ 38.10.5 Free Functions
This code can be seen in swig/examples/ruby/free_function.
- 38.10.6 Embedded Ruby and the C++ Stack
+38.10.6 Embedded Ruby and the C++ Stack
As has been said, the Ruby GC runs and marks objects before
diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html
index 4c33aeab8f2..178247e4218 100644
--- a/Doc/Manual/SWIG.html
+++ b/Doc/Manual/SWIG.html
@@ -1,12 +1,13 @@
-
+
SWIG Basics
+
- 5 SWIG Basics
+5 SWIG Basics
Pointers and complex objects
@@ -40,7 +41,7 @@ 5 SWIG Basics
Passing structures by value
Return by value
Linking to structure variables
-Linking to char *
+Linking to char *
Arrays
Creating read-only variables
Renaming and ignoring declarations
@@ -94,7 +95,7 @@ 5 SWIG Basics
chapters.
- 5.1 Running SWIG
+5.1 Running SWIG
@@ -110,7 +111,7 @@
5.1 Running SWIG
Below is a subset of options that can be used.
Additional options are also defined for each target language. A full list
can be obtained by typing swig -help or swig
--lang -help .
+-<lang> -help for language <lang> specific options.
@@ -119,26 +120,31 @@ 5.1 Running SWIG
-clisp Generate CLISP wrappers
-cffi Generate CFFI wrappers
-csharp Generate C# wrappers
+-d Generate D wrappers
-go Generate Go wrappers
-guile Generate Guile wrappers
-java Generate Java wrappers
+-javascript Generate Javascript wrappers
-lua Generate Lua wrappers
-modula3 Generate Modula 3 wrappers
-mzscheme Generate Mzscheme wrappers
-ocaml Generate Ocaml wrappers
+-octave Generate Octave wrappers
-perl Generate Perl wrappers
-php Generate PHP wrappers
-pike Generate Pike wrappers
-python Generate Python wrappers
-r Generate R (aka GNU S) wrappers
-ruby Generate Ruby wrappers
+-scilab Generate Scilab wrappers
-sexp Generate Lisp S-Expressions wrappers
-tcl Generate Tcl wrappers
-uffi Generate Common Lisp / UFFI wrappers
-xml Generate XML wrappers
-c++ Enable C++ parsing
--cppext ext Change file extension of C++ generated files to ext (default is cxx, except for PHP which uses cpp)
+-cppext ext Change file extension of C++ generated files to ext
+ (default is cxx, except for PHP which uses cpp)
-Dsymbol Define a preprocessor symbol
-Fstandard Display error/warning messages in commonly used format
-Fmicrosoft Display error/warning messages in Microsoft format
@@ -146,7 +152,8 @@ 5.1 Running SWIG
-Idir Add a directory to the file include path
-lfile Include a SWIG library file.
-module name Set the name of the SWIG module
--o outfile Name of output file
+-o outfile Set name of C/C++ output file to <outfile>
+-oh headfile Set name of C++ output header file for directors to <headfile>
-outcurrentdir Set default output dir to current dir instead of input file's path
-outdir dir Set language specific files output directory
-pcreversion Display PCRE version information
@@ -155,7 +162,7 @@ 5.1 Running SWIG
- 5.1.1 Input format
+5.1.1 Input format
@@ -202,7 +209,7 @@
5.1.1 Input format
used in input files to parser generation tools such as yacc or bison.
- 5.1.2 SWIG Output
+5.1.2 SWIG Output
@@ -212,7 +219,7 @@
5.1.2 SWIG Output
with the name file.i is transformed into a file
file_wrap.c or file_wrap.cxx (depending on whether
or not the -c++ option has been used). The name of the
-output file can be changed using the -o option. In certain
+output C/C++ file can be changed using the -o option. In certain
cases, file suffixes are used by the compiler to determine the source
language (C, C++, etc.). Therefore, you have to use the
-o option to change the suffix of the SWIG-generated wrapper
@@ -262,7 +269,7 @@ 5.1.2 SWIG Output
generated C/C++ file if not overridden with -outdir .
- 5.1.3 Comments
+5.1.3 Comments
@@ -272,7 +279,7 @@
5.1.3 Comments
and will reappear in a later SWIG release.
- 5.1.4 C Preprocessor
+5.1.4 C Preprocessor
@@ -296,7 +303,7 @@
5.1.4 C Preprocessor
extensions are described in the "Preprocessor " chapter.
- 5.1.5 SWIG Directives
+5.1.5 SWIG Directives
@@ -327,7 +334,7 @@
5.1.5 SWIG Directives
it is parsing an input file.
- 5.1.6 Parser Limitations
+5.1.6 Parser Limitations
@@ -425,7 +432,7 @@
5.1.6 Parser Limitations
described on p. 234 of K&R).
- 5.2 Wrapping Simple C Declarations
+5.2 Wrapping Simple C Declarations
@@ -488,7 +495,7 @@
5.2 Wrapping Simple C Declarations
next few sections describe various aspects of this mapping.
- 5.2.1 Basic Type Handling
+5.2.1 Basic Type Handling
@@ -613,7 +620,7 @@
5.2.1 Basic Type Handling
You may need to write some special conversion functions.
- 5.2.2 Global Variables
+5.2.2 Global Variables
@@ -668,7 +675,7 @@
5.2.2 Global Variables
constants instead.
- 5.2.3 Constants
+5.2.3 Constants
@@ -757,7 +764,7 @@
5.2.3 Constants
interface that are not defined in the original header file.
- 5.2.4 A brief word about const
+5.2.4 A brief word about const
@@ -859,7 +866,7 @@
5.2.4 A brief word about const
- 5.2.5 A cautionary tale of char *
+5.2.5 A cautionary tale of char *
@@ -898,7 +905,7 @@
5.2.5 A cautionary tale of char *
using typemaps .
- 5.3 Pointers and complex objects
+5.3 Pointers and complex objects
@@ -906,7 +913,7 @@
5.3 Pointers and complex objects
discusses the handling of these datatypes.
- 5.3.1 Simple pointers
+5.3.1 Simple pointers
@@ -972,7 +979,7 @@
5.3.1 Simple pointers
- 5.3.2 Run time pointer type checking
+5.3.2 Run time pointer type checking
@@ -994,7 +1001,7 @@
5.3.2 Run time pointer type checking
SWIG leaves NULL pointer checking up to the application.
- 5.3.3 Derived types, structs, and classes
+5.3.3 Derived types, structs, and classes
@@ -1035,15 +1042,14 @@
5.3.3 Derived types, structs, and classes
# Copy a file
def filecopy(source,target):
- f1 = fopen(source,"r")
- f2 = fopen(target,"w")
- buffer = malloc(8192)
- nbytes = fread(buffer,8192,1,f1)
- while (nbytes > 0):
- fwrite(buffer,8192,1,f2)
- nbytes = fread(buffer,8192,1,f1)
- free(buffer)
-
+ f1 = fopen(source,"r")
+ f2 = fopen(target,"w")
+ buffer = malloc(8192)
+ nbytes = fread(buffer,8192,1,f1)
+ while (nbytes > 0):
+ fwrite(buffer,8192,1,f2)
+ nbytes = fread(buffer,8192,1,f1)
+ free(buffer)
@@ -1051,7 +1057,7 @@
5.3.3 Derived types, structs, and classes
opaque objects containing C pointers. It doesn't matter what value
they contain--our program works just fine without this knowledge.
- 5.3.4 Undefined datatypes
+5.3.4 Undefined datatypes
@@ -1111,7 +1117,7 @@
5.3.4 Undefined datatypes
- 5.3.5 Typedef
+5.3.5 Typedef
@@ -1200,7 +1206,7 @@
5.3.5 Typedef
type unsigned int * or size_t * .
- 5.4 Other Practicalities
+5.4 Other Practicalities
@@ -1210,7 +1216,7 @@
5.4 Other Practicalities
some of these issues.
- 5.4.1 Passing structures by value
+5.4.1 Passing structures by value
@@ -1241,7 +1247,7 @@
5.4.1 Passing structures by value
is transparent so you might not notice.
- 5.4.2 Return by value
+5.4.2 Return by value
@@ -1296,7 +1302,7 @@
5.4.2 Return by value
constructor. The section on SWIG and C++ has more information about this case.
- 5.4.3 Linking to structure variables
+5.4.3 Linking to structure variables
@@ -1313,10 +1319,10 @@
5.4.3 Linking to structure variables
Vector *unit_i_get() {
- return &unit_i;
+ return &unit_i;
}
void unit_i_set(Vector *value) {
- unit_i = *value;
+ unit_i = *value;
}
@@ -1328,7 +1334,7 @@ 5.4.3 Linking to structure variables
assignment to work correctly.
- 5.4.4 Linking to char *
+5.4.4 Linking to char *
@@ -1457,7 +1463,7 @@
5.4.4 Linking to char *
- 5.4.5 Arrays
+5.4.5 Arrays
@@ -1593,7 +1599,7 @@
5.4.5 Arrays
In the target language, the value can be set like a normal variable.
- 5.4.6 Creating read-only variables
+5.4.6 Creating read-only variables
@@ -1603,11 +1609,11 @@
5.4.6 Creating read-only variables
// File : interface.i
-int a; // Can read/write
+int a; // Can read/write
%immutable;
-int b,c,d // Read only variables
+int b,c,d; // Read only variables
%mutable;
-double x,y // read/write
+double x,y; // read/write
@@ -1667,10 +1673,10 @@
5.4.6 Creating read-only variables %mutable; to silence the warning. Don't forget the extra semicolon!
- 5.4.7 Renaming and ignoring declarations
+5.4.7 Renaming and ignoring declarations
- 5.4.7.1 Simple renaming of specific identifiers
+5.4.7.1 Simple renaming of specific identifiers
@@ -1768,7 +1774,7 @@
5.4.7.1 Simple renaming of specific identifiers
directive is more powerful and better supports wrapping of raw header file information.
- 5.4.7.2 Advanced renaming support
+5.4.7.2 Advanced renaming support
@@ -1970,7 +1976,7 @@
5.4.7.2 Advanced renaming support
multiple declarations using the previously described matching possibilities.
- 5.4.7.3 Limiting global renaming rules
+5.4.7.3 Limiting global renaming rules
@@ -2068,7 +2074,7 @@
5.4.7.3 Limiting global renaming rules<
- 5.4.7.4 Ignoring everything then wrapping a few selected symbols
+5.4.7.4 Ignoring everything then wrapping a few selected symbols
@@ -2110,7 +2116,7 @@
5.4.7.4 Ignoring everything then wrapping
- 5.4.8 Default/optional arguments
+5.4.8 Default/optional arguments
@@ -2127,8 +2133,8 @@
5.4.8 Default/optional arguments
used in Tcl as follows :
-% plot -3.4 7.5 # Use default value
-% plot -3.4 7.5 10 # set color to 10 instead
+% plot -3.4 7.5 # Use default value
+% plot -3.4 7.5 10 # set color to 10 instead
@@ -2147,7 +2153,7 @@ 5.4.8 Default/optional arguments
in the C++ chapter for further details.
- 5.4.9 Pointers to functions and callbacks
+5.4.9 Pointers to functions and callbacks
@@ -2300,7 +2306,7 @@
5.4.9 Pointers to functions and callbacks
and individual target language chapters for more on callbacks and the 'director' feature.
- 5.5 Structures and unions
+5.5 Structures and unions
@@ -2318,7 +2324,7 @@
5.5 Structures and unions
struct Vector {
- double x,y,z;
+ double x,y,z;
}
@@ -2328,22 +2334,22 @@ 5.5 Structures and unions
double Vector_x_get(struct Vector *obj) {
- return obj->x;
+ return obj->x;
}
double Vector_y_get(struct Vector *obj) {
- return obj->y;
+ return obj->y;
}
double Vector_z_get(struct Vector *obj) {
- return obj->z;
+ return obj->z;
}
void Vector_x_set(struct Vector *obj, double value) {
- obj->x = value;
+ obj->x = value;
}
void Vector_y_set(struct Vector *obj, double value) {
- obj->y = value;
+ obj->y = value;
}
void Vector_z_set(struct Vector *obj, double value) {
- obj->z = value;
+ obj->z = value;
}
@@ -2382,7 +2388,7 @@ 5.5 Structures and unions
However, most of SWIG's language modules also provide a high-level interface that is more convenient. Keep reading.
- 5.5.1 Typedef and structures
+5.5.1 Typedef and structures
@@ -2391,7 +2397,7 @@
5.5.1 Typedef and structures
typedef struct {
- double x,y,z;
+ double x,y,z;
} Vector;
@@ -2406,7 +2412,7 @@ 5.5.1 Typedef and structures
double Vector_x_get(Vector *obj) {
- return obj->x;
+ return obj->x;
}
@@ -2416,7 +2422,7 @@ 5.5.1 Typedef and structures
typedef struct vector_struct {
- double x,y,z;
+ double x,y,z;
} Vector;
@@ -2428,7 +2434,7 @@ 5.5.1 Typedef and structures
Vector and it generates the appropriate type-checking code.
- 5.5.2 Character strings and structures
+5.5.2 Character strings and structures
@@ -2442,8 +2448,8 @@
5.5.2 Character strings and structures
%module mymodule
...
struct Foo {
- char *name;
- ...
+ char *name;
+ ...
}
@@ -2453,14 +2459,15 @@ 5.5.2 Character strings and structures
char *Foo_name_get(Foo *obj) {
- return Foo->name;
+ return Foo->name;
}
char *Foo_name_set(Foo *obj, char *c) {
- if (obj->name) free(obj->name);
- obj->name = (char *) malloc(strlen(c)+1);
- strcpy(obj->name,c);
- return obj->name;
+ if (obj->name)
+ free(obj->name);
+ obj->name = (char *) malloc(strlen(c)+1);
+ strcpy(obj->name,c);
+ return obj->name;
}
@@ -2475,7 +2482,7 @@ 5.5.2 Character strings and structures
perform memory allocation.
- 5.5.3 Array members
+5.5.3 Array members
@@ -2497,7 +2504,7 @@
5.5.3 Array members
harmless.
- 5.5.4 Structure data members
+5.5.4 Structure data members
@@ -2603,7 +2610,7 @@
5.5.4 Structure data members
datatype is really a struct, simply use a forward struct declaration such as "struct Foo;" .
- 5.5.5 C constructors and destructors
+5.5.5 C constructors and destructors
@@ -2692,7 +2699,7 @@
5.5.5 C constructors and destructors
- 5.5.6 Adding member functions to C structures
+5.5.6 Adding member functions to C structures
@@ -2712,7 +2719,7 @@
5.5.6 Adding member functions to
/* file : vector.h */
...
typedef struct Vector {
- double x,y,z;
+ double x,y,z;
} Vector;
@@ -2730,23 +2737,23 @@ 5.5.6 Adding member functions to
%include "vector.h" // Just grab original C header file
%extend Vector { // Attach these functions to struct Vector
- Vector(double x, double y, double z) {
- Vector *v;
- v = (Vector *) malloc(sizeof(Vector));
- v->x = x;
- v->y = y;
- v->z = z;
- return v;
- }
- ~Vector() {
- free($self);
- }
- double magnitude() {
- return sqrt($self->x*$self->x+$self->y*$self->y+$self->z*$self->z);
- }
- void print() {
- printf("Vector [%g, %g, %g]\n", $self->x,$self->y,$self->z);
- }
+ Vector(double x, double y, double z) {
+ Vector *v;
+ v = (Vector *) malloc(sizeof(Vector));
+ v->x = x;
+ v->y = y;
+ v->z = z;
+ return v;
+ }
+ ~Vector() {
+ free($self);
+ }
+ double magnitude() {
+ return sqrt($self->x*$self->x+$self->y*$self->y+$self->z*$self->z);
+ }
+ void print() {
+ printf("Vector [%g, %g, %g]\n", $self->x,$self->y,$self->z);
+ }
};
@@ -2785,12 +2792,12 @@ 5.5.6 Adding member functions to
%}
typedef struct Vector {
- double x,y,z;
- %extend {
- Vector(double x, double y, double z) { ... }
- ~Vector() { ... }
- ...
- }
+ double x,y,z;
+ %extend {
+ Vector(double x, double y, double z) { ... }
+ ~Vector() { ... }
+ ...
+ }
} Vector;
@@ -2804,19 +2811,19 @@ 5.5.6 Adding member functions to
/* Vector methods */
#include "vector.h"
Vector *new_Vector(double x, double y, double z) {
- Vector *v;
- v = (Vector *) malloc(sizeof(Vector));
- v->x = x;
- v->y = y;
- v->z = z;
- return v;
+ Vector *v;
+ v = (Vector *) malloc(sizeof(Vector));
+ v->x = x;
+ v->y = y;
+ v->z = z;
+ return v;
}
void delete_Vector(Vector *v) {
- free(v);
+ free(v);
}
double Vector_magnitude(Vector *v) {
- return sqrt(v->x*v->x+v->y*v->y+v->z*v->z);
+ return sqrt(v->x*v->x+v->y*v->y+v->z*v->z);
}
// File : vector.i
@@ -2827,13 +2834,13 @@ 5.5.6 Adding member functions to
%}
typedef struct Vector {
- double x,y,z;
- %extend {
- Vector(int,int,int); // This calls new_Vector()
- ~Vector(); // This calls delete_Vector()
- double magnitude(); // This will call Vector_magnitude()
- ...
- }
+ double x,y,z;
+ %extend {
+ Vector(int,int,int); // This calls new_Vector()
+ ~Vector(); // This calls delete_Vector()
+ double magnitude(); // This will call Vector_magnitude()
+ ...
+ }
} Vector;
@@ -2845,13 +2852,13 @@ 5.5.6 Adding member functions to
typedef struct Integer {
- int value;
+ int value;
} Int;
%extend Integer { ... } /* Correct name */
%extend Int { ... } /* Incorrect name */
struct Float {
- float value;
+ float value;
};
typedef struct Float FloatValue;
%extend Float { ... } /* Correct name */
@@ -2864,7 +2871,7 @@ 5.5.6 Adding member functions to
typedef struct {
- double value;
+ double value;
} Double;
%extend Double { ... } /* Okay */
@@ -2965,7 +2972,7 @@ 5.5.6 Adding member functions to
directive name has been chosen.
- 5.5.7 Nested structures
+5.5.7 Nested structures
@@ -2973,13 +2980,13 @@
5.5.7 Nested structures
typedef struct Object {
- int objtype;
- union {
- int ivalue;
- double dvalue;
- char *strvalue;
- void *ptrvalue;
- } intRep;
+ int objtype;
+ union {
+ int ivalue;
+ double dvalue;
+ char *strvalue;
+ void *ptrvalue;
+ } intRep;
} Object;
@@ -2991,15 +2998,15 @@ 5.5.7 Nested structures
typedef union {
- int ivalue;
- double dvalue;
- char *strvalue;
- void *ptrvalue;
+ int ivalue;
+ double dvalue;
+ char *strvalue;
+ void *ptrvalue;
} Object_intRep;
typedef struct Object {
- int objType;
- Object_intRep intRep;
+ int objType;
+ Object_intRep intRep;
} Object;
@@ -3011,16 +3018,16 @@ 5.5.7 Nested structures
Object_intRep *Object_intRep_get(Object *o) {
- return (Object_intRep *) &o->intRep;
+ return (Object_intRep *) &o->intRep;
}
int Object_intRep_ivalue_get(Object_intRep *o) {
- return o->ivalue;
+ return o->ivalue;
}
int Object_intRep_ivalue_set(Object_intRep *o, int value) {
- return (o->ivalue = value);
+ return (o->ivalue = value);
}
double Object_intRep_dvalue_get(Object_intRep *o) {
- return o->dvalue;
+ return o->dvalue;
}
... etc ...
@@ -3049,7 +3056,7 @@ 5.5.7 Nested structures
see Nested classes .
- 5.5.8 Other things to note about structure wrapping
+5.5.8 Other things to note about structure wrapping
@@ -3111,7 +3118,7 @@
5.5.8 Other things to note about structure wrapping<
some way or another.
- 5.6 Code Insertion
+5.6 Code Insertion
@@ -3121,7 +3128,7 @@
5.6 Code Insertion
There are four common ways to insert code, but it's useful to know how the
output of SWIG is structured first.
- 5.6.1 The output of SWIG
+5.6.1 The output of SWIG
@@ -3157,7 +3164,7 @@
5.6.1 The output of SWIG
- 5.6.2 Code insertion blocks
+5.6.2 Code insertion blocks
@@ -3227,7 +3234,7 @@
5.6.2 Code insertion blocks
%{
/* Create a new vector */
static Vector *new_Vector() {
- return (Vector *) malloc(sizeof(Vector));
+ return (Vector *) malloc(sizeof(Vector));
}
%}
@@ -3235,7 +3242,7 @@ 5.6.2 Code insertion blocks
Vector *new_Vector();
- 5.6.3 Inlined code blocks
+5.6.3 Inlined code blocks
@@ -3247,7 +3254,7 @@
5.6.3 Inlined code blocks
%inline %{
/* Create a new vector */
Vector *new_Vector() {
- return (Vector *) malloc(sizeof(Vector));
+ return (Vector *) malloc(sizeof(Vector));
}
%}
@@ -3262,7 +3269,7 @@ 5.6.3 Inlined code blocks
is given to both the C compiler and SWIG, it is illegal to include any
SWIG directives inside a %{ ... %} block.
- 5.6.4 Initialization blocks
+5.6.4 Initialization blocks
@@ -3273,11 +3280,11 @@
5.6.4 Initialization blocks
%init %{
- init_variables();
+ init_variables();
%}
- 5.7 An Interface Building Strategy
+5.7 An Interface Building Strategy
@@ -3285,7 +3292,7 @@
5.7 An Interface Building Strategy
with SWIG. The specifics related to a particular scripting language
are found in later chapters.
- 5.7.1 Preparing a C program for SWIG
+5.7.1 Preparing a C program for SWIG
@@ -3339,7 +3346,7 @@
5.7.1 Preparing a C program for SWIG
SWIG bug tracker .
- 5.7.2 The SWIG interface file
+5.7.2 The SWIG interface file
@@ -3392,7 +3399,7 @@
5.7.2 The SWIG interface file
In more complex projects, an interface file containing numerous %include and #include statements like this is one of the most common approaches to interface file design due to lower maintenance overhead.
- 5.7.3 Why use separate interface files?
+5.7.3 Why use separate interface files?
@@ -3421,7 +3428,7 @@
5.7.3 Why use separate interface files?
header files.
- 5.7.4 Getting the right header files
+5.7.4 Getting the right header files
@@ -3441,7 +3448,7 @@
5.7.4 Getting the right header files
...
- 5.7.5 What to do with main()
+5.7.5 What to do with main()
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html
index 62c0e8d1e04..73b242fa37d 100644
--- a/Doc/Manual/SWIGPlus.html
+++ b/Doc/Manual/SWIGPlus.html
@@ -1,12 +1,13 @@
-
+
SWIG and C++
+
- 6 SWIG and C++
+6 SWIG and C++
@@ -75,7 +76,7 @@ 6 SWIG and C++
wrapping and that material will be useful in understanding this chapter.
- 6.1 Comments on C++ Wrapping
+6.1 Comments on C++ Wrapping
@@ -117,7 +118,7 @@
6.1 Comments on C++ Wrapping
yourself in the foot. You will just have to be careful.
- 6.2 Approach
+6.2 Approach
@@ -158,7 +159,7 @@
6.2 Approach
for each target language.
- 6.3 Supported C++ features
+6.3 Supported C++ features
@@ -197,7 +198,7 @@
6.3 Supported C++ features
good way to get problems fixed (wink).
- 6.4 Command line options and compilation
+6.4 Command line options and compilation
@@ -231,7 +232,7 @@
6.4 Command line options and compilation
The -noproxy commandline option is recognised by many target languages and will generate just this
interface as in earlier versions.
- 6.5 Proxy classes
+6.5 Proxy classes
@@ -243,7 +244,7 @@
6.5 Proxy classes
C++ class is wrapped by a Java proxy class.
- 6.5.1 Construction of proxy classes
+6.5.1 Construction of proxy classes
@@ -325,7 +326,7 @@
6.5.1 Construction of proxy classes
might include operator overloading, exception handling, and other features.
- 6.5.2 Resource management in proxies
+6.5.2 Resource management in proxies
@@ -479,7 +480,7 @@
6.5.2 Resource management in proxies
can be used (if necessary) to address some of the more tricky memory management problems.
- 6.5.3 Language specific details
+6.5.3 Language specific details
@@ -487,7 +488,7 @@
6.5.3 Language specific details
chapter has merely introduced the topic in a very general way.
- 6.6 Simple C++ wrapping
+6.6 Simple C++ wrapping
@@ -520,7 +521,7 @@
6.6 Simple C++ wrapping
accessor functions which are then used by the proxy classes.
- 6.6.1 Constructors and destructors
+6.6.1 Constructors and destructors
@@ -529,15 +530,15 @@
6.6.1 Constructors and destructors
List * new_List(void) {
- return new List;
+ return new List;
}
void delete_List(List *l) {
- delete l;
+ delete l;
}
- 6.6.2 Default constructors, copy constructors and implicit destructors
+6.6.2 Default constructors, copy constructors and implicit destructors
@@ -686,7 +687,7 @@
6.6.2 Default constructors, copy constructors and
- 6.6.3 When constructor wrappers aren't created
+6.6.3 When constructor wrappers aren't created
@@ -763,7 +764,7 @@
6.6.3 When constructor wrappers aren't created%feature can be found in the Customization features chapter.
- 6.6.4 Copy constructors
+6.6.4 Copy constructors
@@ -865,7 +866,7 @@
6.6.4 Copy constructors
older versions.
- 6.6.5 Member functions
+6.6.5 Member functions
@@ -873,7 +874,7 @@
6.6.5 Member functions
int List_search(List *obj, char *value) {
- return obj->search(value);
+ return obj->search(value);
}
@@ -891,7 +892,7 @@ 6.6.5 Member functions
low-level procedural wrappers match the accessor function prototype described above.
- 6.6.6 Static members
+6.6.6 Static members
@@ -901,7 +902,7 @@
6.6.6 Static members
in the generated wrapper code.
- 6.6.7 Member data
+6.6.7 Member data
@@ -911,11 +912,11 @@
6.6.7 Member data
int List_length_get(List *obj) {
- return obj->length;
+ return obj->length;
}
int List_length_set(List *obj, int value) {
- obj->length = value;
- return value;
+ obj->length = value;
+ return value;
}
@@ -932,7 +933,7 @@ 6.6.7 Member data
public:
...
%immutable;
- int length;
+ int length;
%mutable;
...
};
@@ -1093,7 +1094,7 @@ 6.6.7 Member data
customization features.
- 6.7 Default arguments
+6.7 Default arguments
@@ -1199,7 +1200,7 @@
6.7 Default arguments
SWIG is unable to support kwargs when wrapping overloaded methods, so the default approach cannot be used.
- 6.8 Protection
+6.8 Protection
@@ -1219,7 +1220,7 @@
6.8 Protection
the same convention used by C++).
- 6.9 Enums and constants
+6.9 Enums and constants
@@ -1230,7 +1231,7 @@
6.9 Enums and constants
class Swig {
public:
- enum {ALE, LAGER, PORTER, STOUT};
+ enum {ALE, LAGER, PORTER, STOUT};
};
@@ -1249,7 +1250,7 @@ 6.9 Enums and constants
Members declared as const are wrapped as read-only members and do not create constants.
- 6.10 Friends
+6.10 Friends
@@ -1310,7 +1311,7 @@
6.10 Friends
and a wrapper for the method 'blah' will not be generated.
- 6.11 References and pointers
+6.11 References and pointers
@@ -1320,7 +1321,7 @@
6.11 References and pointers
class Foo {
public:
- double bar(double &a);
+ double bar(double &a);
}
@@ -1330,7 +1331,7 @@ 6.11 References and pointers
double Foo_bar(Foo *obj, double *a) {
- obj->bar(*a);
+ obj->bar(*a);
}
@@ -1410,7 +1411,7 @@ 6.11 References and pointers
- 6.12 Pass and return by value
+6.12 Pass and return by value
@@ -1514,7 +1515,7 @@
6.12 Pass and return by value
It is not used for C++ pointers or references.
- 6.13 Inheritance
+6.13 Inheritance
@@ -1549,24 +1550,24 @@
6.13 Inheritance
class Shape {
public:
- double x,y;
- virtual double area() = 0;
- virtual double perimeter() = 0;
- void set_location(double x, double y);
+ double x,y;
+ virtual double area() = 0;
+ virtual double perimeter() = 0;
+ void set_location(double x, double y);
};
class Circle : public Shape {
public:
- Circle(double radius);
- ~Circle();
- double area();
- double perimeter();
+ Circle(double radius);
+ ~Circle();
+ double area();
+ double perimeter();
};
class Square : public Shape {
public:
- Square(double size);
- ~Square();
- double area();
- double perimeter();
+ Square(double size);
+ ~Square();
+ double area();
+ double perimeter();
}
@@ -1700,7 +1701,7 @@ 6.13 Inheritance
class.
- 6.14 A brief discussion of multiple inheritance, pointers, and type checking
+6.14 A brief discussion of multiple inheritance, pointers, and type checking
@@ -1832,7 +1833,7 @@
6.14 A brief discussion of multiple inheritance,
In practice, the pointer is held as an integral number in the target language proxy class.
- 6.15 Wrapping Overloaded Functions and Methods
+6.15 Wrapping Overloaded Functions and Methods
@@ -1895,7 +1896,7 @@
6.15 Wrapping Overloaded Functions
- 6.15.1 Dispatch function generation
+6.15.1 Dispatch function generation
@@ -2020,7 +2021,7 @@
6.15.1 Dispatch function generation
If you're still confused, don't worry about it---SWIG is probably doing the right thing.
- 6.15.2 Ambiguity in Overloading
+6.15.2 Ambiguity in Overloading
@@ -2101,13 +2102,13 @@
6.15.2 Ambiguity in Overloading
-When wrapping an overloaded function, there is a chance that you will get an error message like this:
+When wrapping an overloaded function, there is a chance that you will get a warning message like this:
-example.i:3: Warning 467: Overloaded foo(int) not supported (no type checking
-rule for 'int').
+example.i:3: Warning 467: Overloaded foo(int) not supported (incomplete type checking rule -
+no precedence level in typecheck typemap for 'int').
@@ -2116,7 +2117,8 @@ 6.15.2 Ambiguity in Overloading
but for some reason there is no type-checking rule that can be used to
generate a working dispatch function. The resulting behavior is then
undefined. You should report this as a bug to the
-SWIG bug tracking database .
+SWIG bug tracking database
+if this is due to one of the typemaps supplied with SWIG.
@@ -2137,7 +2139,7 @@
6.15.2 Ambiguity in Overloading
functions and methods. The only way to fix the problem is to read the next section.
- 6.15.3 Ambiguity resolution and renaming
+6.15.3 Ambiguity resolution and renaming
@@ -2480,6 +2482,7 @@
6.15.3 Ambiguity resolu
Currently no resolution is performed in order to match function parameters. This means function parameter types must match exactly.
For example, namespace qualifiers and typedefs will not work. The following usage of typedefs demonstrates this:
+
@@ -2566,7 +2569,7 @@ 6.15.3 Ambiguity resolu
- 6.15.4 Comments on overloading
+6.15.4 Comments on overloading
@@ -2583,7 +2586,7 @@
6.15.4 Comments on overloading
than dynamically typed languages like Perl, Python, Ruby, and Tcl.
- 6.16 Wrapping overloaded operators
+6.16 Wrapping overloaded operators
@@ -2612,7 +2615,7 @@
6.16 Wrapping overloaded operators
}
Complex operator*(const Complex &c) const {
return Complex(rpart*c.rpart - ipart*c.ipart,
- rpart*c.ipart + c.rpart*ipart);
+ rpart*c.ipart + c.rpart*ipart);
}
Complex operator-() const {
return Complex(-rpart, -ipart);
@@ -2767,7 +2770,7 @@ 6.16 Wrapping overloaded operators
- 6.17 Class extension
+6.17 Class extension
@@ -2785,17 +2788,17 @@
6.17 Class extension
class Vector {
public:
- double x,y,z;
- Vector();
- ~Vector();
- ... bunch of C++ methods ...
- %extend {
- char *__str__() {
- static char temp[256];
- sprintf(temp,"[ %g, %g, %g ]", $self->x,$self->y,$self->z);
- return &temp[0];
- }
- }
+ double x,y,z;
+ Vector();
+ ~Vector();
+ ... bunch of C++ methods ...
+ %extend {
+ char *__str__() {
+ static char temp[256];
+ sprintf(temp,"[ %g, %g, %g ]", $self->x,$self->y,$self->z);
+ return &temp[0];
+ }
+ }
};
@@ -2866,7 +2869,7 @@ 6.17 Class extension
directive name has been chosen.
- 6.18 Templates
+6.18 Templates
@@ -3614,18 +3617,52 @@
6.18 Templates
-Needless to say, SWIG's template support provides plenty of
-opportunities to break the universe. That said, an important final
-point is that SWIG does not perform extensive error checking of
-templates! 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 SWIG does
+not perform extensive error checking of templates! 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.
+
+
+As SWIG's template support does not perform type checking %template
+can be used as early as after a template declaration. You can, and rarely have
+to, use %template before the template parameters have been declared.
+For example:
+
+
+
+
+template <class T> class OuterTemplateClass {};
+
+// The nested class OuterClass::InnerClass inherits from the template class
+// OuterTemplateClass<OuterClass::InnerStruct> and thus the template needs
+// to be expanded with %template before the OuterClass declaration.
+%template(OuterTemplateClass_OuterClass__InnerStruct)
+ OuterTemplateClass<OuterClass::InnerStruct>
+
+
+// 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<InnerStruct> {};
+
+
+
Compatibility Note : The first implementation of template support relied heavily on
macro expansion in the preprocessor. Templates have been more tightly integrated into
@@ -3666,7 +3703,7 @@
6.18 Templates
Similar changes apply to typemaps and other customization features.
- 6.19 Namespaces
+6.19 Namespaces
@@ -4115,7 +4152,7 @@
6.19 Namespaces
more advanced namespace support.
- 6.19.1 The nspace feature for namespaces
+6.19.1 The nspace feature for namespaces
@@ -4196,7 +4233,7 @@
6.19.1 The nspace feature for namespaces
Compatibility Note: The nspace feature was first introduced in SWIG-2.0.0.
- 6.20 Renaming templated types in namespaces
+6.20 Renaming templated types in namespaces
@@ -4274,7 +4311,7 @@
6.20 Renaming tem
- 6.21 Exception specifications
+6.21 Exception specifications
@@ -4325,7 +4362,7 @@
6.21 Exception specification
The next section details a way of simulating an exception specification or replacing an existing one.
- 6.22 Exception handling with %catches
+6.22 Exception handling with %catches
@@ -4375,7 +4412,7 @@
6.22 Exception handling with %catches
- 6.23 Pointers to Members
+6.23 Pointers to Members
@@ -4425,7 +4462,7 @@
6.23 Pointers to Members
for member pointers.
- 6.24 Smart pointers and operator->()
+6.24 Smart pointers and operator->()
@@ -4637,11 +4674,12 @@
6.24 Smart pointers and operator->(
Note: Smart pointer support was first added in SWIG-1.3.14.
- 6.25 C++ reference counted objects - ref/unref feature
+6.25 C++ reference counted objects - ref/unref feature
Another similar idiom in C++ is the use of reference counted objects. Consider for example:
+
@@ -4658,11 +4696,11 @@ 6.25 C++ reference counted objects - ref/un
return add_ref();
}
- int unref() const {
+ int unref() const {
if (ref_count() == 0 || del_ref() == 0 ) {
- delete this;
- return 0;
- }
+ delete this;
+ return 0;
+ }
return ref_count();
}
};
@@ -4809,7 +4847,7 @@ 6.25 C++ reference counted objects - ref/un
- 6.26 Using declarations and inheritance
+6.26 Using declarations and inheritance
@@ -4972,7 +5010,7 @@
6.26 Using declarations and inheritance
- 6.27 Nested classes
+6.27 Nested classes
@@ -5000,6 +5038,12 @@
6.27 Nested classes
+
+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 %template before the beginning of the outer class.
+An example can be found in the
+Templates section.
+
Compatibility Note:
@@ -5030,7 +5074,7 @@
6.27 Nested classes
- 6.28 A brief rant about const-correctness
+6.28 A brief rant about const-correctness
@@ -5088,7 +5132,7 @@
6.28 A brief rant about const-correctness
of your project.
- 6.29 Where to go for more information
+6.29 Where to go for more information
diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
new file mode 100644
index 00000000000..3e9e1c1a206
--- /dev/null
+++ b/Doc/Manual/Scilab.html
@@ -0,0 +1,2052 @@
+
+
+
+SWIG and Scilab
+
+
+
+
+
+
+
+39 SWIG and Scilab
+
+
+
+
+
+
+
+Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB. More information can be found at www.scilab.org .
+
+
+
+This chapter explains how to use SWIG for Scilab. After this introduction, you should be able to generate with SWIG a Scilab external module from a C/C++ library.
+
+
+
+39.1 Preliminaries
+
+
+
+SWIG for Scilab supports Linux. Other operating sytems haven't been tested.
+
+
+
+Scilab is supported from version 5.3.3 onwards.
+The forthcoming version 6, as of January 2015, is also supported.
+
+
+
+SWIG for Scilab supports C language. C++ is partially supported. See A basic tour of C/C++ wrapping for further details.
+
+
+
+39.2 Running SWIG
+
+
+
+Let's see how to use SWIG for Scilab on a small example.
+
+In this example we bind from C a function and a global variable into Scilab. The SWIG interface (stored in a file named example.i ), is the following:
+
+
+
+%module example
+
+%inline %{
+double Foo = 3.0;
+
+int fact(int n) {
+ if (n < 0) {
+ return 0;
+ }
+ else if (n == 0) {
+ return 1;
+ }
+ else {
+ return n * fact(n-1);
+ }
+}
+%}
+
+
+
+Note: a code in an %inline section is both parsed and wrapped by SWIG, and inserted as is in the wrapper source file.
+
+
+
+39.2.1 Generating the module
+
+
+
+The module is generated using the swig executable and its -scilab option.
+
+
+
+$ swig -scilab example.i
+
+
+
+This command generates two files:
+
+
+example_wrap.c : a C source file containing the wrapping code and also here the wrapped code (the fact() and Foo definitions)
+loader.sce : a Scilab script used to load the module into Scilab
+
+
+
+Note: if the following error is returned:
+
+
+
+:1: Error: Unable to find 'swig.swg'
+:3: Error: Unable to find 'scilab.swg'
+
+
+
+it may be because the SWIG library is not found. Check the SWIG_LIB environment variable or your SWIG installation.
+
+
+
+Note: SWIG for Scilab can work in two modes related to the way the module is built, see the Building modes section for details.
+This example uses the builder mode.
+
+
+
+
+The swig executable has several other command line options you can use. See Scilab command line options for further details.
+
+
+
+39.2.2 Building the module
+
+
+
+To be loaded in Scilab, the wrapper has to be built into a dynamic module (or shared library).
+
+
+
+The commands to compile and link the wrapper (with gcc ) into the shared library libexample.so are:
+
+
+
+$ gcc -fPIC -c -I/usr/local/include/scilab example_wrap.c
+$ gcc -shared example_wrap.o -o libexample.so
+
+
+
+Note: we supposed in this example that the path to the Scilab include directory is /usr/local/include/scilab (which is the case in a Debian environment), this should be changed for another environment.
+
+
+39.2.3 Loading the module
+
+
+
+Loading a module is done by running the loader script in Scilab:
+
+
+
+
+
+Scilab should output the following messages:
+
+
+
+Shared archive loaded.
+Link done.
+
+
+
+which means that Scilab has successfully loaded the shared library. The module functions and other symbols are now available in Scilab.
+
+
+39.2.4 Using the module
+
+
+
+In Scilab, the function fact() is simply called as following:
+
+
+
+--> fact(5)
+ans =
+
+ 120.
+
+
+For the Foo global variable, the accessors need to be used:
+
+
+--> Foo_get
+ans =
+
+ 3.
+
+--> Foo_set(4);
+
+--> Foo_get
+ans =
+
+ 4.
+
+
+
+Note: for conciseness, we assume in the subsequent Scilab code examples that the modules have been beforehand built and loaded in Scilab.
+
+
+39.2.5 Scilab command line options
+
+
+
+The following table lists the Scilab specific command line options in addition to the generic SWIG options:
+
+
+
+
+
+-builder
+Generate the Scilab builder script
+
+
+
+-buildercflags <cflags>
+Add <cflags> to the builder compiler flags
+
+
+
+-builderldflags <ldflags>
+Add <ldlags> to the builder linker flags
+
+
+
+-buildersources <files>
+Add the (comma separated) files <files> to the builder sources
+
+
+
+-builderverbositylevel <level>
+Set the build verbosity level to <level> (default 0: off, 2: high)
+
+
+
+-builderflagscript <file>
+Use the Scilab script <file> to configure the compiler and linker flags
+
+
+
+-gatewayxml <gateway_id>
+Generate the gateway XML with the given <gateway_id>
+
+
+
+
+
+These options can be displayed with:
+
+
+
+
+
+39.3 A basic tour of C/C++ wrapping
+
+
+39.3.1 Overview
+
+
+
+SWIG for Scilab provides only a low-level C interface for Scilab (see Scripting Languages for the general approach to wrapping).
+This means that functions, structs, classes, variables, etc... are interfaced through C functions. These C functions are mapped as Scilab functions.
+There are a few exceptions, such as constants and enumerations, which can be wrapped directly as Scilab variables.
+
+
+39.3.2 Identifiers
+
+
+
+In Scilab 5.x, identifier names are composed of 24 characters maximum (this limitation should disappear from Scilab 6.0 onwards).
+ Thus long function or variable names may be truncated and this can cause ambiguities.
+
+This happens especially when wrapping structs/classes, for which the wrapped function name is composed of the struct/class name and field names.
+In these cases, the %rename directive can be used to choose a different Scilab name.
+
+
+39.3.3 Functions
+
+
+
+Functions are wrapped as new Scilab built-in functions. For example:
+
+
+
+%module example
+
+%inline %{
+int fact(int n) {
+ if (n > 1)
+ return n * fact(n - 1);
+ else
+ return 1;
+}
+%}
+
+
+
+creates a built-in function fact(n) in Scilab:
+
+
+
+--> fact(4)
+ans =
+
+ 24.
+
+
+39.3.3.1 Argument passing
+
+
+
+In the above example, the function parameter is a primitive type and is marshalled by value.
+So this function is wrapped without any additional customization.
+Argument values are converted between C types and Scilab types through type mappings.
+There are several default type mappings for primitive and complex types, described later in the Scilab typemaps section.
+
+
+
+When a parameter is not passed by value, such as a pointer or reference, SWIG does not know if it is an input, output (or both) parameter.
+The INPUT, OUTPUT, INOUT typemaps defined in the typemaps.i library can be used to specify this.
+
+
+
+Let's see this on two simple functions: sub() which has an output parameter, and inc() , which as input/output parameter:
+
+
+
+%module example
+
+%include <typemaps.i>
+
+extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
+extern void inc(int *INOUT, int *INPUT);
+
+%{
+void sub(int *x, int *y, int *result) {
+ *result = *x - *y;
+}
+void inc(int *x, int *delta) {
+ *x = *x + *delta;
+}
+%}
+
+
+
+In Scilab, parameters are passed by value. The output (and inout) parameters are returned as the result of the functions:
+
+
+
+--> sub(5, 3)
+ ans =
+
+ 2.
+
+--> inc(4, 3)
+ ans =
+
+ 7.
+
+
+39.3.3.2 Multiple output arguments
+
+
+
+A C function can have several output parameters. They can all be returned as results of the wrapped function as Scilab supports multiple return values from a function
+when using the typemaps.i library.
+If the C function itself returns a result, this is returned first before the parameter outputs.
+
+
+
+The example below shows this for a C function returning 2 values and a result:
+
+
+
+%module example
+
+%include <typemaps.i>
+
+int divide(int n, int d, int *OUTPUT, int *OUTPUT);
+
+%{
+int divide(int n, int d, int q*, int *r) {
+ if (d != 0) {
+ *q = n / d;
+ *r = n % d;
+ return 1;
+ }
+ else return 0;
+}
+%}
+
+
+
+
+
+--> [ret, q, r] = divide(20, 6)
+ r =
+
+ 2.
+ q =
+
+ 3.
+ ret =
+
+ 1.
+
+
+
+39.3.4 Global variables
+
+
+
+Global variables are manipulated through generated accessor functions.
+For example, for a given Foo global variable, SWIG actually generates two functions: Foo_get() to get the value of Foo , and Foo_set() to set the value.
+These functions are used as following:
+
+
+
+--> exec loader.sce;
+--> c = Foo_get();
+
+--> Foo_set(4);
+
+--> c
+c =
+
+ 3.
+
+--> Foo_get()
+ans =
+
+ 4.
+
+
+
+It works for variables of primitive type, but also for non-primitive types: arrays, and structs/classes which are described later.
+For now, an example with two global primitive arrays x and y is shown:
+
+
+
+%module example
+
+%inline %{
+int x[10];
+double y[7];
+
+void initArrays()
+{
+ int i;
+ for (i = 0; i < 10; i++)
+ x[i] = 1;
+ for (i = 0; i < 7; i++)
+ y[i] = 1.0f;
+}
+%}
+
+
+
+It works the same:
+
+
+--> exec loader.sce
+
+--> initArrays();
+--> x_get()
+ ans =
+
+ 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
+
+--> y_set([0:6] / 10);
+--> y_get()
+ ans =
+
+ 0. 0.1 0.2 0.3 0.4 0.5 0.6
+
+
+
+39.3.5 Constants and enumerations
+
+
+39.3.5.1 Constants
+
+
+
+There is not any constant in Scilab. By default, C/C++ constants are wrapped as getter functions. For example, for the following constants:
+
+
+
+%module example
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
+
+
+
+the following getter functions are generated:
+
+
+
+--> exec loader.sce;
+--> ICONST_get();
+ ans =
+
+ 42.
+
+--> FCONST_get();
+ ans =
+
+ 2.1828
+
+--> CCONST_get();
+ ans =
+
+ x
+
+--> CCONST2_get();
+ ans =
+
+--> SCONST_get();
+ ans =
+
+ Hello World
+
+--> SCONST2_get();
+ ans =
+
+ "Hello World"
+
+--> EXPR_get();
+ ans =
+
+ 48.5484
+
+--> iconst_get();
+ ans =
+
+ 37.
+
+--> fconst_get();
+ ans =
+
+ 3.14
+
+
+
+There is another mode in which constants are wrapped as Scilab variables.
+The variables are easier to use than functions, but the drawback is that variables are not constant and so can be modified.
+
+
+
+This mode can be enabled/disabled at any time in the interface file with %scilabconst() , which
+works like all the other %feature directives .
+Use the argument value "1" to enable and "0" to disable this mode.
+For example in this mode the previous constants:
+
+
+
+%module example
+
+%scilabconst(1);
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
+
+
+
+are mapped to Scilab variables, with the same name:
+
+
+
+--> exec loader.sce;
+--> ICONST
+ ans =
+
+ 42
+
+--> FCONST
+ ans =
+
+ 2.1828
+
+--> CCONST
+ ans =
+
+ x
+
+--> CCONST2
+ ans =
+
+--> SCONST
+ ans =
+
+ Hello World
+
+--> SCONST2
+ ans =
+
+ "Hello World"
+
+--> EXPR
+ ans =
+
+ 48.5484
+
+--> iconst
+ ans =
+
+ 37
+
+--> fconst
+ ans =
+
+ 3.14
+
+
+39.3.5.2 Enumerations
+
+
+
+The wrapping of enums is the same as for constants.
+By default, enums are wrapped as getter functions.
+For example, with the following enumeration:
+
+
+%module example
+typedef enum { RED, BLUE, GREEN } color;
+
+
+
+a getter function will be generated for each value of the enumeration:
+
+
+
+--> exec loader.sce;
+--> RED_get()
+ ans =
+
+ 0.
+
+--> BLUE_get()
+ ans =
+
+ 1.
+
+--> GREEN_get()
+ ans =
+
+ 2.
+
+
+
+The %scilabconst() feature is also available for enumerations:
+
+
+%module example
+%scilabconst(1) color;
+typedef enum { RED, BLUE, GREEN } color;
+
+
+
+
+
+--> exec loader.sce;
+--> RED
+ ans =
+
+ 0.
+
+--> BLUE
+ ans =
+
+ 1.
+
+--> GREEN
+ ans =
+
+ 2.
+
+
+
+39.3.6 Pointers
+
+
+
+C/C++ pointers are fully supported by SWIG. They are mapped to the Scilab pointer type ("pointer", type ID: 128).
+
+
+
+Given a wrapping of some of the C file functions:
+
+
+
+%module example
+
+%{
+#include <stdio.h>
+%}
+
+FILE *fopen(const char *filename, const char *mode);
+int fputs(const char *, FILE *);
+int fclose(FILE *);
+
+
+
+These functions can be used in a natural way from Scilab:
+
+
+
+--> f = fopen("junk", "w");
+--> typeof(f)
+ ans =
+
+ pointer
+
+--> fputs("Hello World", f);
+--> fclose(f);
+
+
+
+The user of a pointer is responsible for freeing it or, like in the example, closing any resources associated with it (just as is required in a C program).
+
+
+39.3.6.1 Utility functions
+
+
+
+Most of time pointer manipulation is not needed in a scripting language such as Scilab.
+However, in some cases it can be useful, such as for testing or debugging.
+
+
+
+SWIG comes with two pointer utility functions:
+
+
+SWIG_this() : returns the address value of a pointer
+SWIG_ptr() : creates a pointer from an address value
+
+
+Following illustrates their use on the last example:
+
+
+--> f = fopen("junk", "w");
+--> fputs("Hello", f);
+--> addr = SWIG_this(f)
+ ans =
+
+ 8219088.
+
+--> p = SWIG_ptr(addr);
+--> fputs(" World", p);
+--> fclose(f);
+
+
+39.3.6.2 Null pointers
+
+
+By default, Scilab does not provide a way to test or create null pointers.
+But it is possible to have a null pointer by using the previous functions SWIG_this() and SWIG_ptr() , like this:
+
+
+
+--> p = SWIG_ptr(0);
+--> SWIG_this(p) == 0
+ ans =
+
+ T
+
+
+
+39.3.7 Structures
+
+
+
+Structs exist in Scilab, but C structs are not (at least in this version of SWIG) mapped to Scilab structs.
+A C structure is wrapped through low-level accessor functions, i.e. functions that give access to the member variables of this structure.
+In Scilab, a structure is manipulated through a pointer which is passed as an argument to the accessor functions.
+
+
+
+Let's see it on an example of a struct with two members:
+
+
+
+%module example
+
+%inline %{
+
+typedef struct {
+ int x;
+ int arr[4];
+} Foo;
+
+%}
+
+
+
+Several functions are generated:
+
+
+a constructor function new_Foo() which returns a pointer to a newly created struct Foo .
+two member getter functions Foo_x_get() , Foo_arr_get() , to get the values of x and y for the struct pointer (provided as the first parameter to these functions)
+two member setter functions Foo_x_set() , Foo_arr_set() , to set the values of x and y for the struct pointer (provided as the first parameter to these functions).
+a destructor function delete_Foo() to release the struct pointer.
+
+
+
+Usage example:
+
+
+
+--> f = new_Foo();
+--> Foo_x_set(f, 100);
+--> Foo_x_get(f)
+ans =
+
+ 100.
+
+--> Foo_arr_set(f, [0:3]);
+--> Foo_arr_get(f)
+ans =
+
+ 0. 1. 2. 3.
+
+--> delete_Foo(f);
+
+
+
+
+Members of a structure that are also structures are also accepted and wrapped as a pointer:
+
+
+
+%module example
+
+%inline %{
+
+typedef struct {
+ int x;
+} Bar;
+
+typedef struct {
+ Bar b;
+} Foo;
+
+%}
+
+
+
+
+
+--> b = new_Bar();
+--> Bar_x_set(b, 20.);
+
+--> f = new_Foo();
+--> Foo_b_set(f, b);
+
+--> b2 = Foo_b_get(f);
+--> Bar_x_get(b2);
+ans =
+
+ 20.
+
+
+
+39.3.8 C++ classes
+
+
+
+Classes do not exist in Scilab. The classes are wrapped the same way as structs.
+Low-level accessor functions are generated for class members.
+Also, constructor and destructor functions are generated to create and destroy an instance of the class.
+
+
+
+For example, the following class:
+
+
+
+%module example
+
+%inline %{
+
+class Point {
+public:
+ int x, y;
+ Point(int _x, int _y) : x(_x), y(_y) {}
+ double distance(const Point& rhs) {
+ return sqrt(pow(x-rhs.x, 2) + pow(y-rhs.y, 2));
+ }
+ void set(int _x, int _y) {
+ x=_x;
+ y=_y;
+ }
+};
+
+%}
+
+
+
+can be used in Scilab like this:
+
+
+
+--> p1 = Point_new(3, 5);
+--> p2 = Point_new(1, 2);
+--> p1.distance(p2)
+ans =
+
+ 3.6056
+
+--> delete_Point(p1);
+--> delete_Point(p2);
+
+
+39.3.9 C++ inheritance
+
+
+
+Inheritance is supported. SWIG knows the inheritance relationship between classes.
+
+
+
+A function is only generated for the class in which it is actually declared.
+But if one of its parameters is a class, any instance of a derived class is accepted as the argument.
+
+
+
+This mechanism also applies for accessor functions: they are generated only in the class in which they are defined.
+But any instance of a derived class can be used as the argument to these accessor functions.
+
+
+
+For example, let's take a base class Shape and two derived classes Circle and Square :
+
+
+
+%module example
+
+%inline %{
+
+class Shape {
+public:
+ double x, y;
+ void set_location(double _x, double _y) { x = _x; y = _y; }
+ virtual double get_perimeter() { return 0; };
+};
+
+class Circle : public Shape {
+public:
+ int radius;
+ Circle(int _radius): radius(_radius) {};
+ virtual double get_perimeter() { return 6.28 * radius; }
+};
+
+class Square : public Shape {
+public:
+ int size;
+ Square(int _size): size(_size) {};
+ virtual double get_perimeter() { return 4 * size; }
+};
+
+%}
+
+
+
+To set the location of the Circle , we have to use the function set_location() of the parent Shape .
+But we can use either use the get_perimeter() function of the parent class or the derived class:
+
+
+
+--> c = new_Circle(3);
+
+--> Shape_set_location(c, 2, 3);
+--> Shape_x_get(c)
+ ans =
+
+ 2.
+
+--> Circle_get_perimeter(c)
+ ans =
+
+ 18.84
+
+--> Shape_get_perimeter(c)
+ ans =
+
+ 18.84
+
+
+39.3.10 Pointers, references, values, and arrays
+
+
+
+In C++ objects can be passed by value, pointer, reference, or by an array:
+
+
+%module example
+
+%{
+#include <sciprint.h>
+%}
+
+%inline %{
+
+class Foo {
+public:
+ Foo(int _x) : x(_x) {}
+ int x;
+};
+
+void spam1(Foo *f) { sciprint("%d\n", f->x); } // Pass by pointer
+void spam2(Foo &f) { sciprint("%d\n", f.x); } // Pass by reference
+void spam3(Foo f) { sciprint("%d\n", f.x); } // Pass by value
+void spam4(Foo f[]) { sciprint("%d\n", f[0].x); } // Array of objects
+
+%}
+
+
+
+In SWIG, there is no real distinction between these.
+So in Scilab, it is perfectly legal to do this:
+
+
+--> f = new_Foo()
+--> spam1(f)
+3
+--> spam2(f)
+3
+--> spam3(f)
+3
+--> spam4(f)
+3
+
+
+
+Similar behaviour occurs for return values. For example, if you had functions like this:
+
+
+Foo *spam5();
+Foo &spam6();
+Foo spam7();
+
+
+All these functions will return a pointer to an instance of Foo .
+As the function spam7 returns a value, new instance of Foo has to be allocated, and a pointer on this instance is returned.
+
+
+39.3.11 C++ templates
+
+
+
+As in other languages, function and class templates are supported in SWIG Scilab.
+
+
+
+You have to tell SWIG to create wrappers for a particular
+template instantiation. The %template directive is used for this purpose.
+For example:
+
+
+
+%module example
+
+template<class T1, class T2, class T3>
+struct triplet {
+ T1 first;
+ T2 second;
+ T3 third;
+ triplet(const T1& a, const T2& b, const T3& c) {
+ third = a; second = b; third = c;
+ }
+};
+
+%template(IntTriplet) triplet<int,int,int>;
+
+
+
+Then in Scilab:
+
+
+
+
+--> t = new_IntTriplet(3, 4, 1);
+
+--> IntTriplet_first_get(t)
+ ans =
+
+ 3.
+
+--> IntTriplet_second_get(t)
+ ans =
+
+ 4.
+
+--> IntTriplet_third_get(t)
+ ans =
+
+ 1.
+
+--> delete_IntTriplet(t);
+
+
+
+
+More details on template support can be found in the templates documentation.
+
+
+39.3.12 C++ operators
+
+
+
+C++ operators are partially supported.
+Operator overloading exists in Scilab, but a C++ operator is not (in this version) wrapped by SWIG as a Scilab operator, but as a function.
+It is not automatic, you have to rename each operator (with the instruction %rename ) with the suitable wrapper name.
+
+
+
+Let's see it with an example of class with two operators + and double() :
+
+
+
+%module example
+
+%rename(plus) operator +;
+%rename(toDouble) operator double();
+
+%inline %{
+
+class Complex {
+public:
+ Complex(double re, double im) : real(re), imag(im) {};
+
+ Complex operator+(const Complex& other) {
+ double result_real = real + other.real;
+ double result_imaginary = imag + other.imag;
+ return Complex(result_real, result_imaginary);
+ }
+ operator double() { return real; }
+private:
+ double real;
+ double imag;
+};
+
+%}
+
+
+
+
+
+--> c1 = new_Complex(3, 7);
+
+--> c2 = Complex_plus(c, new_Complex(1,1));
+
+--> Complex_toDouble(c2)
+ ans =
+
+ 4.
+
+
+
+39.3.13 C++ namespaces
+
+
+
+SWIG is aware of C++ namespaces, but does not use it for wrappers.
+The module is not broken into submodules, nor do namespace appear in functions names.
+All the namespaces are all flattened in the module.
+For example with one namespace Foo :
+
+
+
+
+%module example
+
+%inline %{
+
+namespace foo {
+ int fact(int n) {
+ if (n > 1)
+ return n * fact(n-1);
+ else
+ return 1;
+ }
+
+ struct Vector {
+ double x,y,z;
+ };
+};
+
+%}
+
+
+
+
+
+In Scilab, there is no need to the specify the Foo namespace:
+
+
+
+
+--> fact(3)
+ ans =
+
+ 6.
+
+--> v = new_Vector();
+--> Vector_x_set(v, 3.4);
+--> Vector_y_get(v)
+ ans =
+
+ 0.
+
+
+
+
+If your program has more than one namespace, name conflicts can be resolved using %rename .
+For example:
+
+
+
+
+%rename(Bar_spam) Bar::spam;
+
+namespace Foo {
+ int spam();
+}
+
+namespace Bar {
+ int spam();
+}
+
+
+
+
+Note: the nspace feature is not supported.
+
+
+
+39.3.14 C++ exceptions
+
+
+
+Scilab does not natively support exceptions, but has errors.
+When an exception is thrown, SWIG catches it, and sets a Scilab error. An error message is displayed in Scilab.
+For example:
+
+
+
+%module example
+
+%inline %{
+void throw_exception() throw(char const *) {
+ throw "Bye world !";
+}
+%}
+
+
+
+
+
+-->throw_exception()
+ !--error 999
+SWIG/Scilab: Exception (char const *) occured: Bye world !
+
+
+
+Scilab has a try-catch mechanism (and a similar instruction execstr() ) to handle exceptions.
+It can be used with the lasterror() function as following:
+
+
+
+--> execstr('throw_exception()', 'errcatch');
+ ans =
+
+ 999.
+
+--> lasterror()
+ ans =
+
+ SWIG/Scilab: Exception (char const *) occured: Bye world !
+
+
+
+If the function has a throw exception specification, SWIG can automatically map the exception type and set an appropriate Scilab error message.
+It works for a few primitive types, and also for STL exceptions (the library std_except.i has to be included to get the STL exception support):
+
+
+
+%module example
+
+%include <std_except.i>
+
+%inline %{
+void throw_int() throw(int) {
+ throw 12;
+}
+
+void throw_stl_invalid_arg(int i) throw(std::invalid_argument) {
+ if (i < 0)
+ throw std::invalid_argument("argument is negative.");
+}
+%}
+
+
+
+
+
+--> throw_int();
+ !--error 999
+SWIG/Scilab: Exception (int) occured: 12
+
+-->throw_stl_invalid_arg(-1);
+ !--error 999
+SWIG/Scilab: ValueError: argument is negative.
+
+
+
+More complex or custom exception types require specific exception typemaps to be implemented in order to specifically handle a thrown type.
+See the SWIG C++ documentation for more details.
+
+
+39.3.15 C++ STL
+
+
+
+The Standard Template Library (STL) is partially supported. See STL for more details.
+
+
+39.4 Type mappings and libraries
+
+
+39.4.1 Default primitive type mappings
+
+
+
+The following table provides the equivalent Scilab type for C/C++ primitive types.
+
+
+
+
+
+ C/C++ type
+ Scilab type
+
+bool boolean
+char string
+signed char double or int8
+unsigned char double or uint8
+short double or int16
+unsigned short double or uint16
+int double or int32
+unsigned int double or uint32
+long double or int32
+unsigned long double or uint32
+signed long long not supported in Scilab 5.x
+unsigned long long not supported in Scilab 5.x
+float double
+double double
+char * or char[] string
+
+
+
+
+Notes:
+
+
+In Scilab the double type is far more used than any integer type.
+This is why integer values (int32 , uint32 , ...) are automatically converted to Scilab double values when marshalled from C into Scilab.
+Additionally on input to a C function, Scilab double values are converted into the related integer type.
+
+
+When an integer is expected, if the input is a double, the value must be an integer, i.e. it must not have any decimal part, otherwise a SWIG value error occurs.
+
+
+In SWIG for Scilab 5.x, the long long type is not supported, since Scilab 5.x does not have a 64-bit integer type.
+The default behaviour is for SWIG to generate code that will give a runtime error if long long type arguments are used from Scilab.
+
+
+
+
+39.4.2 Default type mappings for non-primitive types
+
+
+
+The default mapped type for C/C++ non-primitive types is the Scilab pointer, for example for C structs, C++ classes, etc...
+
+
+
+39.4.3 Arrays
+
+
+
+Typemaps are available by default for arrays. Primitive type arrays are automatically converted to/from Scilab matrices.
+Typemaps are also provided to handle members of a struct or class that are arrays.
+
+
+
+In input, the matrix is usually one-dimensional (it can be either a row or column vector). But it can also be a two-dimensional matrix.
+Warning: in Scilab, the values are column-major ordered, unlike in C, which is row-major ordered.
+
+
+
+The type mappings used for arrays is the same for primitive types, described earlier .
+This means that, if needed, a Scilab double vector is converted in input into the related C integer array
+and this C integer array is automatically converted on output into a Scilab double vector.
+Note that unlike scalars, no control is done for arrays when a double is converted into an integer.
+
+
+
+The following example illustrates all this:
+
+
+%module example
+
+%#include <stdio.h>
+
+%inline %{
+
+void printArray(int values[], int len) {
+ int i = 0;
+ for (i = 0; i < len; i++) {
+ printf("%s %d %s", i==0?"[":"", values[i], i==len-1?"]\n":"");
+ }
+}
+%}
+
+
+
+
+
+--> printArray([0 1 2 3], 4)
+[ 0 1 2 3 ]
+
+--> printArray([0.2; -1.8; 2; 3.7], 4)
+[ 0 -1 2 3 ]
+
+--> printArray([0 1; 2 3], 4)
+[ 0 2 1 3 ]
+
+--> printArray([0; 1; 2; 3], 4)
+[ 0 1 2 3 ]
+
+
+39.4.4 Pointer-to-pointers
+
+
+
+There are no specific typemaps for pointer-to-pointers, they are are mapped as pointers in Scilab.
+
+
+
+Pointer-to-pointers are sometimes used to implement matrices in C. The following is a an example of this:
+
+
+
+
+%module example
+%inline %{
+
+// Returns the matrix [1 2; 3 4];
+double **create_matrix() {
+ double **M;
+ int i;
+ M = (double **) malloc(2 * sizeof(double *));
+ for (i = 0; i < 2; i++) {
+ M[i] = (double *) malloc(2 * sizeof(double));
+ M[i][0] = 2 * i + 1;
+ M[i][1] = 2 * i + 2;
+ }
+ return M;
+}
+
+// Gets the item M(i,j) value
+double get_matrix(double **M, int i, int j) {
+ return M[i][j];
+}
+
+// Sets the item M(i,j) value to be val
+void set_matrix(double **M, int i, int j, double val) {
+ M[i][j] = val;
+}
+
+// Prints a matrix (2,2) to console
+void print_matrix(double **M, int nbRows, int nbCols) {
+ int i, j;
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 2; j++) {
+ printf("%3g ", M[i][j]);
+ }
+ printf("\n");
+ }
+}
+
+%}
+
+
+
+ These functions are used like this in Scilab:
+
+
+
+--> m = create_matrix();
+
+--> print_matrix(m);
+ 1. 2.
+ 3. 4.
+
+--> set_matrix(m, 1, 1, 5.);
+
+--> get_matrix(m, 1, 1)
+ ans =
+
+ 5.
+
+
+
+39.4.5 Matrices
+
+
+
+The matrix.i library provides a set of typemaps which can be useful when working with one-dimensional and two-dimensional matrices.
+
+
+
+In order to use this library, just include it in the interface file:
+
+
+
+
+
+
+Several typemaps are available for the common Scilab matrix types:
+
+
+double
+int
+char *
+bool
+
+
+
+For example: for a matrix of int , we have the typemaps, for input:
+
+
+(int *IN, int IN_ROWCOUNT, int IN_COLCOUNT)
+(int IN_ROWCOUNT, int IN_COLCOUNT, int *IN)
+(int *IN, int IN_SIZE)
+(int IN_SIZE, int *IN)
+
+
+
+and output:
+
+
+(int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT)
+(int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT)
+(int **OUT, int *OUT_SIZE)
+(int *OUT_SIZE, int **OUT)
+
+
+
+They marshall a Scilab matrix type into the appropriate 2 or 3 C parameters.
+The following is an example using the typemaps in this library:
+
+
+
+%module example
+
+%include <matrix.i>
+
+%apply (int *IN, int IN_ROWCOUNT, int IN_COLCOUNT) { (int *matrix, int matrixNbRow, int matrixNbCol) };
+%apply (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) { (int **outMatrix, int *outMatrixNbRow, int *outMatrixNbCol) };
+
+%inline %{
+
+void absolute(int *matrix, int matrixNbRow, int matrixNbCol,
+ int **outMatrix, int *outMatrixNbRow, int *outMatrixNbCol) {
+ int i, j;
+ *outMatrixNbRow = matrixNbRow;
+ *outMatrixNbCol = matrixNbCol;
+ *outMatrix = malloc(matrixNbRow * matrixNbCol * sizeof(int));
+ for (i=0; i < matrixNbRow * matrixNbCol; i++) {
+ (*outMatrix)[i] = matrix[i] > 0 ? matrix[i]:-matrix[i];
+ }
+}
+
+%}
+
+
+
+
+
+--> absolute([-0 1 -2; 3 4 -5])
+ ans =
+
+ 0. 1. 2.
+ 3. 4. 5.
+
+
+
+The remarks made earlier for arrays also apply here:
+
+
+The values of matrices in Scilab are column-major orderered,
+There is no control while converting double values to integers, double values are truncated without any checking or warning.
+
+
+39.4.6 STL
+
+
+
+The STL library wraps some containers defined in the STL (Standard Template Library), so that they can be manipulated in Scilab.
+This library also provides the appropriate typemaps to use the containers in functions and variables.
+
+
+
+The list of wrapped sequence containers are:
+
+
+std::vector
+std::list
+std::deque
+
+
+
+And associative containers are:
+
+
+std::set
+std::multiset
+
+
+
+Typemaps are available for the following container types:
+
+
+
+double
+float
+int
+string
+bool
+pointer
+
+
+
+Containers of other item types are not supported. Using them does not break compilation, but provokes a runtime error.
+Containers of enum are not supported yet.
+
+
+
+In order to use the STL, the library must first be included in the SWIG interface file:
+
+
+
+
+Then for each container used, the appropriate template must be instantiated, in the std namespace:
+
+namespace std {
+ %template(IntVector) vector<int>;
+ %template(DoubleVector) vector<double>;
+}
+
+
+
+Additionally, the module initialization function has to be executed first in Scilab, so that all the types are known to Scilab.
+See the Module initialization section for more details.
+
+
+
+
+Because in Scilab matrices exist for basic types only, a sequence container of pointers is mapped to a Scilab list.
+For other item types (double, int, string...) the sequence container is mapped to a Scilab matrix.
+
+
+
+The first example below shows how to create a vector (of int ) in Scilab, add some values to the vector and pass it as an argument of a function.
+It also shows, thanks to the typemaps, that we can also pass a Scilab matrix of values directly into the function:
+
+
+
+%module example
+
+%include <stl.i>
+
+namespace std {
+ %template(IntVector) vector<int>;
+}
+
+%{
+#include <numeric>
+%}
+
+%inline %{
+
+double average(std::vector<int> v) {
+ return std::accumulate(v.begin(), v.end(), 0.0) / v.size();
+}
+
+%}
+
+
+
+
+
+--> example_Init();
+
+--> v = new_IntVector();
+
+--> for i = 1:4
+--> IntVector_push_back(v, i);
+--> end;
+
+--> average(v)
+ ans =
+
+ 2.5
+
+--> average([0 1 2 3])
+ ans =
+
+ 2.5
+
+--> delete_IntVector();
+
+
+
+
+In the second example, a set of struct (Person ) is wrapped.
+A function performs a search in this set, and returns a subset. As one can see, the result in Scilab is a list of pointers:
+
+
+
+%module example
+
+%include <stl.i>
+
+%{
+#include <string>
+%}
+
+%inline %{
+
+struct Person {
+ Person(std::string _name, int _age) : name(_name), age(_age) {};
+ std::string name;
+ int age;
+};
+typedef Person * PersonPtr;
+
+%}
+
+namespace std {
+ %template(PersonPtrSet) set<PersonPtr>;
+}
+
+%inline %{
+
+std::set<PersonPtr> findPersonsByAge(std::set<PersonPtr> persons, int minAge, int maxAge) {
+ std::set<PersonPtr> foundPersons;
+ for (std::set<PersonPtr>::iterator it = persons.begin(); it != persons.end(); it++) {
+ if (((*it)->age >= minAge) && ((*it)->age <= maxAge)) {
+ foundPersons.insert(*it);
+ }
+ }
+ return foundPersons;
+}
+
+%}
+
+
+
+
+
+--> example_Init();
+
+--> joe = new_Person("Joe", 25);
+--> susan = new_Person("Susan", 32);
+--> bill = new_Person("Bill", 50);
+
+--> p = new_PersonPtrSet();
+--> PersonPtrSet_insert(p, susan);
+--> PersonPtrSet_insert(p, joe);
+--> PersonPtrSet_insert(p, bill);
+
+--> l = findPersonsByAge(p, 20, 40);
+
+--> size(l)
+ ans =
+
+ 2.
+
+--> Person_name_get(l(1))
+ans =
+
+ Susan
+
+--> Person_name_get(l(2))
+ ans =
+
+ Joe
+
+--> delete_PersonPtrSet(p);
+
+
+39.5 Module initialization
+
+
+
+The wrapped module contains an initialization function to:
+
+
+initialize the SWIG runtime, which is necessary when working with the STL
+initialize in Scilab the module constants and enumerations declared with %scilabconst()
+
+
+
+This initialization function should be executed at the start of a script, before the wrapped library has to be used.
+
+
+
+The function has the name of the module suffixed by _Init .
+For example, to initialize the module example :
+
+
+
+
+39.6 Building modes
+
+
+
+The mechanism to load an external module in Scilab is called Dynamic Link and works with dynamic modules (or shared libraries, .so files).
+
+
+
+To produce a dynamic module, when generating the wrapper, there are two possibilities, or build modes:
+
+
+the nobuilder mode, this is the default mode in SWIG. The user is responsible of the build.
+ the builder mode. In this mode, Scilab is responsible of building.
+
+
+39.6.1 No-builder mode
+
+
+
+In this mode, used by default, SWIG generates the wrapper sources, which have to be manually compiled and linked.
+A loader script loader.sce is also produced, this one is executed further in Scilab to load the module.
+
+
+
+This mode is the best option to use when you have to integrate the module build into a larger build process.
+
+
+
+39.6.2 Builder mode
+
+
+
+In this mode, in addition to the wrapper sources, SWIG produces a builder Scilab script (builder.sce ), which is executed in Scilab to build the module.
+In a few words, the Scilab ilib_build() command is used, which produces the shared library file, and the loader script loader.sce (and also a cleaner script cleaner.sce ).
+
+
+
+An advantage of this mode is that it hides all the complexity of the build and other platform issues.
+Also it allows the module to conform to a Scilab external module convention which is that an external module should be simply built by calling a builder script.
+
+
+
+The builder mode is activated with the -builder SWIG option.
+In this mode, the following SWIG options may be used to setup the build:
+
+
+
+-buildersources : to add sources to the build (several files must be separated by a comma)
+-buildercflags : to add flags to the builder compiler flags, for example to set library dependencies include paths
+-builderldflags : to add flags to the linker flags, for example to set library dependency names and paths
+
+
+
+Let's give an example how to build a module example , composed of two sources, and using a library dependency:
+
+
+the sources are baa1.c and baa2.c (and are stored in in the current directory)
+the library is libfoo in /opt/foo (headers stored in /opt/foo/include , and shared library in /opt/foo/lib )
+
+
+
+The command is:
+
+
+
+$ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx,baa2.cxx example.i
+
+
+39.7 Generated scripts
+
+
+
+In this part we give some details about the generated Scilab scripts.
+
+
+39.7.1 Builder script
+
+
+
+builder.sce is the name of the builder script generated by SWIG in builder mode. It contains code like this:
+
+
+ilib_name = "examplelib";
+files = ["example_wrap.c"];
+libs = [];
+table = ["fact","_wrap_fact";"Foo_set","_wrap_Foo_set";"Foo_get","_wrap_Foo_get";];
+ilib_build(ilib_name,table,files,libs);
+
+
+
+ilib_build(lib_name,table,files,libs) is used to create shared libraries, and to generate a loader file used to dynamically load the shared library into Scilab.
+
+
+
+ilib_name : a character string, the generic name of the library without path and extension.
+files : string matrix containing objects files needed for shared library creation.
+libs : string matrix containing extra libraries needed for shared library creation.
+table : two column string matrix containing a table of pairs of 'scilab function name', 'C function name'.
+
+
+39.7.2 Loader script
+
+
+
+The loader script is used to load in Scilab all the module functions. When loaded, these functions can be used as other Scilab functions.
+
+
+
+The loader script loader.sce contains code similar to:
+
+
+
+// ------------------------------------------------------
+// generated by builder.sce: Please do not edit this file
+// ------------------------------------------------------
+
+libexamplelib_path = get_file_path('loader.sce');
+list_functions = [ 'fact';
+ 'Foo_set';
+ 'Foo_get';
+];
+addinter(libexamplelib_path+'/libexamplelib.so','libexamplelib',list_functions);
+// remove temp. variables on stack
+clear libexamplelib_path;
+clear list_functions;
+clear get_file_path;
+// ------------------------------------------------------
+
+
+
+addinter(files,spname,fcts) performs dynamic linking of a compiled C interface function.
+
+
+files : a character string or a vector of character strings defining the object files (containing the C interface functions) to link with.
+spname : a character string. Name of interface routine entry point.
+fcts : vector of character strings. The name of new Scilab function.
+
+
+
+39.8 Other resources
+
+
+
+Example use cases can be found in the Examples/scilab directory.
+The test suite in the Examples/test-suite/scilab can be another source of useful use cases.
+The Scilab API is used in the generated code and is a useful reference when examining the output.
+This guide describes the Scilab external modules structure and files, in particular the files that are generated by SWIG for Scilab.
+
+
diff --git a/Doc/Manual/Scripting.html b/Doc/Manual/Scripting.html
index c714fa0d7b9..18af78a6862 100644
--- a/Doc/Manual/Scripting.html
+++ b/Doc/Manual/Scripting.html
@@ -1,12 +1,13 @@
-
+
Scripting Languages
+
- 4 Scripting Languages
+4 Scripting Languages
@@ -37,7 +38,7 @@ 4 Scripting Languages
access C and C++ code.
- 4.1 The two language view of the world
+4.1 The two language view of the world
@@ -68,7 +69,7 @@
4.1 The two language view of the world
scripting, and access to high-level data structures such associative
arrays.
- 4.2 How does a scripting language talk to C?
+4.2 How does a scripting language talk to C?
@@ -93,7 +94,7 @@
4.2 How does a scripting language talk to C?
- 4.2.1 Wrapper functions
+4.2.1 Wrapper functions
@@ -101,8 +102,10 @@
4.2.1 Wrapper functions
int fact(int n) {
- if (n <= 1) return 1;
- else return n*fact(n-1);
+ if (n <= 1)
+ return 1;
+ else
+ return n*fact(n-1);
}
@@ -123,18 +126,17 @@ 4.2.1 Wrapper functions
function above example might look like the following :
-int wrap_fact(ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
- int result;
- int arg0;
- if (argc != 2) {
- interp->result = "wrong # args";
- return TCL_ERROR;
- }
- arg0 = atoi(argv[1]);
- result = fact(arg0);
- sprintf(interp->result,"%d", result);
- return TCL_OK;
+int wrap_fact(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) {
+ int result;
+ int arg0;
+ if (argc != 2) {
+ interp->result = "wrong # args";
+ return TCL_ERROR;
+ }
+ arg0 = atoi(argv[1]);
+ result = fact(arg0);
+ sprintf(interp->result,"%d", result);
+ return TCL_OK;
}
@@ -148,9 +150,9 @@ 4.2.1 Wrapper functions
int Wrap_Init(Tcl_Interp *interp) {
- Tcl_CreateCommand(interp, "fact", wrap_fact, (ClientData) NULL,
- (Tcl_CmdDeleteProc *) NULL);
- return TCL_OK;
+ Tcl_CreateCommand(interp, "fact", wrap_fact, (ClientData) NULL,
+ (Tcl_CmdDeleteProc *) NULL);
+ return TCL_OK;
}
@@ -165,7 +167,7 @@ 4.2.1 Wrapper functions
additional initialization code. Only the specific details are
different.
- 4.2.2 Variable linking
+4.2.2 Variable linking
@@ -201,7 +203,7 @@
4.2.2 Variable linking
the value.
- 4.2.3 Constants
+4.2.3 Constants
@@ -222,7 +224,7 @@
4.2.3 Constants
a trivial exercise.
- 4.2.4 Structures and classes
+4.2.4 Structures and classes
@@ -243,9 +245,9 @@
4.2.4 Structures and classes
struct Vector {
- Vector();
- ~Vector();
- double x,y,z;
+ Vector();
+ ~Vector();
+ double x,y,z;
};
@@ -283,7 +285,7 @@ 4.2.4 Structures and classes
about the actual representation of a Vector .
- 4.2.5 Proxy classes
+4.2.5 Proxy classes
@@ -298,9 +300,9 @@
4.2.5 Proxy classes
class Vector {
public:
- Vector();
- ~Vector();
- double x,y,z;
+ Vector();
+ ~Vector();
+ double x,y,z;
};
@@ -345,7 +347,7 @@ 4.2.5 Proxy classes
as if you are simply manipulating a C/C++ object.
- 4.3 Building scripting language extensions
+4.3 Building scripting language extensions
@@ -358,7 +360,7 @@
4.3 Building scripting language extensions
added to it.
- 4.3.1 Shared libraries and dynamic loading
+4.3.1 Shared libraries and dynamic loading
@@ -400,7 +402,7 @@
4.3.1 Shared libraries and dynamic loading
c++ -shared example.o example_wrap.o -o example.so
- 4.3.2 Linking with shared libraries
+4.3.2 Linking with shared libraries
@@ -447,7 +449,7 @@
4.3.2 Linking with shared libraries
- 4.3.3 Static linking
+4.3.3 Static linking
diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html
index 666069264fd..bfa58f1ae79 100644
--- a/Doc/Manual/Sections.html
+++ b/Doc/Manual/Sections.html
@@ -1,16 +1,19 @@
-
+
SWIG-3.0 Documentation
+
- SWIG-3.0 Documentation
+SWIG-3.0 Documentation
-Last update : SWIG-3.0.5 (in progress)
+
+Last update : SWIG-3.0.9 (in progress)
+
-Sections
+Sections
-SWIG Core Documentation
+SWIG Core Documentation
-Language Module Documentation
+Language Module Documentation
-Developer Documentation
+Developer Documentation
Extending SWIG
diff --git a/Doc/Manual/Tcl.html b/Doc/Manual/Tcl.html
index 45218f30377..31fae0321c7 100644
--- a/Doc/Manual/Tcl.html
+++ b/Doc/Manual/Tcl.html
@@ -1,12 +1,13 @@
-
+
SWIG and Tcl
+
- 39 SWIG and Tcl
+40 SWIG and Tcl
@@ -83,7 +84,7 @@ 39 SWIG and Tcl
this is no longer supported.
- 39.1 Preliminaries
+40.1 Preliminaries
@@ -109,7 +110,7 @@
39.1 Preliminaries
need to compile this file and link it with the rest of your program.
- 39.1.1 Getting the right header files
+40.1.1 Getting the right header files
@@ -127,7 +128,7 @@
39.1.1 Getting the right header files
header file.
- 39.1.2 Compiling a dynamic module
+40.1.2 Compiling a dynamic module
@@ -163,7 +164,7 @@
39.1.2 Compiling a dynamic module
-module command line option.
- 39.1.3 Static linking
+40.1.3 Static linking
@@ -207,8 +208,8 @@
39.1.3 Static linking
$ gcc example.c example_wrap.c \
-Xlinker -export-dynamic \
-DHAVE_CONFIG_H -I/usr/local/include/ \
- -L/usr/local/lib -ltcl -lm -ldl \
- -o mytclsh
+ -L/usr/local/lib -ltcl -lm -ldl \
+ -o mytclsh
@@ -229,7 +230,7 @@ 39.1.3 Static linking
hassle in the opinion of this author).
- 39.1.4 Using your module
+40.1.4 Using your module
@@ -357,7 +358,7 @@
39.1.4 Using your module
the man pages).
- 39.1.5 Compilation of C++ extensions
+40.1.5 Compilation of C++ extensions
@@ -440,7 +441,7 @@
39.1.5 Compilation of C++ extensions
might want to investigate using a more formal standard such as COM.
- 39.1.6 Compiling for 64-bit platforms
+40.1.6 Compiling for 64-bit platforms
@@ -467,7 +468,7 @@
39.1.6 Compiling for 64-bit platforms
linking standard (e.g., -o32 and -n32 on Irix).
- 39.1.7 Setting a package prefix
+40.1.7 Setting a package prefix
@@ -486,7 +487,7 @@
39.1.7 Setting a package prefix
call it "Foo_bar ".
- 39.1.8 Using namespaces
+40.1.8 Using namespaces
@@ -508,7 +509,7 @@
39.1.8 Using namespaces
are always accessed with the namespace name such as Foo::bar .
- 39.2 Building Tcl/Tk Extensions under Windows 95/NT
+40.2 Building Tcl/Tk Extensions under Windows 95/NT
@@ -519,7 +520,7 @@
39.2 Building Tcl/Tk Extensions under Windows 95/NT
although the procedure may be similar with other compilers.
- 39.2.1 Running SWIG from Developer Studio
+40.2.1 Running SWIG from Developer Studio
@@ -577,7 +578,7 @@
39.2.1 Running SWIG from Developer Studio
%
- 39.2.2 Using NMAKE
+40.2.2 Using NMAKE
@@ -625,11 +626,11 @@
39.2.2 Using NMAKE
TCL_INCLUDES = -Id:\tcl8.0a2\generic -Id:\tcl8.0a2\win
TCLLIB = d:\tcl8.0a2\win\tcl80.lib
-tcl::
- ..\..\swig -tcl -o $(WRAPFILE) $(INTERFACE)
- $(CC) $(CFLAGS) $(TCL_INCLUDES) $(SRCS) $(WRAPFILE)
- set LIB=$(TOOLS)\lib
- $(LINK) $(LOPT) -out:example.dll $(LIBS) $(TCLLIB) example.obj example_wrap.obj
+tcl:
+ ..\..\swig -tcl -o $(WRAPFILE) $(INTERFACE)
+ $(CC) $(CFLAGS) $(TCL_INCLUDES) $(SRCS) $(WRAPFILE)
+ set LIB=$(TOOLS)\lib
+ $(LINK) $(LOPT) -out:example.dll $(LIBS) $(TCLLIB) example.obj example_wrap.obj
@@ -640,7 +641,7 @@ 39.2.2 Using NMAKE
Tcl extensions.
- 39.3 A tour of basic C/C++ wrapping
+40.3 A tour of basic C/C++ wrapping
@@ -651,7 +652,7 @@
39.3 A tour of basic C/C++ wrapping
wrapping.
- 39.3.1 Modules
+40.3.1 Modules
@@ -685,7 +686,7 @@
39.3.1 Modules
- 39.3.2 Functions
+40.3.2 Functions
@@ -710,7 +711,7 @@
39.3.2 Functions
%
- 39.3.3 Global variables
+40.3.3 Global variables
@@ -790,7 +791,7 @@
39.3.3 Global variables
- 39.3.4 Constants and enums
+40.3.4 Constants and enums
@@ -874,7 +875,7 @@
39.3.4 Constants and enums
conversion. This allows the global statement to be omitted.
- 39.3.5 Pointers
+40.3.5 Pointers
@@ -970,7 +971,7 @@
39.3.5 Pointers
None if the conversion can't be performed.
- 39.3.6 Structures
+40.3.6 Structures
@@ -980,7 +981,7 @@
39.3.6 Structures
struct Vector {
- double x,y,z;
+ double x,y,z;
};
@@ -1252,7 +1253,7 @@ 39.3.6 Structures
memory management section that appears shortly.
- 39.3.7 C++ classes
+40.3.7 C++ classes
@@ -1319,7 +1320,7 @@
39.3.7 C++ classes
- 39.3.8 C++ inheritance
+40.3.8 C++ inheritance
@@ -1368,7 +1369,7 @@
39.3.8 C++ inheritance
It is safe to use multiple inheritance with SWIG.
- 39.3.9 Pointers, references, values, and arrays
+40.3.9 Pointers, references, values, and arrays
@@ -1422,7 +1423,7 @@
39.3.9 Pointers, references, values, and arrays
when the return value is garbage collected).
- 39.3.10 C++ overloaded functions
+40.3.10 C++ overloaded functions
@@ -1545,7 +1546,7 @@
39.3.10 C++ overloaded functions
Please refer to the "SWIG and C++" chapter for more information about overloading.
- 39.3.11 C++ operators
+40.3.11 C++ operators
@@ -1647,7 +1648,7 @@
39.3.11 C++ operators
Keep reading.
- 39.3.12 C++ namespaces
+40.3.12 C++ namespaces
@@ -1711,7 +1712,7 @@
39.3.12 C++ namespaces
identical symbol names, well, then you get what you deserve.
- 39.3.13 C++ templates
+40.3.13 C++ templates
@@ -1763,7 +1764,7 @@
39.3.13 C++ templates
examples will appear later.
- 39.3.14 C++ Smart Pointers
+40.3.14 C++ Smart Pointers
@@ -1847,7 +1848,7 @@
39.3.14 C++ Smart Pointers
- 39.4 Further details on the Tcl class interface
+40.4 Further details on the Tcl class interface
@@ -1860,7 +1861,7 @@
39.4 Further details on the Tcl class interface
of how the proxy classes work.
- 39.4.1 Proxy classes
+40.4.1 Proxy classes
@@ -1925,7 +1926,7 @@
39.4.1 Proxy classes
as shown in the last section.
- 39.4.2 Memory management
+40.4.2 Memory management
@@ -2113,7 +2114,7 @@
39.4.2 Memory management
- 39.5 Input and output parameters
+40.5 Input and output parameters
@@ -2301,7 +2302,7 @@
39.5 Input and output parameters
- 39.6 Exception handling
+40.6 Exception handling
@@ -2435,7 +2436,7 @@
39.6 Exception handling
See the chapter on "Customization Features " for more examples.
- 39.7 Typemaps
+40.7 Typemaps
@@ -2452,7 +2453,7 @@
39.7 Typemaps
C-Tcl interface.
- 39.7.1 What is a typemap?
+40.7.1 What is a typemap?
@@ -2465,8 +2466,9 @@
39.7.1 What is a typemap?
%module example
%typemap(in) int {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR) return TCL_ERROR;
- printf("Received an integer : %d\n",$1);
+ if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ return TCL_ERROR;
+ printf("Received an integer : %d\n",$1);
}
%inline %{
extern int fact(int n);
@@ -2503,8 +2505,9 @@ 39.7.1 What is a typemap?
%module example
%typemap(in) int n {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR) return TCL_ERROR;
- printf("n = %d\n",$1);
+ if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ return TCL_ERROR;
+ printf("n = %d\n",$1);
}
%inline %{
extern int fact(int n);
@@ -2526,8 +2529,9 @@ 39.7.1 What is a typemap?
%typemap(in) int n {
- if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR) return TCL_ERROR;
- printf("n = %d\n",$1);
+ if (Tcl_GetIntFromObj(interp,$input,&$1) == TCL_ERROR)
+ return TCL_ERROR;
+ printf("n = %d\n",$1);
}
%inline %{
typedef int Integer;
@@ -2569,7 +2573,7 @@ 39.7.1 What is a typemap?
- 39.7.2 Tcl typemaps
+40.7.2 Tcl typemaps
@@ -2707,7 +2711,7 @@
39.7.2 Tcl typemaps
Examples of these methods will appear shortly.
- 39.7.3 Typemap variables
+40.7.3 Typemap variables
@@ -2778,7 +2782,7 @@
39.7.3 Typemap variables
The Tcl name of the wrapper function being created.
- 39.7.4 Converting a Tcl list to a char **
+40.7.4 Converting a Tcl list to a char **
@@ -2840,7 +2844,7 @@
39.7.4 Converting a Tcl list to a char **
3
- 39.7.5 Returning values in arguments
+40.7.5 Returning values in arguments
@@ -2882,7 +2886,7 @@
39.7.5 Returning values in arguments
%
- 39.7.6 Useful functions
+40.7.6 Useful functions
@@ -2958,7 +2962,7 @@
39.7.6 Useful functions
- 39.7.7 Standard typemaps
+40.7.7 Standard typemaps
@@ -2975,10 +2979,10 @@
39.7.7 Standard typemaps
%typemap(in) int, short, long {
- int temp;
- if (Tcl_GetIntFromObj(interp, $input, &temp) == TCL_ERROR)
- return TCL_ERROR;
- $1 = ($1_ltype) temp;
+ int temp;
+ if (Tcl_GetIntFromObj(interp, $input, &temp) == TCL_ERROR)
+ return TCL_ERROR;
+ $1 = ($1_ltype) temp;
}
@@ -3043,7 +3047,7 @@ 39.7.7 Standard typemaps
- 39.7.8 Pointer handling
+40.7.8 Pointer handling
@@ -3119,7 +3123,7 @@
39.7.8 Pointer handling
- 39.8 Turning a SWIG module into a Tcl Package.
+40.8 Turning a SWIG module into a Tcl Package.
@@ -3153,8 +3157,8 @@
39.8 Turning a SWIG module into a Tcl Package.
./example/
- pkgIndex.tcl # The file created by pkg_mkIndex
- example.so # The SWIG generated module
+ pkgIndex.tcl # The file created by pkg_mkIndex
+ example.so # The SWIG generated module
@@ -3191,7 +3195,7 @@
39.8 Turning a SWIG module into a Tcl Package.
to use the load command instead.
- 39.9 Building new kinds of Tcl interfaces (in Tcl)
+40.9 Building new kinds of Tcl interfaces (in Tcl)
@@ -3264,14 +3268,14 @@
39.9 Building new kinds of Tcl interfaces (in Tcl)
set a [Array double 100] ;# Create a double [100]
for {set i 0} {$i < 100} {incr i 1} { ;# Clear the array
- $a set $i 0.0
+ $a set $i 0.0
}
$a set 3 3.1455 ;# Set an individual element
set b [$a get 10] ;# Retrieve an element
set ia [Array int 50] ;# Create an int[50]
for {set i 0} {$i < 50} {incr i 1} { ;# Clear it
- $ia set $i 0
+ $ia set $i 0
}
$ia set 3 7 ;# Set an individual element
set ib [$ia get 10] ;# Get an individual element
@@ -3290,7 +3294,7 @@ 39.9 Building new kinds of Tcl interfaces (in Tcl)
- 39.9.1 Proxy classes
+40.9.1 Proxy classes
@@ -3411,7 +3415,7 @@
39.9.1 Proxy classes
interesting things.
- 39.10 Tcl/Tk Stubs
+40.10 Tcl/Tk Stubs
diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html
index 040244d45ae..0dc725a9fac 100644
--- a/Doc/Manual/Typemaps.html
+++ b/Doc/Manual/Typemaps.html
@@ -1,12 +1,13 @@
-
+
Typemaps
+
- 11 Typemaps
+11 Typemaps
+
Special variables and typemap attributes
+Special variables combined with special variable macros
Common typemap methods
@@ -85,7 +88,7 @@ 11 Typemaps
Usage
Typemaps and overloading
-More about %apply and %clear
+More about %apply and %clear
Passing data between typemaps
C++ "this" pointer
Where to go for more information?
@@ -95,7 +98,7 @@ 11 Typemaps
- 11.1 Introduction
+11.1 Introduction
@@ -112,7 +115,7 @@
11.1 Introduction
chapter with only a vague idea of what SWIG already does by default.
- 11.1.1 Type conversion
+11.1.1 Type conversion
@@ -205,7 +208,7 @@
11.1.1 Type conversion
how it works (an exercise left to the reader).
- 11.1.2 Typemaps
+11.1.2 Typemaps
@@ -306,7 +309,7 @@
11.1.2 Typemaps
possible to completely change the way in which values are converted.
- 11.1.3 Pattern matching
+11.1.3 Pattern matching
@@ -408,7 +411,7 @@
11.1.3 Pattern matching
provides a hint to the unusual variable naming scheme involving $1 , $2 , and so forth.
- 11.1.4 Reusing typemaps
+11.1.4 Reusing typemaps
@@ -464,7 +467,7 @@
11.1.4 Reusing typemaps
then SWIG already knows that the int typemaps apply. You don't have to do anything.
- 11.1.5 What can be done with typemaps?
+11.1.5 What can be done with typemaps?
@@ -576,7 +579,7 @@
11.1.5 What can be done with typemaps?
aspects of the Java bindings. Consult language specific documentation for further details.
- 11.1.6 What can't be done with typemaps?
+11.1.6 What can't be done with typemaps?
@@ -639,7 +642,7 @@
11.1.6 What can't be done with typemaps?
- 11.1.7 Similarities to Aspect Oriented Programming
+11.1.7 Similarities to Aspect Oriented Programming
@@ -653,11 +656,11 @@
11.1.7 Similarities to Aspect Oriented Progra
Aspect : Aspects are the combination of the pointcut and the advice, hence each typemap is an aspect.
-SWIG can also be viewed as has having a second set of aspects based around %feature .
+SWIG can also be viewed as has having a second set of aspects based around %feature .
Features such as %exception are also cross-cutting concerns as they encapsulate code that can be used to add logging or exception handling to any function.
- 11.1.8 The rest of this chapter
+11.1.8 The rest of this chapter
@@ -677,14 +680,14 @@
11.1.8 The rest of this chapter
"The C++ Programming Language" by Stroustrup before going any further.
- 11.2 Typemap specifications
+11.2 Typemap specifications
This section describes the behavior of the %typemap directive itself.
- 11.2.1 Defining a typemap
+11.2.1 Defining a typemap
@@ -797,7 +800,7 @@
11.2.1 Defining a typemap
individual pieces will become clear.
- 11.2.2 Typemap scope
+11.2.2 Typemap scope
@@ -847,7 +850,7 @@
11.2.2 Typemap scope
- 11.2.3 Copying a typemap
+11.2.3 Copying a typemap
@@ -905,7 +908,7 @@
11.2.3 Copying a typemap
- 11.2.4 Deleting a typemap
+11.2.4 Deleting a typemap
@@ -938,7 +941,7 @@
11.2.4 Deleting a typemap
after the clear operation.
- 11.2.5 Placement of typemaps
+11.2.5 Placement of typemaps
@@ -1018,7 +1021,7 @@
11.2.5 Placement of typemaps
within a particular namespace. In this example, this is done using the forward class declaration class string .
- 11.3 Pattern matching rules
+11.3 Pattern matching rules
@@ -1026,7 +1029,7 @@
11.3 Pattern matching rules
The matching rules can be observed in practice by using the debugging options also described.
- 11.3.1 Basic matching rules
+11.3.1 Basic matching rules
@@ -1125,7 +1128,7 @@
11.3.1 Basic matching rules
stripped all qualifiers in one step.
- 11.3.2 Typedef reductions matching
+11.3.2 Typedef reductions matching
@@ -1300,7 +1303,7 @@
11.3.2 Typedef reductions matching
- 11.3.3 Default typemap matching rules
+11.3.3 Default typemap matching rules
@@ -1438,7 +1441,7 @@
11.3.3 Default typemap matching rules
simpler scheme to match the current C++ class template partial specialization matching rules.
- 11.3.4 Multi-arguments typemaps
+11.3.4 Multi-arguments typemaps
@@ -1468,7 +1471,7 @@
11.3.4 Multi-argumen
- 11.3.5 Matching rules compared to C++ templates
+11.3.5 Matching rules compared to C++ templates
@@ -1627,7 +1630,7 @@
11.3.5 Matching rules co
- 11.3.6 Debugging typemap pattern matching
+11.3.6 Debugging typemap pattern matching
@@ -1840,7 +1843,7 @@
11.3.6 Debugging typemap pattern mat
- 11.4 Code generation rules
+11.4 Code generation rules
@@ -1848,7 +1851,7 @@
11.4 Code generation rules
the generated wrapper code.
- 11.4.1 Scope
+11.4.1 Scope
@@ -1926,7 +1929,7 @@
11.4.1 Scope
Note that only the third of the three typemaps have the typemap code passed through the SWIG preprocessor.
- 11.4.2 Declaring new local variables
+11.4.2 Declaring new local variables
@@ -2093,7 +2096,7 @@
11.4.2 Declaring new local variables
- 11.4.3 Special variables
+11.4.3 Special variables
@@ -2345,7 +2348,7 @@
11.4.3 Special variables
- 11.4.4 Special variable macros
+11.4.4 Special variable macros
@@ -2357,7 +2360,7 @@
11.4.4 Special variable macro
The following special variable macros are available across all language modules.
- 11.4.4.1 $descriptor(type)
+11.4.4.1 $descriptor(type)
@@ -2368,7 +2371,7 @@
11.4.4.1 $descriptor(type)
This macro is mostly used in the scripting target languages and is demonstrated later in the Run-time type checker usage section.
- 11.4.4.2 $typemap(method, typepattern)
+11.4.4.2 $typemap(method, typepattern)
@@ -2425,7 +2428,77 @@
11.4.4.2 $typemap(method, typep
- 11.5 Common typemap methods
+
+11.4.5 Special variables and typemap attributes
+
+
+
+As of SWIG-3.0.7 typemap attributes will also expand special variables and special variable macros.
+
+
+
+Example usage showing the expansion in the 'out' attribute (C# specific) as well as the main typemap body:
+
+
+
+
+%typemap(ctype, out="$*1_ltype") unsigned int& "$*1_ltype"
+
+
+
+
+is equivalent to the following as $*1_ltype expands to unsigned int :
+
+
+
+
+%typemap(ctype, out="unsigned int") unsigned int& "unsigned int"
+
+
+
+11.4.6 Special variables combined with special variable macros
+
+
+
+Special variables can also be used within special variable macros.
+The special variables are expanded before they are used in the special variable macros.
+
+
+
+Consider the following C# typemaps:
+
+
+
+
+%typemap(cstype) unsigned int "uint"
+%typemap(cstype, out="$typemap(cstype, $*1_ltype)") unsigned int& "$typemap(cstype, $*1_ltype)"
+
+
+
+
+Special variables are expanded first and hence the above is equivalent to:
+
+
+
+
+%typemap(cstype) unsigned int "uint"
+%typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)"
+
+
+
+
+which then expands to:
+
+
+
+
+%typemap(cstype) unsigned int "uint"
+%typemap(cstype, out="uint") unsigned int& "uint"
+
+
+
+
+11.5 Common typemap methods
@@ -2433,7 +2506,7 @@
11.5 Common typemap methods
the following typemap methods are nearly universal:
- 11.5.1 "in" typemap
+11.5.1 "in" typemap
@@ -2493,7 +2566,7 @@
11.5.1 "in" typemap
is the same as the old "ignore" typemap.
- 11.5.2 "typecheck" typemap
+11.5.2 "typecheck" typemap
@@ -2519,7 +2592,7 @@
11.5.2 "typecheck" typemap
"typecheck" typemaps. More details about this follow in the Typemaps and overloading section.
- 11.5.3 "out" typemap
+11.5.3 "out" typemap
@@ -2550,7 +2623,7 @@
11.5.3 "out" typemap
The "out" typemap supports an optional attribute flag called "optimal". This is for code optimisation and is detailed in the Optimal code generation when returning by value section.
- 11.5.4 "arginit" typemap
+11.5.4 "arginit" typemap
@@ -2569,7 +2642,7 @@
11.5.4 "arginit" typemap
- 11.5.5 "default" typemap
+11.5.5 "default" typemap
@@ -2602,7 +2675,7 @@
11.5.5 "default" typemap
for further information on default argument wrapping.
- 11.5.6 "check" typemap
+11.5.6 "check" typemap
@@ -2621,7 +2694,7 @@
11.5.6 "check" typemap
- 11.5.7 "argout" typemap
+11.5.7 "argout" typemap
@@ -2667,7 +2740,7 @@
11.5.7 "argout" typemap
See the typemaps.i library file for examples.
- 11.5.8 "freearg" typemap
+11.5.8 "freearg" typemap
@@ -2700,7 +2773,7 @@
11.5.8 "freearg" typemap
prematurely.
- 11.5.9 "newfree" typemap
+11.5.9 "newfree" typemap
@@ -2729,7 +2802,7 @@
11.5.9 "newfree" typemap
See Object ownership and %newobject for further details.
- 11.5.10 "memberin" typemap
+11.5.10 "memberin" typemap
@@ -2751,7 +2824,7 @@
11.5.10 "memberin" typemap
a default implementation for arrays, strings, and other objects.
- 11.5.11 "varin" typemap
+11.5.11 "varin" typemap
@@ -2759,7 +2832,7 @@
11.5.11 "varin" typemap
purposes of assigning to a C/C++ global variable. This is implementation specific.
- 11.5.12 "varout" typemap
+11.5.12 "varout" typemap
@@ -2767,7 +2840,7 @@
11.5.12 "varout" typemap
language when reading a C/C++ global variable. This is implementation specific.
- 11.5.13 "throws" typemap
+11.5.13 "throws" typemap
@@ -2813,7 +2886,7 @@
11.5.13 "throws" typemap
For a neat way to handle these, see the Exception handling with %exception section.
- 11.6 Some typemap examples
+11.6 Some typemap examples
@@ -2821,7 +2894,7 @@
11.6 Some typemap examples
for more examples.
- 11.6.1 Typemaps for arrays
+11.6.1 Typemaps for arrays
@@ -2978,8 +3051,8 @@
11.6.1 Typemaps for arrays
struct SomeObject {
- float value[4];
- ...
+ float value[4];
+ ...
};
@@ -3080,7 +3153,7 @@ 11.6.1 Typemaps for arrays
useless and has since been eliminated. To return structure members, simply use the "out" typemap.
- 11.6.2 Implementing constraints with typemaps
+11.6.2 Implementing constraints with typemaps
@@ -3093,9 +3166,9 @@
11.6.2 Implementing constraints with typemaps 11.6.2 Implementing constraints with typemaps
- 11.7 Typemaps for multiple target languages
+11.7 Typemaps for multiple target languages
@@ -3158,7 +3231,7 @@
11.7 Typemaps for multiple target languages
%typemap(ruby,in) int "$1 = NUM2INT($input);" .
- 11.8 Optimal code generation when returning by value
+11.8 Optimal code generation when returning by value
@@ -3347,7 +3420,7 @@
11.8 Optimal code generation when returning b
However, it doesn't always get it right, for example when $1 is within some commented out code.
- 11.9 Multi-argument typemaps
+11.9 Multi-argument typemaps
@@ -3614,7 +3687,7 @@
11.9 Multi-argument typemaps<
the arguments to make them consecutive will need to be written.
- 11.10 Typemap warnings
+11.10 Typemap warnings
@@ -3623,7 +3696,7 @@
11.10 Typemap warnings
- 11.11 Typemap fragments
+11.11 Typemap fragments
@@ -3876,7 +3949,7 @@
11.11 Typemap fragments
with some powerful but tricky macro and fragment usage that is used in parts of the SWIG typemap library.
- 11.11.1 Fragment type specialization
+11.11.1 Fragment type specialization
@@ -3909,7 +3982,7 @@
11.11.1 Fragment type sp
- 11.11.2 Fragments and automatic typemap specialization
+11.11.2 Fragments and automatic typemap specialization
@@ -3955,7 +4028,7 @@
11.11.2 Fragments and automa
- 11.12 The run-time type checker
+11.12 The run-time type checker
@@ -3981,7 +4054,7 @@
11.12 The run-time type checker<
Modules can be unloaded from the type system.
- 11.12.1 Implementation
+11.12.1 Implementation
@@ -4167,7 +4240,7 @@
11.12.1 Implementation
structures are chained together in a circularly linked list.
- 11.12.2 Usage
+11.12.2 Usage
This section covers how to use these functions from typemaps. To learn how to
@@ -4261,7 +4334,7 @@
11.12.2 Usage
managed.
- 11.13 Typemaps and overloading
+11.13 Typemaps and overloading
@@ -4429,7 +4502,7 @@
11.13 Typemaps and overloading
Using the above table as a guide, each target language defines a collection of "typecheck" typemaps.
-The follow excerpt from the Python module illustrates this:
+The following excerpt from the Python module illustrates this:
@@ -4438,22 +4511,22 @@
11.13 Typemaps and overloading
/* Note: %typecheck(X) is a macro for %typemap(typecheck,precedence=X) */
%typecheck(SWIG_TYPECHECK_INTEGER)
- int, short, long,
- unsigned int, unsigned short, unsigned long,
- signed char, unsigned char,
- long long, unsigned long long,
- const int &, const short &, const long &,
- const unsigned int &, const unsigned short &, const unsigned long &,
- const long long &, const unsigned long long &,
- enum SWIGTYPE,
- bool, const bool &
+ int, short, long,
+ unsigned int, unsigned short, unsigned long,
+ signed char, unsigned char,
+ long long, unsigned long long,
+ const int &, const short &, const long &,
+ const unsigned int &, const unsigned short &, const unsigned long &,
+ const long long &, const unsigned long long &,
+ enum SWIGTYPE,
+ bool, const bool &
{
$1 = (PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
}
%typecheck(SWIG_TYPECHECK_DOUBLE)
- float, double,
- const float &, const double &
+ float, double,
+ const float &, const double &
{
$1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) ? 1 : 0;
}
@@ -4542,11 +4615,31 @@
11.13 Typemaps and overloading
The bottom line: If you are writing new typemaps and you are using overloaded methods, you will probably
-have to write typecheck code or copy existing code. Since this is a relatively new SWIG feature, there are
-few examples to work with. However, you might look at some of the existing library files likes 'typemaps.i' for
-a guide.
+have to write new typecheck code or copy and modify existing typecheck code.
+
+If you write a typecheck typemap and omit the precedence level, for example commenting it out as shown below:
+
+
+
+
+%typemap(typecheck /*,precedence=SWIG_TYPECHECK_INTEGER*/) int {
+ $1 = PyInt_Check($input) ? 1 : 0;
+}
+
+
+
+
+then the type is given a precedence higher than any other known precedence level and a warning is issued:
+
+
+
+
+example.i:18: Warning 467: Overloaded method foo(int) not supported (incomplete type checking rule - no precedence level in typecheck typemap for 'int').
+
+
+
Notes:
@@ -4572,7 +4665,7 @@
11.13 Typemaps and overloading
-
11.14 More about %apply and %clear
+
11.14 More about %apply and %clear
@@ -4658,7 +4751,7 @@
11.14 More about %apply and %clear<
- 11.15 Passing data between typemaps
+11.15 Passing data between typemaps
@@ -4695,7 +4788,7 @@
11.15 Passing data between typemaps
- 11.16 C++ "this" pointer
+11.16 C++ "this" pointer
@@ -4755,7 +4848,7 @@
11.16 C++ "this" pointer
the method, but gives the argument a name other than self .
- 11.17 Where to go for more information?
+11.17 Where to go for more information?
diff --git a/Doc/Manual/Varargs.html b/Doc/Manual/Varargs.html
index dac1ad7bc96..1c99804f143 100644
--- a/Doc/Manual/Varargs.html
+++ b/Doc/Manual/Varargs.html
@@ -1,12 +1,13 @@
-
+
Variable Length Arguments
+
- 14 Variable Length Arguments
+14 Variable Length Arguments
@@ -42,7 +43,7 @@ 14 Variable Length Arguments
wisely chosen to avoid this issue.
- 14.1 Introduction
+14.1 Introduction
@@ -139,7 +140,7 @@
14.1 Introduction
- 14.2 The Problem
+14.2 The Problem
@@ -232,7 +233,7 @@
14.2 The Problem
are willing to get hands dirty. Keep reading.
- 14.3 Default varargs support
+14.3 Default varargs support
@@ -301,7 +302,7 @@
14.3 Default varargs support
- 14.4 Argument replacement using %varargs
+14.4 Argument replacement using %varargs
@@ -412,7 +413,7 @@
14.4 Argument replacement using %varargs
wrappers to such functions presents special problems (covered shortly).
- 14.5 Varargs and typemaps
+14.5 Varargs and typemaps
@@ -589,7 +590,7 @@
14.5 Varargs and typemaps
security, continue to the next section.
- 14.6 Varargs wrapping with libffi
+14.6 Varargs wrapping with libffi
@@ -605,7 +606,7 @@
14.6 Varargs wrapping with libffi
One way to do this is to use a special purpose library such as libffi
(http://sources.redhat.com/libffi ).
+href="http://www.sourceware.org/libffi/">http://www.sourceware.org/libffi/).
libffi is a library that allows you to dynamically construct
call-stacks and invoke procedures in a relatively platform independent
manner. Details about the library can be found in the libffi
@@ -635,7 +636,7 @@
14.6 Varargs wrapping with libffi
PyObject *o = PyTuple_GetItem(varargs,i);
if (!PyString_Check(o)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
- free(argv);
+ free(argv);
return NULL;
}
argv[i] = PyString_AsString(o);
@@ -841,7 +842,7 @@ 14.6 Varargs wrapping with libffi
values. Please consult the chapter on each language module for more details.
- 14.7 Wrapping of va_list
+14.7 Wrapping of va_list
@@ -895,7 +896,7 @@
14.7 Wrapping of va_list
- 14.8 C++ Issues
+14.8 C++ Issues
@@ -964,7 +965,7 @@
14.8 C++ Issues
fully general wrapper to a varargs C++ member function.
- 14.9 Discussion
+14.9 Discussion
diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html
index 99b89c425df..3ec1af75740 100644
--- a/Doc/Manual/Warnings.html
+++ b/Doc/Manual/Warnings.html
@@ -1,12 +1,13 @@
-
+
Warning Messages
+
- 15 Warning Messages
+15 Warning Messages
@@ -35,7 +36,7 @@ 15 Warning Messages
- 15.1 Introduction
+15.1 Introduction
@@ -55,7 +56,7 @@
15.1 Introduction
work like you expect.
- 15.2 Warning message suppression
+15.2 Warning message suppression
@@ -147,7 +148,7 @@
15.2 Warning message suppression
- 15.3 Enabling extra warnings
+15.3 Enabling extra warnings
@@ -220,7 +221,7 @@
15.3 Enabling extra warnings
or the -w option.
- 15.4 Issuing a warning message
+15.4 Issuing a warning message
@@ -274,7 +275,7 @@
15.4 Issuing a warning message
- 15.5 Symbolic symbols
+15.5 Symbolic symbols
@@ -309,7 +310,7 @@
15.5 Symbolic symbols
- 15.6 Commentary
+15.6 Commentary
@@ -326,7 +327,7 @@
15.6 Commentary
messages.
- 15.7 Warnings as errors
+15.7 Warnings as errors
@@ -335,7 +336,7 @@
15.7 Warnings as errors
warning is encountered.
- 15.8 Message output format
+15.8 Message output format
@@ -349,15 +350,15 @@
15.8 Message output format
$ 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).
- 15.9 Warning number reference
+15.9 Warning number reference
- 15.9.1 Deprecated features (100-199)
+15.9.1 Deprecated features (100-199)
@@ -385,7 +386,7 @@ 15.9.1 Deprecated features (100-199)
126. The 'nestedworkaround' feature is deprecated.
- 15.9.2 Preprocessor (200-299)
+15.9.2 Preprocessor (200-299)
@@ -397,7 +398,7 @@ 15.9.2 Preprocessor (200-299)
206. Unexpected tokens after #directive directive.
- 15.9.3 C/C++ Parser (300-399)
+15.9.3 C/C++ Parser (300-399)
@@ -474,7 +475,7 @@ 15.9.3 C/C++ Parser (300-399)
395. operator delete[] ignored.
- 15.9.4 Types and typemaps (400-499)
+15.9.4 Types and typemaps (400-499)
@@ -492,7 +493,7 @@ 15.9.4 Types and typemaps (400-499)
464. Unsupported constant value.
465. Unable to handle type type .
466. Unsupported variable type type .
- 467. Overloaded declaration not supported (no type checking rule for 'type ')
+ 467. Overloaded declaration not supported (incomplete type checking rule - no precedence level in typecheck typemap for 'type ')
468. No 'throw' typemap defined for exception type type
469. No or improper directorin typemap defined for type
470. Thread/reentrant unsafe wrapping, consider returning by value instead.
@@ -505,7 +506,7 @@ 15.9.4 Types and typemaps (400-499)
- 15.9.5 Code generation (500-599)
+15.9.5 Code generation (500-599)
@@ -534,7 +535,7 @@ 15.9.5 Code generation (500-599)
523. Use of an illegal destructor name 'name ' in %extend is deprecated, the destructor name should be 'name '.
- 15.9.6 Language module specific (700-899)
+15.9.6 Language module specific (700-899)
@@ -585,14 +586,14 @@ 15.9.6 Language module specific (700-899)
871. Unrecognized pragma pragma . (Php).
- 15.9.7 User defined (900-999)
+15.9.7 User defined (900-999)
These numbers can be used by your own application.
- 15.10 History
+15.10 History
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index 0685242ba8f..b95105bddb8 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -1,12 +1,13 @@
-
+
Getting started on Windows
+
- 3 Getting started on Windows
+3 Getting started on Windows
@@ -52,7 +53,7 @@ 3 Getting started on Windows
- 3.1 Installation on Windows
+3.1 Installation on Windows
@@ -63,7 +64,7 @@
3.1 Installation on Windows
Set environment variables as described in the SWIG Windows Examples section in order to run examples using Visual C++.
-
3.1.1 Windows Executable
+
3.1.1 Windows Executable
@@ -72,7 +73,7 @@
3.1.1 Windows Executable
-
3.2 SWIG Windows Examples
+
3.2 SWIG Windows Examples
@@ -87,7 +88,7 @@
3.2 SWIG Windows Examples
More information on each of the examples is available with the examples distributed with SWIG (Examples/index.html).
-
3.2.1 Instructions for using the Examples with Visual Studio
+
3.2.1 Instructions for using the Examples with Visual Studio
@@ -105,7 +106,7 @@
3.2.1 Instructions for using the Example
If you are interested in how the project files are set up there is explanatory information in some of the language module's documentation.
- 3.2.1.1 C#
+3.2.1.1 C#
@@ -115,7 +116,7 @@
3.2.1.1 C#
-
3.2.1.2 Java
+
3.2.1.2 Java
@@ -129,7 +130,7 @@
3.2.1.2 Java
-
3.2.1.3 Perl
+
3.2.1.3 Perl
@@ -143,7 +144,7 @@
3.2.1.3 Perl
-
3.2.1.4 Python
+
3.2.1.4 Python
@@ -157,13 +158,13 @@
3.2.1.4 Python
-
3.2.1.5 TCL
+
3.2.1.5 TCL
TCL_INCLUDE : Set this to the directory containing tcl.h
TCL_LIB : Set this to the TCL library including path for linking
-Example using ActiveTcl 8.3.3.3
+Example using ActiveTcl 8.3.3.3
TCL_INCLUDE: D:\tcl\include
TCL_LIB: D:\tcl\lib\tcl83.lib
@@ -171,7 +172,7 @@ 3.2.1.5 TCL
-
3.2.1.6 R
+
3.2.1.6 R
@@ -185,7 +186,7 @@
3.2.1.6 R
-
3.2.1.7 Ruby
+
3.2.1.7 Ruby
@@ -199,21 +200,21 @@
3.2.1.7 Ruby
-
3.2.2 Instructions for using the Examples with other compilers
+
3.2.2 Instructions for using the Examples with other compilers
If you do not have access to Visual C++ you will have to set up project files / Makefiles for your chosen compiler. There is a section in each of the language modules detailing what needs setting up using Visual C++ which may be of some guidance. Alternatively you may want to use Cygwin as described in the following section.
-
3.3 SWIG on Cygwin and MinGW
+
3.3 SWIG on Cygwin and MinGW
SWIG can also be compiled and run using Cygwin or MinGW which provides a Unix like front end to Windows and comes free with gcc, an ANSI C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
-
3.3.1 Building swig.exe on Windows
+
3.3.1 Building swig.exe on Windows
@@ -223,7 +224,7 @@
3.3.1 Building swig.exe on Windows
Normally this is not needed, so most people will want to ignore this section.
-
3.3.1.1 Building swig.exe using MinGW and MSYS
+
3.3.1.1 Building swig.exe using MinGW and MSYS
@@ -293,9 +294,9 @@
3.3.1.1 Building swig.exe using MinGW and M
Start the MSYS command prompt and execute:
cd /
-tar -jxf msys-automake-1.8.2.tar.bz2
+tar -jxf msys-automake-1.8.2.tar.bz2
tar -jxf msys-autoconf-2.59.tar.bz2
-tar -zxf bison-2.0-MSYS.tar.gz
+tar -zxf bison-2.0-MSYS.tar.gz
@@ -341,7 +342,7 @@ 3.3.1.1 Building swig.exe using MinGW and M
- 3.3.1.2 Building swig.exe using Cygwin
+3.3.1.2 Building swig.exe using Cygwin
@@ -352,7 +353,7 @@
3.3.1.2 Building swig.exe using Cygwin
These files are generated using the
autogen.sh script and will only need regenerating in circumstances such as changing the build system.
-
3.3.1.3 Building swig.exe alternatives
+
3.3.1.3 Building swig.exe alternatives
@@ -362,7 +363,7 @@
3.3.1.3 Building swig.exe altern
- 3.3.2 Running the examples on Windows using Cygwin
+3.3.2 Running the examples on Windows using Cygwin
@@ -371,7 +372,7 @@
3.3.2 Running the examples on Windows
Follow the Unix instructions in the README file in the SWIG root directory to build the examples.
- 3.4 Microsoft extensions and other Windows quirks
+3.4 Microsoft extensions and other Windows quirks
@@ -388,6 +389,53 @@
3.4 Microsoft extensions and other Wind
__declspec(dllexport) ULONG __stdcall foo(DWORD, __int32);
+Note that if you follow Microsoft's recommendation of wrapping the
+__declspec calls in a preprocessor definition, you will need to
+make sure that the definition is included by SWIG as well, by either defining it
+manually or via a header. For example, if you have specified the
+preprocessor definition in a header named export_lib.h and include
+other headers which depend on it, you should use the %include directive
+to include the definition explicitly. For example, if you had a header file,
+bar.h , which depended on export_lib.h , your SWIG definition
+file might look like:
+
+
+// bar.i
+%module bar
+%include <windows.i>
+%include "export_lib.h"
+%include "bar.h"
+
+
+
+where export_lib.h may contain:
+
+
+
+// export_lib.h
+#define BAR_API __declspec(dllexport)
+
+
+
+and bar.h may look like:
+
+
+
+// bar.h
+#include "export_lib.h"
+BAR_API void bar_function(int, double);
+
+
+
+Using the preprocessor to remove BAR_API is a popular simpler solution:
+
+
+
+// bar.i
+%module bar
+#define BAR_API
+%include "bar.h"
+
diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters
index c5f6552541f..d94a8a3967d 100644
--- a/Doc/Manual/chapters
+++ b/Doc/Manual/chapters
@@ -36,5 +36,6 @@ Pike.html
Python.html
R.html
Ruby.html
+Scilab.html
Tcl.html
Extending.html
diff --git a/Doc/Manual/fixstyle.py b/Doc/Manual/fixstyle.py
index 1007d594985..a3609689052 100644
--- a/Doc/Manual/fixstyle.py
+++ b/Doc/Manual/fixstyle.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# Adds the SWIG stylesheet to the generated documentation on a single page
+# Replace the inline htmldoc stylesheet with the SWIG stylesheet
import sys
import string
@@ -14,11 +14,16 @@
lines = data.splitlines()
result = [ ]
+skip = False
for s in lines:
- if s == "":
+ result.append(s)
+ skip = False
data = "\n".join(result)
diff --git a/Doc/Manual/index.html b/Doc/Manual/index.html
index fbe105a7ed0..26cc81ea192 100644
--- a/Doc/Manual/index.html
+++ b/Doc/Manual/index.html
@@ -1,10 +1,11 @@
-
+
SWIG-3.0 Documentation
+
- SWIG-3.0 Documentation
+SWIG-3.0 Documentation
The SWIG documentation is available in one of the following formats.
diff --git a/Doc/Manual/linkchecker.config b/Doc/Manual/linkchecker.config
index a947b278ae2..9317a8940b7 100644
--- a/Doc/Manual/linkchecker.config
+++ b/Doc/Manual/linkchecker.config
@@ -1,5 +1,3 @@
-[checking]
-anchors=1
-
[filtering]
ignorewarnings=http-robots-denied
+ignorewarnings=https-certificate-error
diff --git a/Doc/Manual/makechap.py b/Doc/Manual/makechap.py
index 8225bfc79ef..61994e2a00e 100644
--- a/Doc/Manual/makechap.py
+++ b/Doc/Manual/makechap.py
@@ -21,7 +21,7 @@
###############################################################################
# Regexs for
-alink = re.compile(r" ", re.IGNORECASE)
+alink = re.compile(r".* ", re.IGNORECASE)
heading = re.compile(r"(_nn\d)", re.IGNORECASE)
def getheadingname(m):
@@ -38,6 +38,19 @@ def getheadingname(m):
headingname = "%s_nn%d" % (filenamebase, nameindex)
return headingname
+# Return heading - 1.1. Introduction in the examples below:
+# old style example: 1.1 Introduction
+# new style example: 1.1 Introduction
+def getheadingtext(m, s):
+ prevheadingtext_newstyle = m.group(2)
+ prevheadingtext_oldstyle = m.group(3)
+ if len(prevheadingtext_oldstyle) == 0 and len(prevheadingtext_newstyle) == 0:
+ raise RuntimeError("No heading text in line:\n%s" % s)
+ if len(prevheadingtext_oldstyle) > 0 and len(prevheadingtext_newstyle) > 0:
+ raise RuntimeError("Two heading texts, only one should be specified in line:\n%s" % s)
+ prevheadingtext = prevheadingtext_oldstyle if len(prevheadingtext_oldstyle) > 0 else prevheadingtext_newstyle
+ return prevheadingtext
+
###############################################################################
# Main program
###############################################################################
@@ -59,11 +72,11 @@ def getheadingname(m):
# Regexs for ,... sections
-h1 = re.compile(r".*?()*[\d\.\s]*(.*?) ", re.IGNORECASE)
-h2 = re.compile(r".*?()*[\d\.\s]*(.*?) ", re.IGNORECASE)
-h3 = re.compile(r".*?()*[\d\.\s]*(.*?) ", re.IGNORECASE)
-h4 = re.compile(r".*?()*[\d\.\s]*(.*?) ", re.IGNORECASE)
-h5 = re.compile(r".*?()*[\d\.\s]*(.*?) ", re.IGNORECASE)
+h1 = re.compile(r".*?(\s*[\d\s]*(.*?))*[\d\s]*(.*?) ", re.IGNORECASE)
+h2 = re.compile(r".*?(\s*[\d\.\s]*(.*?))*[\d\.\s]*(.*?) ", re.IGNORECASE)
+h3 = re.compile(r".*?(\s*[\d\.\s]*(.*?))*[\d\.\s]*(.*?) ", re.IGNORECASE)
+h4 = re.compile(r".*?(\s*[\d\.\s]*(.*?))*[\d\.\s]*(.*?) ", re.IGNORECASE)
+h5 = re.compile(r".*?(\s*[\d\.\s]*(.*?))*[\d\.\s]*(.*?) ", re.IGNORECASE)
data = open(filename).read() # Read data
open(filename+".bak","w").write(data) # Make backup
@@ -95,10 +108,10 @@ def getheadingname(m):
m = h1.match(s)
if m:
- prevheadingtext = m.group(2)
+ prevheadingtext = getheadingtext(m, s)
nameindex += 1
headingname = getheadingname(m)
- result.append(""" %d %s """ % (headingname,num,prevheadingtext))
+ result.append("""%d %s """ % (headingname,num,prevheadingtext))
result.append("@INDEX@")
section = 0
subsection = 0
@@ -109,11 +122,11 @@ def getheadingname(m):
continue
m = h2.match(s)
if m:
- prevheadingtext = m.group(2)
+ prevheadingtext = getheadingtext(m, s)
nameindex += 1
section += 1
headingname = getheadingname(m)
- result.append(""" %d.%d %s """ % (headingname,num,section, prevheadingtext))
+ result.append("""%d.%d %s """ % (headingname,num,section, prevheadingtext))
if subsubsubsection:
index += " \n"
@@ -132,11 +145,11 @@ def getheadingname(m):
continue
m = h3.match(s)
if m:
- prevheadingtext = m.group(2)
+ prevheadingtext = getheadingtext(m, s)
nameindex += 1
subsection += 1
headingname = getheadingname(m)
- result.append(""" %d.%d.%d %s """ % (headingname,num,section, subsection, prevheadingtext))
+ result.append("""%d.%d.%d %s """ % (headingname,num,section, subsection, prevheadingtext))
if subsubsubsection:
index += " \n"
@@ -151,12 +164,12 @@ def getheadingname(m):
continue
m = h4.match(s)
if m:
- prevheadingtext = m.group(2)
+ prevheadingtext = getheadingtext(m, s)
nameindex += 1
subsubsection += 1
headingname = getheadingname(m)
- result.append(""" %d.%d.%d.%d %s """ % (headingname,num,section, subsection, subsubsection, prevheadingtext))
+ result.append("""%d.%d.%d.%d %s """ % (headingname,num,section, subsection, subsubsection, prevheadingtext))
if subsubsubsection:
index += "\n"
@@ -169,11 +182,11 @@ def getheadingname(m):
continue
m = h5.match(s)
if m:
- prevheadingtext = m.group(2)
+ prevheadingtext = getheadingtext(m, s)
nameindex += 1
subsubsubsection += 1
headingname = getheadingname(m)
- result.append(""" %d.%d.%d.%d.%d %s """ % (headingname,num,section, subsection, subsubsection, subsubsubsection, prevheadingtext))
+ result.append("""%d.%d.%d.%d.%d %s """ % (headingname,num,section, subsection, subsubsection, subsubsubsection, prevheadingtext))
if subsubsubsection == 1:
index += "\n"
diff --git a/Doc/Manual/maketoc.py b/Doc/Manual/maketoc.py
index d8c4aa759b1..dc862643475 100644
--- a/Doc/Manual/maketoc.py
+++ b/Doc/Manual/maketoc.py
@@ -6,12 +6,14 @@
f = open("Contents.html","w")
print >>f, """
-
+
SWIG Users Manual
+
+
SWIG Users Manual
diff --git a/Doc/Manual/margin-left.patch b/Doc/Manual/margin-left.patch
deleted file mode 100644
index 8bef6305c32..00000000000
--- a/Doc/Manual/margin-left.patch
+++ /dev/null
@@ -1,277 +0,0 @@
-# This patch is against htmldoc 1.8.27, and it hacks in support for
-# correctly indenting the
sections in the SWIG manual.
-# This patch should only be used until the 1.9 branch of htmldoc
-# stabilizes, since the 1.9 branch includes true CSS1 support.
-#
-# This patch only affects the PDF generation, an unpatched htmldoc
-# creates the one-page html documentation just fine.
-#
-diff -Naur htmldoc-1.8.27/htmldoc/htmldoc.cxx htmldoc-1.8.27-margin-left/htmldoc/htmldoc.cxx
---- htmldoc-1.8.27/htmldoc/htmldoc.cxx 2006-03-30 14:01:20.000000000 +0100
-+++ htmldoc-1.8.27-margin-left/htmldoc/htmldoc.cxx 2013-05-11 10:11:47.428435647 +0100
-@@ -65,6 +65,8 @@
- const char *__XOS2RedirRoot(const char *);
- }
- #endif
-+
-+extern void parse_style(char *);
-
-
- /*
-@@ -1115,6 +1117,7 @@
- else if (compare_strings(argv[i], "--version", 6) == 0)
- {
- puts(SVERSION);
-+ puts("Patched with margin-left.patch");
- return (0);
- }
- else if (compare_strings(argv[i], "--webpage", 3) == 0)
-@@ -2403,6 +2406,10 @@
- }
- else if (strcmp(temp, "--cookies") == 0)
- file_cookies(temp2);
-+ else if (strcmp(temp, "--stylesheet") == 0)
-+ {
-+ parse_style(temp2);
-+ }
- }
- }
-
-diff -Naur htmldoc-1.8.27/htmldoc/Makefile htmldoc-1.8.27-margin-left/htmldoc/Makefile
---- htmldoc-1.8.27/htmldoc/Makefile 2005-10-28 21:32:59.000000000 +0100
-+++ htmldoc-1.8.27-margin-left/htmldoc/Makefile 2013-05-11 09:39:04.392367869 +0100
-@@ -36,7 +36,7 @@
- OBJS = gui.o file.o html.o htmldoc.o htmllib.o htmlsep.o \
- http.o http-addr.o http-addrlist.o http-support.o image.o \
- iso8859.o license.o md5.o progress.o ps-pdf.o rc4.o \
-- snprintf.o string.o toc.o util.o
-+ snprintf.o string.o toc.o util.o style.o
-
-
- #
-diff -Naur htmldoc-1.8.27/htmldoc/ps-pdf.cxx htmldoc-1.8.27-margin-left/htmldoc/ps-pdf.cxx
---- htmldoc-1.8.27/htmldoc/ps-pdf.cxx 2006-08-01 17:58:50.000000000 +0100
-+++ htmldoc-1.8.27-margin-left/htmldoc/ps-pdf.cxx 2013-05-11 09:37:40.096364957 +0100
-@@ -160,6 +160,7 @@
- # undef page_t
- #endif // __hpux
-
-+extern int lookup_div_class(uchar *);
-
- /*
- * Output options...
-@@ -4230,9 +4231,24 @@
- para->child = para->last_child = NULL;
- }
-
-- parse_doc(t->child, left, right, bottom, top, x, y, page, NULL,
-+ {
-+ int num_indent = 0;
-+ uchar *cname;
-+
-+ if (cname = htmlGetVariable(t, (uchar *)"class")) {
-+ num_indent = lookup_div_class(cname);
-+ *left += 5.0f * num_indent;
-+ *x = *left;
-+ }
-+
-+ parse_doc(t->child, left, right, bottom, top, x, y, page, NULL,
- needspace);
-
-+ if (num_indent > 0) {
-+ *left -= 5.0f * num_indent;
-+ }
-+ }
-+
- if (para->child != NULL)
- {
- parse_paragraph(para, *left, *right, *bottom, *top, x, y, page, *needspace);
-diff -Naur htmldoc-1.8.27/htmldoc/style.cxx htmldoc-1.8.27-margin-left/htmldoc/style.cxx
---- htmldoc-1.8.27/htmldoc/style.cxx 1970-01-01 01:00:00.000000000 +0100
-+++ htmldoc-1.8.27-margin-left/htmldoc/style.cxx 2013-05-11 09:37:40.096364957 +0100
-@@ -0,0 +1,185 @@
-+/* Extreamly simple parsing routines for CSS style sheets.
-+ * We only parse div.class { } sections, and only look
-+ * for margin-left:
em;
-+ *
-+ * Copyright (C) 2005 John Lenz
-+ *
-+ * Released under GNU GPL v2 or above.
-+ */
-+
-+#include
-+#include
-+#include
-+#include
-+#include
-+
-+#include "types.h"
-+
-+#define BUFF_SIZE 512
-+
-+struct div_entry {
-+ uchar class_name[BUFF_SIZE];
-+ int indent;
-+ struct div_entry *next;
-+};
-+
-+static struct div_entry *head = 0;
-+
-+/* These are the parsing states */
-+#define IGNORE_TILL_SEMI 0
-+#define IGNORE_TILL_CLOSE_BRACE 1
-+#define READING_DIV 2
-+#define READING_CLASS 3
-+#define READING_ATTRIBUTE 4
-+#define READING_NUM 5
-+#define CHECKING_ONLY_DIV 6
-+
-+static int at_eof = 0;
-+
-+static int strucmp(uchar *a, uchar *b) {
-+ int i;
-+ for (i = 0; a[i] && b[i]; i++) {
-+ if (a[i] < b[i]) return -1;
-+ if (a[i] > b[i]) return 1;
-+ }
-+ /* This isn't right, but who cares...*/
-+ if (a[i] || b[i]) return 1;
-+ return 0;
-+}
-+
-+static int read_word(FILE *f, const char *word) {
-+ char c;
-+ for (int idx = 0; word[idx]; idx++) {
-+ c = getc(f);
-+ if (c == EOF) {
-+ at_eof = 1;
-+ return 0;
-+ }
-+ if (c != word[idx])
-+ return 0;
-+ }
-+ return 1;
-+}
-+
-+int lookup_div_class(uchar *name) {
-+ struct div_entry *node = head;
-+
-+ while (node) {
-+ if (strucmp(node->class_name, name) == 0)
-+ return node->indent;
-+ node = node->next;
-+ }
-+
-+ return 0;
-+}
-+
-+void parse_style(char *fname) {
-+ FILE *f;
-+ char c;
-+ int state;
-+ struct div_entry *cur = 0;
-+ int class_idx = 0;
-+ char num[BUFF_SIZE];
-+ int num_idx = 0;
-+
-+ if (!fname) return;
-+
-+ f = fopen(fname, "r");
-+ if (!f) {
-+ fprintf(stderr, "Unable to parse style\n");
-+ return;
-+ }
-+
-+ state = READING_DIV;
-+ while (!at_eof && (c = getc(f)) != EOF) {
-+ switch (state) {
-+
-+ case IGNORE_TILL_SEMI:
-+ if (c == ';')
-+ state = READING_ATTRIBUTE;
-+ break;
-+
-+ case IGNORE_TILL_CLOSE_BRACE:
-+ if (c == '}')
-+ state = READING_DIV;
-+ break;
-+
-+ case READING_DIV:
-+ if (c != ' ' && c != '\t' && c != '\n') {
-+ if (c == 'd' && read_word(f, "iv.")) {
-+ state = READING_CLASS;
-+ cur = (struct div_entry *) malloc(sizeof(struct div_entry));
-+ memset(cur, 0, sizeof(struct div_entry));
-+ class_idx = 0;
-+ } else
-+ state = IGNORE_TILL_CLOSE_BRACE;
-+ }
-+ break;
-+
-+ case READING_CLASS:
-+ if (isalpha(c)) {
-+ if (class_idx >= BUFF_SIZE-1) {
-+ fprintf(stderr, "class size %s too long\n", cur->class_name);
-+ free(cur);
-+ state = IGNORE_TILL_CLOSE_BRACE;
-+ } else {
-+ cur->class_name[class_idx++] = c;
-+ }
-+ } else {
-+ if (c == '{') {
-+ cur->next = head;
-+ head = cur;
-+ state = READING_ATTRIBUTE;
-+ } else
-+ state = CHECKING_ONLY_DIV;
-+ }
-+ break;
-+
-+ case READING_ATTRIBUTE:
-+ if (c != ' ' && c != '\t' && c != '\n') {
-+ if (c == '}')
-+ state = READING_DIV;
-+ else {
-+ if (c == 'm' && read_word(f, "argin-left:")) {
-+ num_idx = 0;
-+ memset(num, 0, sizeof(num));
-+ state = READING_NUM;
-+ } else {
-+ state = IGNORE_TILL_SEMI;
-+ }
-+ }
-+ }
-+ break;
-+
-+ case READING_NUM:
-+ if (isdigit(c)) {
-+ if (num_idx >= BUFF_SIZE - 1) {
-+ fprintf(stderr, "Number too long\n");
-+ state = IGNORE_TILL_SEMI;
-+ } else {
-+ num[num_idx++] = c;
-+ }
-+ } else if (c != ' ' && c != '\t') {
-+ if (num_idx > 0 && c == 'e' && read_word(f, "m"))
-+ cur->indent = atoi(num);
-+ state = IGNORE_TILL_SEMI;
-+ }
-+ break;
-+
-+ case CHECKING_ONLY_DIV:
-+ if (c != ' ' && c != '\t' && c != '\n') {
-+ if (c == '{') {
-+ cur->next = head;
-+ head = cur;
-+ state = READING_ATTRIBUTE;
-+ } else {
-+ free(cur);
-+ state = IGNORE_TILL_CLOSE_BRACE;
-+ }
-+ }
-+ break;
-+ }
-+ }
-+
-+ fclose(f);
-+}
diff --git a/Doc/Manual/style.css b/Doc/Manual/style.css
index 02329e56fce..45e51e35b77 100644
--- a/Doc/Manual/style.css
+++ b/Doc/Manual/style.css
@@ -32,6 +32,7 @@ div.code {
margin-left: 4em;
margin-right: 4em;
background-color: #F0FFFF;
+ font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
}
div.targetlang {
@@ -41,9 +42,9 @@ div.targetlang {
margin-left: 4em;
margin-right: 4em;
background-color: #d7f6bb;
+ font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
}
-
div.shell {
border-style: solid;
border-width: 1px;
@@ -51,6 +52,7 @@ div.shell {
margin-left: 4em;
margin-right: 4em;
background-color: #DCDCDC;
+ font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
}
div.diagram {
@@ -60,6 +62,7 @@ div.diagram {
margin-left: 4em;
margin-right: 4em;
background-color: #FFEBCD;
+ font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
}
ul li p {
@@ -82,3 +85,8 @@ div.indent p {
margin-right: 0;
}
+pre, code, tt {
+ font-family: "Courier New", Courier, "Courier 10 Pitch", monospace;
+}
+
+body { font-family: serif; }
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 2cb2d6eb564..68a1991cc8a 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -58,7 +58,13 @@ INTERFACE =
INTERFACEDIR =
INTERFACEPATH = $(SRCDIR)$(INTERFACEDIR)$(INTERFACE)
SWIGOPT =
-SWIG = swig
+
+# SWIG_LIB_DIR and SWIGEXE must be explicitly set by Makefiles using this Makefile
+SWIG_LIB_DIR = ./Lib
+SWIGEXE = swig
+SWIG_LIB_SET = @SWIG_LIB_SET@
+SWIGTOOL =
+SWIG = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
LIBM = @LIBM@
LIBC = @LIBC@
@@ -133,6 +139,13 @@ distclean:
rm -f d/example.mk
rm -f xml/Makefile
+##################################################################
+# Very generic invocation of swig
+##################################################################
+
+swiginvoke:
+ $(SWIG) $(SWIGOPT)
+
##################################################################
##### Tcl/Tk ######
##################################################################
@@ -321,6 +334,9 @@ else
SWIGPYTHON = $(SWIG) -python -py3
endif
+PEP8 = @PEP8@
+PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391
+
# ----------------------------------------------------------------
# Build a C dynamically loadable module
# ----------------------------------------------------------------
@@ -373,8 +389,10 @@ endif
PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'`
python_run: $(PYSCRIPT)
- export PYTHONPATH=".:$$PYTHONPATH"; \
- $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE)
+ifneq (,$(PEP8))
+ $(PEP8) $(PEP8_FLAGS) $(PYSCRIPT)
+endif
+ env PYTHONPATH=$$PWD $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE)
ifneq (,$(SRCDIR))
$(RUNME).py: $(SRCDIR)$(RUNME).py
@@ -542,11 +560,10 @@ guile: $(SRCDIR_SRCS)
$(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS)
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
-guile_cpp: $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
-$(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCDIR_SRCS)
+guile_cpp: $(SRCDIR_SRCS)
$(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS)
- $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $@
+ $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO)
guile_externalhdr:
$(SWIG) -guile -external-runtime $(TARGET)
@@ -653,7 +670,7 @@ java_cpp: $(SRCDIR_SRCS)
# ----------------------------------------------------------------
java_compile: $(SRCDIR_SRCS)
- $(COMPILETOOL) $(JAVAC) $(JAVACFLAGS) $(addprefix $(SRCDIR),$(JAVASRCS))
+ $(COMPILETOOL) $(JAVAC) $(addprefix $(SRCDIR),$(JAVASRCS))
# -----------------------------------------------------------------
# Run java example
@@ -941,7 +958,7 @@ OCAMLFIND=@OCAMLFIND@
OCAMLMKTOP=@OCAMLMKTOP@ $(SWIGWHERE)
NOLINK ?= false
OCAMLPP= -pp "camlp4o ./swigp4.cmo"
-OCAMLP4WHERE=`$(COMPILETOOL) camlp4 -where`
+OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where`
OCAMLCORE=\
rm -rf swig.mli swig.ml swigp4.ml && \
$(SWIG) -ocaml -co swig.mli 2>/dev/null && \
@@ -1136,7 +1153,7 @@ ruby_cpp_static: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
ruby_run:
- $(RUNTOOL) $(RUBY) -I. $(RUBY_SCRIPT) $(RUNPIPE)
+ $(RUNTOOL) $(RUBY) $(RUBYFLAGS) -I. $(RUBY_SCRIPT) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -1403,6 +1420,8 @@ CSHARPCOMPILER = @CSHARPCOMPILER@
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
CSHARPCFLAGS = @CSHARPCFLAGS@
+CSHARPFLAGS =
+CSHARPOPTIONS =
CSHARPSO = @CSHARPSO@
CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME).exe
@@ -1435,7 +1454,7 @@ SRCDIR_CSHARPSRCS =
endif
csharp_compile: $(SRCDIR_SRCS)
- $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS)
+ $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPOPTIONS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS)
# -----------------------------------------------------------------
# Run CSharp example
@@ -1498,6 +1517,12 @@ lua_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS)
$(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(INCLUDES) $(LUA_INCLUDE)
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO)
+lua_externalhdr:
+ $(SWIG) -lua -external-runtime $(TARGET)
+
+lua_swig_cpp:
+ $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+
# -----------------------------------------------------------------
# Build statically linked Lua interpreter
# -----------------------------------------------------------------
@@ -1702,7 +1727,7 @@ R = R
RCXXSRCS = $(INTERFACE:.i=_wrap.cpp) #Need to use _wrap.cpp for R build system as it does not understand _wrap.cxx
RRSRC = $(INTERFACE:.i=.R)
R_CFLAGS=-fPIC
-R_SCRIPT=$(RUNME).R
+R_SCRIPT=$(SRCDIR)$(RUNME).R
# need to compile .cxx files outside of R build system to make sure that
# we get -fPIC
@@ -1722,7 +1747,6 @@ endif
# ----------------------------------------------------------------
# Build a R dynamically loadable module (C++)
# ----------------------------------------------------------------
-
r_cpp: $(SRCDIR_CXXSRCS)
$(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH)
ifneq ($(SRCDIR_CXXSRCS),)
@@ -1754,32 +1778,92 @@ 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) -g -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) -g -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=$$PWD $(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 ######
##################################################################
+# TODO: The Go make targets need simplifying to use configure time
+# configuration or to use Make's ifeq rather than using lots of
+# runtime shell code. The output will then be a lot less verbose.
+
GO = @GO@
GOGCC = @GOGCC@
+GCCGO = @GCCGO@
GO1 = @GO1@
GO12 = @GO12@
GO13 = @GO13@
+GO15 = @GO15@
GOC = @GOC@
GOOPT = @GOOPT@
+GCCGOOPT = @GCCGOOPT@
GOVERSIONOPTION = @GOVERSIONOPTION@
GOSWIGARG = `if $(GOGCC) ; then echo -gccgo; fi`
-GOCOMPILEARG = `if $(GOGCC) ; then echo -c -g; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) ; then echo -pack ; fi`
+GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi` `if $(GO13) || $(GO15); then echo -pack ; fi`
GOSRCS = $(INTERFACE:.i=.go)
GOCSRCS = $(INTERFACE:.i=_gc.c)
-GOLD = $(GOC:c=l)
+GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
GOTOOL = `if $(GO1) ; then echo go tool; fi`
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-GOPACKAGE = $(INTERFACE:.i=.a)
+GOPACKAGE = $(notdir $(INTERFACE:.i=.a))
+
+GOPATHDIR = gopath/src/$(INTERFACE:.i=)
-GOOBJEXT = $(GOC:c=)
+GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
GOGCOBJS = $(GOSRCS:.go=.$(GOOBJEXT))
GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
@@ -1787,19 +1871,21 @@ GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@)
# Build a Go module (C)
# ----------------------------------------------------------------
-go: $(SRCDIR_SRCS)
+go_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GOGCC); then \
+ if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
$(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
else \
$(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \
$(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
fi
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS)
- if ! $(GOGCC) ; then \
+ if $(GOGCC) ; then \
+ $(COMPILETOOL) $(GCCGO) -g -c -I . $(GOSRCS); \
+ else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS); \
$(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
rm -f $(GOPACKAGE); \
- if $(GO13); then \
+ if $(GO13) || $(GO15); then \
cp $(GOGCOBJS) $(GOPACKAGE); \
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
elif $(GO12); then \
@@ -1809,12 +1895,54 @@ go: $(SRCDIR_SRCS)
fi; \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
if $(GOGCC) ; then \
- $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
- elif $(GO12) || $(GO13); then \
+ $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
+ $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
+ fi; \
+ fi
+
+go: $(SRCDIR_SRCS)
+ $(SWIG) -go -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/src 2>/dev/null || true
+ @mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
+ rm -f $(GOPATHDIR)/*
+ cp $(ISRCS) $(GOPATHDIR)/
+ if test -f $(IWRAP:.i=.h); then \
+ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_SRCS)"; then \
+ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
+ fi
+ cp $(GOSRCS) $(GOPATHDIR)/
+ GOPATH=`pwd`/gopath; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd $(GOPATHDIR)/ && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
+ if $(GOGCC); then \
+ cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ if $(GOGCC) ; then \
+ $(COMPILETOOL) $(GCCGO) -c -g $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE); \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
+ else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
fi
@@ -1823,19 +1951,29 @@ go: $(SRCDIR_SRCS)
# Build a Go module (C++)
# ----------------------------------------------------------------
-go_cpp: $(SRCDIR_SRCS)
+go_cpp_nocgo: $(SRCDIR_SRCS)
$(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
- if $(GO12) || $(GO13) || $(GOGCC); then \
- $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
+ if $(GO12) || $(GO13) || $(GO15) || $(GOGCC); then \
+ if test -n "$(SRCDIR_CXXSRCS)$(SRCDIR_SRCS)"; then \
+ $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_CXXSRCS) $(SRCDIR_SRCS) $(INCLUDES); \
+ fi; \
+ $(foreach f,$(ICXXSRCS), \
+ $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .@OBJEXT@,$(basename $f)) $f $(INCLUDES); \
+ ) \
else \
$(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \
$(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \
fi
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS)
if ! $(GOGCC) ; then \
- $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} $(GOCSRCS); \
+ $(foreach f,$(GOSRCS), \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f \
+ ); \
+ $(foreach f,$(GOCSRCS), \
+ $(COMPILETOOL) $(GOTOOL) $(GOC) -I $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`} \
+ -o $(addsuffix .$(GOOBJEXT),$(basename $f)) $f; \
+ ) \
rm -f $(GOPACKAGE); \
- if $(GO13); then \
+ if $(GO13) || $(GO15); then \
cp $(GOGCOBJS) $(GOPACKAGE); \
$(COMPILETOOL) $(GOPACK) r $(GOPACKAGE) $(GOCSRCS:.c=.$(GOOBJEXT)) $(OBJS) $(IOBJS); \
elif $(GO12); then \
@@ -1843,14 +1981,65 @@ go_cpp: $(SRCDIR_SRCS)
else \
$(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \
fi; \
+ else \
+ $(foreach f,$(GOSRCS), \
+ $(COMPILETOOL) $(GCCGO) -g -c -I . -o $(addsuffix .@OBJEXT@,$(basename $f)) $f \
+ ); \
+ fi
+ if test -f $(SRCDIR)$(RUNME).go; then \
+ if $(GOGCC) ; then \
+ $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
+ else \
+ $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
+ fi; \
+ fi
+
+go_cpp: $(SRCDIR_SRCS)
+ $(SWIG) -go -c++ -cgo $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
+ @mkdir gopath 2>/dev/null || true
+ @mkdir gopath/src 2>/dev/null || true
+ @mkdir gopath/src/$(INTERFACE:.i=) 2>/dev/null || true
+ rm -f $(GOPATHDIR)/*
+ cp $(ICXXSRCS) $(GOPATHDIR)/
+ if test -f $(IWRAP:.i=.h); then \
+ cp $(IWRAP:.i=.h) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_CXXSRCS)"; then \
+ cp $(SRCDIR_CXXSRCS) $(GOPATHDIR)/; \
+ fi
+ if test -n "$(SRCDIR_SRCS)"; then \
+ cp $(SRCDIR_SRCS) $(GOPATHDIR)/; \
+ fi
+ cp $(GOSRCS) $(GOPATHDIR)/
+ GOPATH=`pwd`/gopath; \
+ export GOPATH; \
+ CGO_CPPFLAGS="$(CPPFLAGS) $(INCLUDES) -I `cd $(SRCDIR) && pwd` -I `pwd`"; \
+ export CGO_CPPFLAGS; \
+ CGO_CFLAGS="$(CFLAGS)"; \
+ export CGO_CFLAGS; \
+ CGO_CXXFLAGS="$(CXXFLAGS)"; \
+ export CGO_CXXFLAGS; \
+ CGO_LDFLAGS="$(LDFLAGS) -lm"; \
+ export CGO_LDFLAGS; \
+ (cd $(GOPATHDIR) && $(COMPILETOOL) $(GO) build `if $(GOGCC); then echo -compiler=gccgo; fi` -o $(GOPACKAGE))
+ cp $(GOPATHDIR)/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE)
+ if $(GOGCC); then \
+ cp $(dir $(INTERFACE))/$(GOPACKAGE) $(dir $(INTERFACE))/$(GOPACKAGE:.a=.gox); \
fi
if test -f $(SRCDIR)$(RUNME).go; then \
- $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
if $(GOGCC) ; then \
- $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \
- elif $(GO12) || $(GO13); then \
+ $(COMPILETOOL) $(GCCGO) -g -c $(SRCDIR)$(RUNME).go; \
+ $(COMPILETOOL) $(GCCGO) -o $(RUNME) $(RUNME).@OBJEXT@ $(dir $(INTERFACE))/$(GOPACKAGE) -lstdc++; \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -o $(RUNME).$(GOOBJEXT) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \
else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \
fi; \
fi
@@ -1860,7 +2049,7 @@ go_cpp: $(SRCDIR_SRCS)
# -----------------------------------------------------------------
go_run:
- env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) ./$(RUNME) $(RUNPIPE)
+ env $(RUNTOOL) ./$(RUNME) $(RUNPIPE)
# -----------------------------------------------------------------
# Version display
@@ -1874,7 +2063,8 @@ go_version:
# -----------------------------------------------------------------
go_clean:
- rm -f *_wrap* *_gc* .~* $(RUNME) $(GOSRCS)
+ rm -f *_wrap* *_gc* *.gox .~* $(RUNME) $(GOSRCS)
+ rm -rf gopath
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *.[568] *.a *@SO@
diff --git a/Examples/android/class/Makefile b/Examples/android/class/Makefile
index 574566623d6..8b5a090e956 100644
--- a/Examples/android/class/Makefile
+++ b/Examples/android/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
@@ -13,8 +14,9 @@ TARGETID = 1
check: build
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp
install:
diff --git a/Examples/android/extend/Makefile b/Examples/android/extend/Makefile
index fb974d22ccd..19d90eccafe 100644
--- a/Examples/android/extend/Makefile
+++ b/Examples/android/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
@@ -13,8 +14,9 @@ TARGETID = 1
check: build
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp
install:
diff --git a/Examples/android/simple/Makefile b/Examples/android/simple/Makefile
index 2bf41968a8d..46bcd93ca61 100644
--- a/Examples/android/simple/Makefile
+++ b/Examples/android/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
@@ -13,8 +14,9 @@ TARGETID = 1
check: build
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android
install:
diff --git a/Examples/chicken/class/Makefile b/Examples/chicken/class/Makefile
index a37ea4a8550..ea2d8b62edf 100644
--- a/Examples/chicken/class/Makefile
+++ b/Examples/chicken/class/Makefile
@@ -1,17 +1,18 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-INTERFACE = example.i
-SRCS =
-CXXSRCS = example.cxx
-TARGET = class
-INCLUDE =
-SWIGOPT =
-VARIANT =
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+INTERFACE = example.i
+SRCS =
+CXXSRCS = example.cxx
+TARGET = class
+INCLUDE =
+SWIGOPT =
+VARIANT =
# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
#CHICKEN_MAIN = runme-lowlevel.scm
#CHICKEN_MAIN = runme-tinyclos.scm
-#VARIANT = _static
+#VARIANT = _static
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run
@@ -22,14 +23,16 @@ build: $(TARGET) $(TARGET)_proxy
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
$(TARGET)_proxy: $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT) -proxy' TARGET='$(TARGET)_proxy' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
diff --git a/Examples/chicken/constants/Makefile b/Examples/chicken/constants/Makefile
index 7167e866bd3..2fdde0a58a9 100644
--- a/Examples/chicken/constants/Makefile
+++ b/Examples/chicken/constants/Makefile
@@ -1,12 +1,13 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-INTERFACE = example.i
-SRCS =
-CXXSRCS =
-TARGET = constants
-INCLUDE =
-SWIGOPT =
-VARIANT =
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+INTERFACE = example.i
+SRCS =
+CXXSRCS =
+TARGET = constants
+INCLUDE =
+SWIGOPT =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
@@ -20,8 +21,9 @@ build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
diff --git a/Examples/chicken/egg/Makefile b/Examples/chicken/egg/Makefile
index 55aa114ebb1..0137dc0a74f 100644
--- a/Examples/chicken/egg/Makefile
+++ b/Examples/chicken/egg/Makefile
@@ -1,4 +1,6 @@
-SWIG = ../../../preinst-swig
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
check: build
cd eggs/install && csi ../../test.scm
@@ -14,7 +16,7 @@ single: single_wrap.cxx
# compile the single module with -nounit
single_wrap.cxx: single.i
- $(SWIG) -chicken -c++ -proxy -nounit single.i
+ $(SWIGEXE) -chicken -c++ -proxy -nounit single.i
# Now build both mod1 and mod2 into a single egg
multi: mod1_wrap.cxx mod2_wrap.cxx
@@ -23,10 +25,10 @@ multi: mod1_wrap.cxx mod2_wrap.cxx
rm -f mod1.scm mod1_wrap.cxx mod2.scm mod2_wrap.cxx
mod1_wrap.cxx: mod1.i
- $(SWIG) -chicken -c++ -proxy mod1.i
+ $(SWIGEXE) -chicken -c++ -proxy mod1.i
mod2_wrap.cxx: mod2.i
- $(SWIG) -chicken -c++ -proxy mod2.i
+ $(SWIGEXE) -chicken -c++ -proxy mod2.i
clean:
rm -rf eggs
diff --git a/Examples/chicken/multimap/Makefile b/Examples/chicken/multimap/Makefile
index e8192e9cda0..551d1c74d0a 100644
--- a/Examples/chicken/multimap/Makefile
+++ b/Examples/chicken/multimap/Makefile
@@ -1,16 +1,17 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-INTERFACE = example.i
-SRCS = example.c
-CXXSRCS =
-TARGET = multimap
-INCLUDE =
-SWIGOPT =
-VARIANT =
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+INTERFACE = example.i
+SRCS = example.c
+CXXSRCS =
+TARGET = multimap
+INCLUDE =
+SWIGOPT =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
+#VARIANT = _static
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
@@ -20,8 +21,9 @@ build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
diff --git a/Examples/chicken/overload/Makefile b/Examples/chicken/overload/Makefile
index a9647d93e55..019390192c3 100644
--- a/Examples/chicken/overload/Makefile
+++ b/Examples/chicken/overload/Makefile
@@ -1,16 +1,17 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-INTERFACE = example.i
-SRCS =
-CXXSRCS = example.cxx
-TARGET = overload
-INCLUDE =
-SWIGOPT = -proxy -unhideprimitive
-VARIANT =
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+INTERFACE = example.i
+SRCS =
+CXXSRCS = example.cxx
+TARGET = overload
+INCLUDE =
+SWIGOPT = -proxy -unhideprimitive
+VARIANT =
# uncomment the following lines to build a static exe
#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
+#VARIANT = _static
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
@@ -20,8 +21,9 @@ build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
diff --git a/Examples/chicken/simple/Makefile b/Examples/chicken/simple/Makefile
index c07075efae2..f5dd1a9669a 100644
--- a/Examples/chicken/simple/Makefile
+++ b/Examples/chicken/simple/Makefile
@@ -1,16 +1,17 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-INTERFACE = example.i
-SRCS = example.c
-CXXSRCS =
-TARGET = simple
-INCLUDE =
-SWIGOPT =
-VARIANT =
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+INTERFACE = example.i
+SRCS = example.c
+CXXSRCS =
+TARGET = simple
+INCLUDE =
+SWIGOPT =
+VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = runme.scm
-#VARIANT = _static
+#VARIANT = _static
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run
@@ -20,8 +21,9 @@ build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
- SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
+ INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
diff --git a/Examples/csharp/arrays/Makefile b/Examples/csharp/arrays/Makefile
index e5d733d356f..66b2c2171e0 100644
--- a/Examples/csharp/arrays/Makefile
+++ b/Examples/csharp/arrays/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/callback/Makefile b/Examples/csharp/callback/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/callback/Makefile
+++ b/Examples/csharp/callback/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/callback/example.i b/Examples/csharp/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/csharp/callback/example.i
+++ b/Examples/csharp/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/csharp/class/Makefile b/Examples/csharp/class/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/class/Makefile
+++ b/Examples/csharp/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/enum/Makefile b/Examples/csharp/enum/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/enum/Makefile
+++ b/Examples/csharp/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/extend/Makefile b/Examples/csharp/extend/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/extend/Makefile
+++ b/Examples/csharp/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/funcptr/Makefile b/Examples/csharp/funcptr/Makefile
index 99cdfa38a91..9af1d66ff12 100644
--- a/Examples/csharp/funcptr/Makefile
+++ b/Examples/csharp/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/nested/Makefile b/Examples/csharp/nested/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/nested/Makefile
+++ b/Examples/csharp/nested/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/reference/Makefile b/Examples/csharp/reference/Makefile
index 4f4c84b9a34..c7f264ecc3b 100644
--- a/Examples/csharp/reference/Makefile
+++ b/Examples/csharp/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/simple/Makefile b/Examples/csharp/simple/Makefile
index 99cdfa38a91..9af1d66ff12 100644
--- a/Examples/csharp/simple/Makefile
+++ b/Examples/csharp/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/template/Makefile b/Examples/csharp/template/Makefile
index 2d0e070094c..010447fe287 100644
--- a/Examples/csharp/template/Makefile
+++ b/Examples/csharp/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/csharp/variables/Makefile b/Examples/csharp/variables/Makefile
index 99cdfa38a91..9af1d66ff12 100644
--- a/Examples/csharp/variables/Makefile
+++ b/Examples/csharp/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
diff --git a/Examples/d/callback/example.i b/Examples/d/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/d/callback/example.i
+++ b/Examples/d/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/d/example.mk.in b/Examples/d/example.mk.in
index a1d9a85fce4..84b3ceb0921 100644
--- a/Examples/d/example.mk.in
+++ b/Examples/d/example.mk.in
@@ -23,7 +23,8 @@ endif
EXAMPLES_TOP = ../../..
SWIG_TOP = ../../../..
-SWIG = $(SWIG_TOP)/preinst-swig
+SWIGEXE = $(SWIG_TOP)/swig
+SWIG_LIB_DIR = $(SWIG_TOP)/$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
EXTRA_CFLAGS =
EXTRA_CXXFLAGS =
EXTRA_LDFLAGS =
@@ -44,11 +45,17 @@ check: build
build:
mkdir -p $(VERSION_DIR)
if [ -f $(SRCDIR)example.cxx ]; then \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CXXFLAGS='$(EXTRA_CXXFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' CXXSRCS='example.cxx' d_cpp; \
+ $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CXXFLAGS='$(EXTRA_CXXFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' CXXSRCS='example.cxx' d_cpp; \
elif [ -f $(SRCDIR)example.c ]; then \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='example.c' d; \
+ $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='example.c' d; \
else \
- $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='' d; \
+ $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='' d; \
fi
$(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile
diff --git a/Examples/go/callback/Makefile b/Examples/go/callback/Makefile
index bf5275f14df..86047367c76 100644
--- a/Examples/go/callback/Makefile
+++ b/Examples/go/callback/Makefile
@@ -1,6 +1,8 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = callback.cxx
+GOSRCS = gocallback.go
TARGET = example
INTERFACE = example.i
SWIGOPT =
@@ -9,8 +11,16 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ if [ -n '$(SRCDIR)' ]; then \
+ cp $(GOSRCS:%=$(SRCDIR)/%) .; \
+ fi
+ @# Note: example.go gets generated by SWIG
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' GOSRCS='example.go $(GOSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
+ if [ -n '$(SRCDIR)' ]; then \
+ rm -f $(GOSRCS); \
+ fi
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean
diff --git a/Examples/go/callback/example.h b/Examples/go/callback/example.h
index 1a0e8c4322a..74ddad954a3 100644
--- a/Examples/go/callback/example.h
+++ b/Examples/go/callback/example.h
@@ -20,4 +20,3 @@ class Caller {
void setCallback(Callback *cb) { delCallback(); _callback = cb; }
void call() { if (_callback) _callback->run(); }
};
-
diff --git a/Examples/go/callback/example.i b/Examples/go/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/go/callback/example.i
+++ b/Examples/go/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/go/callback/gocallback.go b/Examples/go/callback/gocallback.go
new file mode 100644
index 00000000000..20fd0627a2b
--- /dev/null
+++ b/Examples/go/callback/gocallback.go
@@ -0,0 +1,41 @@
+package example
+
+import (
+ "fmt"
+)
+
+type GoCallback interface {
+ Callback
+ deleteCallback()
+ IsGoCallback()
+}
+
+type goCallback struct {
+ Callback
+}
+
+func (p *goCallback) deleteCallback() {
+ DeleteDirectorCallback(p.Callback)
+}
+
+func (p *goCallback) IsGoCallback() {}
+
+type overwrittenMethodsOnCallback struct {
+ p Callback
+}
+
+func NewGoCallback() GoCallback {
+ om := &overwrittenMethodsOnCallback{}
+ p := NewDirectorCallback(om)
+ om.p = p
+
+ return &goCallback{Callback: p}
+}
+
+func DeleteGoCallback(p GoCallback) {
+ p.deleteCallback()
+}
+
+func (p *goCallback) Run() {
+ fmt.Println("GoCallback.Run")
+}
diff --git a/Examples/go/callback/index.html b/Examples/go/callback/index.html
index b053cf54707..9a53065b0e0 100644
--- a/Examples/go/callback/index.html
+++ b/Examples/go/callback/index.html
@@ -12,67 +12,17 @@
Implementing C++ callbacks in Go
-This example illustrates how to use directors to implement C++
-callbacks in Go.
-
-
-
-Because Go and C++ use inheritance differently, you must call a
-different function to create a class which uses callbacks. Instead of
-calling the usual constructor function whose name is New
-followed by the capitalized name of the class, you call a function
-named NewDirector followed by the capitalized name of the
-class.
-
-
-
-The first argument to the NewDirector function is an instance
-of a type. The NewDirector function will return an interface
-value as usual. However, when calling any method on the returned
-value, the program will first check whether the value passed
-to NewDirector implements that method. If it does, the
-method will be called in Go. This is true whether the method is
-called from Go code or C++ code.
-
-
-
-Note that the Go code will be called with just the Go value, not the
-C++ value. If the Go code needs to call a C++ method on itself, you
-need to get a copy of the C++ object. This is typically done as
-follows:
-
-
-
-type Child struct { abi Parent }
-func (p *Child) ChildMethod() {
- p.abi.ParentMethod()
-}
-func f() {
- p := &Child{nil}
- d := NewDirectorParent(p)
- p.abi = d
- ...
-}
-
-
-
-In other words, we first create the Go value. We pass that to
-the NewDirector function to create the C++ value; this C++
-value will be created with an association to the Go value. We then
-store the C++ value in the Go value, giving us the reverse
-association. That permits us to call parent methods from the child.
-
-
-
-
-To delete a director object, use the function DeleteDirector
-followed by the capitalized name of the class.
+This example illustrates how to use directors to implement C++ callbacks in Go.
+See the Go Director
+Classes documentation subsection for an in-depth explanation how to use the
+director feature.
diff --git a/Examples/go/callback/runme.go b/Examples/go/callback/runme.go
index 2eef77fdbe0..03ab0c5e259 100644
--- a/Examples/go/callback/runme.go
+++ b/Examples/go/callback/runme.go
@@ -16,26 +16,18 @@ func main() {
caller.Call()
caller.DelCallback()
- callback = NewDirectorCallback(new(GoCallback))
+ go_callback := NewGoCallback()
fmt.Println()
fmt.Println("Adding and calling a Go callback")
- fmt.Println("------------------------------------")
+ fmt.Println("--------------------------------")
- caller.SetCallback(callback)
+ caller.SetCallback(go_callback)
caller.Call()
caller.DelCallback()
- // Test that a double delete does not occur as the object has
- // already been deleted from the C++ layer.
- DeleteDirectorCallback(callback)
+ DeleteGoCallback(go_callback)
fmt.Println()
fmt.Println("Go exit")
}
-
-type GoCallback struct{}
-
-func (p *GoCallback) Run() {
- fmt.Println("GoCallback.Run")
-}
diff --git a/Examples/go/check.list b/Examples/go/check.list
index 5399b89794c..b3f34b30639 100644
--- a/Examples/go/check.list
+++ b/Examples/go/check.list
@@ -2,6 +2,7 @@
callback
class
constants
+director
enum
extend
funcptr
diff --git a/Examples/go/class/Makefile b/Examples/go/class/Makefile
index de067cdd8af..f72c067e617 100644
--- a/Examples/go/class/Makefile
+++ b/Examples/go/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = class.cxx
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
diff --git a/Examples/go/constants/Makefile b/Examples/go/constants/Makefile
index 8fb07fd6bea..b791fc9cfb3 100644
--- a/Examples/go/constants/Makefile
+++ b/Examples/go/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/go/director/Makefile b/Examples/go/director/Makefile
new file mode 100644
index 00000000000..430cac8341a
--- /dev/null
+++ b/Examples/go/director/Makefile
@@ -0,0 +1,26 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+CXXSRCS =
+GOSRCS = director.go
+TARGET = example
+INTERFACE = example.i
+SWIGOPT =
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
+
+build:
+ if [ -n '$(SRCDIR)' ]; then \
+ cp $(GOSRCS:%=$(SRCDIR)/%) .; \
+ fi
+ @# Note: example.go gets generated by SWIG
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' GOSRCS='example.go $(GOSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
+
+clean:
+ if [ -n '$(SRCDIR)' ]; then \
+ rm -f $(GOSRCS); \
+ fi
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean
diff --git a/Examples/go/director/director.go b/Examples/go/director/director.go
new file mode 100644
index 00000000000..4f99bfc6d47
--- /dev/null
+++ b/Examples/go/director/director.go
@@ -0,0 +1,72 @@
+package example
+
+// FooBarGo is a superset of FooBarAbstract and hence FooBarGo can be used as a
+// drop in replacement for FooBarAbstract but the reverse causes a compile time
+// error.
+type FooBarGo interface {
+ FooBarAbstract
+ deleteFooBarAbstract()
+ IsFooBarGo()
+}
+
+// Via embedding fooBarGo "inherits" all methods of FooBarAbstract.
+type fooBarGo struct {
+ FooBarAbstract
+}
+
+func (fbgs *fooBarGo) deleteFooBarAbstract() {
+ DeleteDirectorFooBarAbstract(fbgs.FooBarAbstract)
+}
+
+// The IsFooBarGo method ensures that FooBarGo is a superset of FooBarAbstract.
+// This is also how the class hierarchy gets represented by the SWIG generated
+// wrapper code. For an instance FooBarCpp has the IsFooBarAbstract and
+// IsFooBarCpp methods.
+func (fbgs *fooBarGo) IsFooBarGo() {}
+
+// Go type that defines the DirectorInterface. It contains the Foo and Bar
+// methods that overwrite the respective virtual C++ methods on FooBarAbstract.
+type overwrittenMethodsOnFooBarAbstract struct {
+ // Backlink to FooBarAbstract so that the rest of the class can be used by
+ // the overridden methods.
+ fb FooBarAbstract
+
+ // If additional constructor arguments have been given they are typically
+ // stored here so that the overriden methods can use them.
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Foo() string {
+ // DirectorFooBarAbstractFoo calls the base method FooBarAbstract::Foo.
+ return "Go " + DirectorFooBarAbstractFoo(om.fb)
+}
+
+func (om *overwrittenMethodsOnFooBarAbstract) Bar() string {
+ return "Go Bar"
+}
+
+func NewFooBarGo() FooBarGo {
+ // Instantiate FooBarAbstract with selected methods overridden. The methods
+ // that will be overwritten are defined on
+ // overwrittenMethodsOnFooBarAbstract and have a compatible signature to the
+ // respective virtual C++ methods. Furthermore additional constructor
+ // arguments will be typically stored in the
+ // overwrittenMethodsOnFooBarAbstract struct.
+ om := &overwrittenMethodsOnFooBarAbstract{}
+ fb := NewDirectorFooBarAbstract(om)
+ om.fb = fb // Backlink causes cycle as fb.v = om!
+
+ fbgs := &fooBarGo{FooBarAbstract: fb}
+ // The memory of the FooBarAbstract director object instance can be
+ // automatically freed once the FooBarGo instance is garbage collected by
+ // uncommenting the following line. Please make sure to understand the
+ // runtime.SetFinalizer specific gotchas before doing this. Furthemore
+ // DeleteFooBarGo should be deleted if a finalizer is in use or the fooBarGo
+ // struct needs additional data to prevent double deletion.
+ // runtime.SetFinalizer(fbgs, FooBarGo.deleteFooBarAbstract)
+ return fbgs
+}
+
+// Recommended to be removed if runtime.SetFinalizer is in use.
+func DeleteFooBarGo(fbg FooBarGo) {
+ fbg.deleteFooBarAbstract()
+}
diff --git a/Examples/go/director/director.h b/Examples/go/director/director.h
new file mode 100644
index 00000000000..339a9adcd61
--- /dev/null
+++ b/Examples/go/director/director.h
@@ -0,0 +1,41 @@
+#ifndef DIRECTOR_H
+#define DIRECTOR_H
+
+
+#include
+#include
+
+
+class FooBarAbstract
+{
+public:
+ FooBarAbstract() {};
+ virtual ~FooBarAbstract() {};
+
+ std::string FooBar() {
+ return this->Foo() + ", " + this->Bar();
+ };
+
+protected:
+ virtual std::string Foo() {
+ return "Foo";
+ };
+
+ virtual std::string Bar() = 0;
+};
+
+
+class FooBarCpp : public FooBarAbstract
+{
+protected:
+ virtual std::string Foo() {
+ return "C++ " + FooBarAbstract::Foo();
+ }
+
+ virtual std::string Bar() {
+ return "C++ Bar";
+ }
+};
+
+
+#endif
diff --git a/Examples/go/director/example.i b/Examples/go/director/example.i
new file mode 100644
index 00000000000..e832bd8c6f7
--- /dev/null
+++ b/Examples/go/director/example.i
@@ -0,0 +1,11 @@
+/* File : example.i */
+%module(directors="1") example
+
+%include "std_string.i"
+
+%header %{
+#include "director.h"
+%}
+
+%feature("director") FooBarAbstract;
+%include "director.h"
diff --git a/Examples/go/director/index.html b/Examples/go/director/index.html
new file mode 100644
index 00000000000..b93e780e515
--- /dev/null
+++ b/Examples/go/director/index.html
@@ -0,0 +1,28 @@
+
+
+SWIG:Examples:go:director
+
+
+
+
+SWIG/Examples/go/director/
+
+
+How to subclass a C++ class with a Go type
+
+
+See the Go Director
+Classes documentation subsection for an explanation of this example.
+
+
+
+
+director.go . Go source with the definition of the FooBarGo class.
+director.h . Header with the definition of the FooBarAbstract and FooBarCpp classes.
+example.i . SWIG interface file.
+runme.go . Sample Go program.
+
+
+
+
+
diff --git a/Examples/go/director/runme.go b/Examples/go/director/runme.go
new file mode 100644
index 00000000000..0d839bc8808
--- /dev/null
+++ b/Examples/go/director/runme.go
@@ -0,0 +1,39 @@
+package main
+
+import (
+ "./example"
+ "fmt"
+ "os"
+)
+
+func Compare(name string, got string, exp string) error {
+ fmt.Printf("%s; Got: '%s'; Expected: '%s'\n", name, got, exp)
+ if got != exp {
+ return fmt.Errorf("%s returned unexpected string! Got: '%s'; Expected: '%s'\n", name, got, exp)
+ }
+ return nil
+}
+
+func TestFooBarCpp() error {
+ fb := example.NewFooBarCpp()
+ defer example.DeleteFooBarCpp(fb)
+ return Compare("FooBarCpp.FooBar()", fb.FooBar(), "C++ Foo, C++ Bar")
+}
+
+func TestFooBarGo() error {
+ fb := example.NewFooBarGo()
+ defer example.DeleteFooBarGo(fb)
+ return Compare("FooBarGo.FooBar()", fb.FooBar(), "Go Foo, Go Bar")
+}
+
+func main() {
+ fmt.Println("Test output:")
+ fmt.Println("------------")
+ err := TestFooBarCpp()
+ err = TestFooBarGo()
+ fmt.Println("------------")
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Tests failed! Last error: %s\n", err.Error())
+ os.Exit(1)
+ }
+}
diff --git a/Examples/go/enum/Makefile b/Examples/go/enum/Makefile
index 2e2f1b2bd87..15defe9052a 100644
--- a/Examples/go/enum/Makefile
+++ b/Examples/go/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = enum.cxx
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
diff --git a/Examples/go/extend/Makefile b/Examples/go/extend/Makefile
index 290694210c8..a3c520e7288 100644
--- a/Examples/go/extend/Makefile
+++ b/Examples/go/extend/Makefile
@@ -1,6 +1,8 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = extend.cxx
+GOSRCS = ceo.go
TARGET = example
INTERFACE = example.i
SWIGOPT =
@@ -9,8 +11,16 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ if [ -n '$(SRCDIR)' ]; then \
+ cp $(GOSRCS:%=$(SRCDIR)/%) .; \
+ fi
+ @# Note: example.go gets generated by SWIG
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' GOSRCS='example.go $(GOSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
+ if [ -n '$(SRCDIR)' ]; then \
+ rm -f $(GOSRCS); \
+ fi
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean
diff --git a/Examples/go/extend/ceo.go b/Examples/go/extend/ceo.go
new file mode 100644
index 00000000000..8f00c92f284
--- /dev/null
+++ b/Examples/go/extend/ceo.go
@@ -0,0 +1,37 @@
+package example
+
+type CEO interface {
+ Manager
+ deleteManager()
+ IsCEO()
+}
+
+type ceo struct {
+ Manager
+}
+
+func (p *ceo) deleteManager() {
+ DeleteDirectorManager(p.Manager)
+}
+
+func (p *ceo) IsCEO() {}
+
+type overwrittenMethodsOnManager struct {
+ p Manager
+}
+
+func NewCEO(name string) CEO {
+ om := &overwrittenMethodsOnManager{}
+ p := NewDirectorManager(om, name)
+ om.p = p
+
+ return &ceo{Manager: p}
+}
+
+func DeleteCEO(p CEO) {
+ p.deleteManager()
+}
+
+func (p *ceo) GetPosition() string {
+ return "CEO"
+}
diff --git a/Examples/go/extend/example.h b/Examples/go/extend/example.h
index ca1aed28f70..0c3b721bd21 100644
--- a/Examples/go/extend/example.h
+++ b/Examples/go/extend/example.h
@@ -44,7 +44,7 @@ class EmployeeList {
const Employee *get_item(int i) {
return list[i];
}
- ~EmployeeList() {
+ ~EmployeeList() {
std::vector::iterator i;
std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl;
for (i=list.begin(); i!=list.end(); i++) {
diff --git a/Examples/go/extend/index.html b/Examples/go/extend/index.html
index 471fa9cdc35..31788b2aa52 100644
--- a/Examples/go/extend/index.html
+++ b/Examples/go/extend/index.html
@@ -12,13 +12,16 @@
Extending a simple C++ class in Go
-This example illustrates the extending of a C++ class with cross
-language polymorphism.
-
+This example illustrates how to inherit from a C++ class in Go.
+See the Go Director
+Classes documentation subsection for an in-depth explanation how to use the
+director feature.
+
-example.h . Header file containing some enums.
-example.i . Interface file.
+ceo.go . Go source with the definition of the CEO class.
+example.h . Header with the definition of the Employee, Manager and EmployeeList classes.
+example.i . SWIG interface file.
runme.go . Sample Go program.
diff --git a/Examples/go/extend/runme.go b/Examples/go/extend/runme.go
index 770e2780275..a569689375c 100644
--- a/Examples/go/extend/runme.go
+++ b/Examples/go/extend/runme.go
@@ -7,19 +7,12 @@ import (
"fmt"
)
-type CEO struct{}
-
-func (p *CEO) GetPosition() string {
- return "CEO"
-}
-
func main() {
// Create an instance of CEO, a class derived from the Go
// proxy of the underlying C++ class. The calls to getName()
// and getPosition() are standard, the call to getTitle() uses
// the director wrappers to call CEO.getPosition().
-
- e := NewDirectorManager(new(CEO), "Alice")
+ e := NewCEO("Alice")
fmt.Println(e.GetName(), " is a ", e.GetPosition())
fmt.Println("Just call her \"", e.GetTitle(), "\"")
fmt.Println("----------------------")
@@ -27,7 +20,6 @@ func main() {
// Create a new EmployeeList instance. This class does not
// have a C++ director wrapper, but can be used freely with
// other classes that do.
-
list := NewEmployeeList()
// EmployeeList owns its items, so we must surrender ownership
@@ -49,15 +41,13 @@ func main() {
// CEO, but now Go thinks the object is an instance of class
// Employee. So the call passes through the Employee proxy
// class and on to the C wrappers and C++ director, eventually
- // ending up back at the Java CEO implementation of
+ // ending up back at the Go CEO implementation of
// getPosition(). The call to GetTitle() for item 3 runs the
// C++ Employee::getTitle() method, which in turn calls
// GetPosition(). This virtual method call passes down
- // through the C++ director class to the Java implementation
+ // through the C++ director class to the Go implementation
// in CEO. All this routing takes place transparently.
-
fmt.Println("(position, title) for items 0-3:")
-
fmt.Println(" ", list.Get_item(0).GetPosition(), ", \"", list.Get_item(0).GetTitle(), "\"")
fmt.Println(" ", list.Get_item(1).GetPosition(), ", \"", list.Get_item(1).GetTitle(), "\"")
fmt.Println(" ", list.Get_item(2).GetPosition(), ", \"", list.Get_item(2).GetTitle(), "\"")
@@ -66,11 +56,11 @@ func main() {
// Time to delete the EmployeeList, which will delete all the
// Employee* items it contains. The last item is our CEO,
- // which gets destroyed as well.
+ // which gets destroyed as well and hence there is no need to
+ // call DeleteCEO.
DeleteEmployeeList(list)
fmt.Println("----------------------")
// All done.
-
fmt.Println("Go exit")
}
diff --git a/Examples/go/funcptr/Makefile b/Examples/go/funcptr/Makefile
index 82031c9d595..efeb6e86070 100644
--- a/Examples/go/funcptr/Makefile
+++ b/Examples/go/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = funcptr.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/go/index.html b/Examples/go/index.html
index 21dda21b5e5..467f4ecb7e2 100644
--- a/Examples/go/index.html
+++ b/Examples/go/index.html
@@ -23,6 +23,7 @@ SWIG Go Examples
template . C++ templates.
callback . C++ callbacks using directors.
extend . Polymorphism using directors.
+director . Example how to utilize the director feature.
Compilation Issues
@@ -37,20 +38,23 @@ Compilation Issues
On Unix the compilation of examples is done using the
-file Example/Makefile . This makefile performs a manual
-module compilation which is platform specific. When using
-the 6g or 8g compiler, the steps look like this
+file Example/Makefile . Normally builds are done simply
+using go build . For testing purposes this makefile performs
+a manual module compilation that is platform specific. When using
+the gc compiler, the steps look approximately like this
(GNU/Linux):
-% swig -go interface.i
-% gcc -fpic -c interface_wrap.c
-% gcc -shared interface_wrap.o $(OBJS) -o interfacemodule.so
-% 6g interface.go
-% 6c interface_gc.c
-% gopack grc interface.a interface.6 interface_gc.6
-% 6l program.6
+% swig -go -cgo interface.i
+% mkdir -p gopath/src/interface
+% cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface
+% GOPATH=`pwd`/gopath
+% export GOPATH
+% cd gopath/src/interface
+% go build
+% go tool compile $(SRCDIR)/runme.go
+% go tool link -o runme runme.o
@@ -58,10 +62,15 @@ Compilation Issues
-% swig -go interface.i
-% gcc -c interface_wrap.c
-% gccgo -c interface.go
-% gccgo program.o interface.o interface_wrap.o
+% swig -go -cgo interface.i
+% mkdir -p gopath/src/interface
+% cp interface_wrap.c interface_wrap.h interface.go gopath/src/interface
+% GOPATH=`pwd`/gopath
+% export GOPATH
+% cd gopath/src/interface
+% go build
+% gccgo -c $(SRCDIR)/runme.go
+% gccgo -o runme runme.o interface.a
Compatibility
All of the examples were last tested with the following configuration
-(10 May 2010):
+(5 August 2015):
-Ubuntu Hardy
- gcc-4.2.4
+ Ubuntu Trusty
+ gcc-4.8.4
-Your mileage may vary. If you experience a problem, please let us know by
+Your mileage may vary. If you experience a problem, please let us know by
contacting us on the mailing lists .
diff --git a/Examples/go/multimap/Makefile b/Examples/go/multimap/Makefile
index 4d739162bee..ba172611d69 100644
--- a/Examples/go/multimap/Makefile
+++ b/Examples/go/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = multimap.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/go/multimap/example.i b/Examples/go/multimap/example.i
index 8de6b0dc37c..30a37d3bfdf 100644
--- a/Examples/go/multimap/example.i
+++ b/Examples/go/multimap/example.i
@@ -74,16 +74,21 @@ extern int count(char *bytes, int len, char c);
%}
/* Return the mutated string as a modified element in the array. */
-%typemap(argout) (char *str, int len)
+%typemap(argout,fragment="AllocateString") (char *str, int len)
%{
{
_gostring_ *a;
a = (_gostring_*) $input.array;
- a[0] = _swig_makegostring($1, $2);
+ a[0] = Swig_AllocateString($1, $2);
}
%}
+%typemap(goargout,fragment="CopyString") (char *str, int len)
+%{
+ $input[0] = swigCopyString($input[0])
+%}
+
%typemap(freearg) (char *str, int len)
%{
free($1);
diff --git a/Examples/go/pointer/Makefile b/Examples/go/pointer/Makefile
index 9f1f3fda06f..20587fd9544 100644
--- a/Examples/go/pointer/Makefile
+++ b/Examples/go/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = pointer.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/go/reference/Makefile b/Examples/go/reference/Makefile
index e136f6fae6d..d203fff6d7d 100644
--- a/Examples/go/reference/Makefile
+++ b/Examples/go/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = reference.cxx
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
diff --git a/Examples/go/simple/Makefile b/Examples/go/simple/Makefile
index 5bc16549d37..89b936f3d5e 100644
--- a/Examples/go/simple/Makefile
+++ b/Examples/go/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = simple.c
TARGET = example
INTERFACE = example.i
@@ -8,7 +9,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/go/template/Makefile b/Examples/go/template/Makefile
index a1d674836a7..f79b083cbed 100644
--- a/Examples/go/template/Makefile
+++ b/Examples/go/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean:
diff --git a/Examples/go/variables/Makefile b/Examples/go/variables/Makefile
index d0da605e09a..cef1186af80 100644
--- a/Examples/go/variables/Makefile
+++ b/Examples/go/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = variables.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean:
diff --git a/Examples/guile/class/Makefile b/Examples/guile/class/Makefile
index 48426a8fb3f..84a7b43228c 100644
--- a/Examples/guile/class/Makefile
+++ b/Examples/guile/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp
clean:
diff --git a/Examples/guile/constants/Makefile b/Examples/guile/constants/Makefile
index d3f58ebdca9..abe63d4b180 100644
--- a/Examples/guile/constants/Makefile
+++ b/Examples/guile/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = my-guile
INTERFACE = example.i
@@ -8,7 +9,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
clean:
diff --git a/Examples/guile/matrix/Makefile b/Examples/guile/matrix/Makefile
index 53638c86781..cfe0c853603 100644
--- a/Examples/guile/matrix/Makefile
+++ b/Examples/guile/matrix/Makefile
@@ -1,14 +1,16 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = matrix.c vector.c
-TARGET = matrix
+TARGET = my-guile
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_augmented_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS='-lm' guile_augmented
clean:
diff --git a/Examples/guile/matrix/README b/Examples/guile/matrix/README
index db7395b70b9..496e81bf1af 100644
--- a/Examples/guile/matrix/README
+++ b/Examples/guile/matrix/README
@@ -6,7 +6,7 @@ type the following :
Alternatively, use the command-line:
- ./matrix -e do-test -s runme.scm
+ ./my-guile -e do-test -s runme.scm
Or, if your operating system is spiffy enough:
diff --git a/Examples/guile/multimap/Makefile b/Examples/guile/multimap/Makefile
index b8f5e9b5af2..f8767021932 100644
--- a/Examples/guile/multimap/Makefile
+++ b/Examples/guile/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static
clean:
diff --git a/Examples/guile/multivalue/Makefile b/Examples/guile/multivalue/Makefile
index b8f5e9b5af2..f8767021932 100644
--- a/Examples/guile/multivalue/Makefile
+++ b/Examples/guile/multivalue/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static
clean:
diff --git a/Examples/guile/port/Makefile b/Examples/guile/port/Makefile
index 95a3a479f07..09ee821f5a4 100644
--- a/Examples/guile/port/Makefile
+++ b/Examples/guile/port/Makefile
@@ -1,14 +1,16 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
-TARGET = port
+TARGET = my-guile
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
clean:
diff --git a/Examples/guile/port/README b/Examples/guile/port/README
index 784e39e5dfd..174d8767a47 100644
--- a/Examples/guile/port/README
+++ b/Examples/guile/port/README
@@ -1,2 +1,2 @@
This example illustrates the translation from Scheme file ports to
-temporary FILE streams. Read the source and run ./port -s runme.scm
+temporary FILE streams. Read the source and run ./my-guile -s runme.scm
diff --git a/Examples/guile/simple/Makefile b/Examples/guile/simple/Makefile
index 517e41c648f..d8fb2da8108 100644
--- a/Examples/guile/simple/Makefile
+++ b/Examples/guile/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my-guile
INTERFACE = example.i
@@ -8,7 +9,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
clean:
diff --git a/Examples/guile/std_vector/Makefile b/Examples/guile/std_vector/Makefile
index d7f5de21777..1146242c270 100644
--- a/Examples/guile/std_vector/Makefile
+++ b/Examples/guile/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp
clean:
diff --git a/Examples/java/callback/Makefile b/Examples/java/callback/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/callback/Makefile
+++ b/Examples/java/callback/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/callback/example.i b/Examples/java/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/java/callback/example.i
+++ b/Examples/java/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/java/class/Makefile b/Examples/java/class/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/class/Makefile
+++ b/Examples/java/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/constants/Makefile b/Examples/java/constants/Makefile
index 637ce0eaded..ddc2157a6d8 100644
--- a/Examples/java/constants/Makefile
+++ b/Examples/java/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/enum/Makefile b/Examples/java/enum/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/enum/Makefile
+++ b/Examples/java/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/extend/Makefile b/Examples/java/extend/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/extend/Makefile
+++ b/Examples/java/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/funcptr/Makefile b/Examples/java/funcptr/Makefile
index c0b1927cae8..4babc683d39 100644
--- a/Examples/java/funcptr/Makefile
+++ b/Examples/java/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/multimap/Makefile b/Examples/java/multimap/Makefile
index c0b1927cae8..4babc683d39 100644
--- a/Examples/java/multimap/Makefile
+++ b/Examples/java/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/native/Makefile b/Examples/java/native/Makefile
index fa67e48a4a0..b43a7d15293 100644
--- a/Examples/java/native/Makefile
+++ b/Examples/java/native/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/nested/Makefile b/Examples/java/nested/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/nested/Makefile
+++ b/Examples/java/nested/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/pointer/Makefile b/Examples/java/pointer/Makefile
index c0b1927cae8..4babc683d39 100644
--- a/Examples/java/pointer/Makefile
+++ b/Examples/java/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/pointer/example.i b/Examples/java/pointer/example.i
index a8ac79499f8..ed1c2fcc37e 100644
--- a/Examples/java/pointer/example.i
+++ b/Examples/java/pointer/example.i
@@ -24,7 +24,3 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
%apply int *OUTPUT { int *r };
extern int divide(int n, int d, int *r);
-
-
-
-
diff --git a/Examples/java/reference/Makefile b/Examples/java/reference/Makefile
index 13cfd1708dc..c76e0926265 100644
--- a/Examples/java/reference/Makefile
+++ b/Examples/java/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/simple/Makefile b/Examples/java/simple/Makefile
index c0b1927cae8..4babc683d39 100644
--- a/Examples/java/simple/Makefile
+++ b/Examples/java/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/template/Makefile b/Examples/java/template/Makefile
index 637ce0eaded..ddc2157a6d8 100644
--- a/Examples/java/template/Makefile
+++ b/Examples/java/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/typemap/Makefile b/Examples/java/typemap/Makefile
index fa67e48a4a0..b43a7d15293 100644
--- a/Examples/java/typemap/Makefile
+++ b/Examples/java/typemap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/java/variables/Makefile b/Examples/java/variables/Makefile
index c0b1927cae8..4babc683d39 100644
--- a/Examples/java/variables/Makefile
+++ b/Examples/java/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk
index cb8a33efd54..3ef012aa824 100644
--- a/Examples/javascript/example.mk
+++ b/Examples/javascript/example.mk
@@ -13,20 +13,23 @@ else
JSV8_VERSION=0x031110
endif
-EXAMPLES_TOP=../..
-SWIG_TOP=../../..
-SWIG = $(SWIG_TOP)/preinst-swig
-TARGET = example
-INTERFACE = example.i
-SWIGOPT=-$(JSENGINE) -DV8_VERSION=$(JSV8_VERSION)
+EXAMPLES_TOP = ../..
+SWIG_TOP = ../../..
+SWIGEXE = $(SWIG_TOP)/swig
+SWIG_LIB_DIR = $(SWIG_TOP)/$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+TARGET = example
+INTERFACE = example.i
+SWIGOPT = -$(JSENGINE) -DV8_VERSION=$(JSV8_VERSION)
check: build
$(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
build:
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_cpp
clean:
diff --git a/Examples/lua/arrays/Makefile b/Examples/lua/arrays/Makefile
index 4191f7ec32c..70de9c453c3 100644
--- a/Examples/lua/arrays/Makefile
+++ b/Examples/lua/arrays/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/class/Makefile b/Examples/lua/class/Makefile
index 96308f0dfc8..dd78fdbe90f 100644
--- a/Examples/lua/class/Makefile
+++ b/Examples/lua/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static
clean:
diff --git a/Examples/lua/constants/Makefile b/Examples/lua/constants/Makefile
index ae33cb182cd..979dc7d4509 100644
--- a/Examples/lua/constants/Makefile
+++ b/Examples/lua/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/dual/Makefile b/Examples/lua/dual/Makefile
index c86152a9701..53b28b645a9 100644
--- a/Examples/lua/dual/Makefile
+++ b/Examples/lua/dual/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = dual
GENCXXSRCS = example2_wrap.cxx
INTERFACE = dual.i
@@ -11,9 +12,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run
build:
- $(SWIG) -lua -external-runtime
- $(SWIG) -c++ -lua $(SWIGOPT) -o $(GENCXXSRCS) $(SRCDIR)example2.i
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) GENCXXSRCS='$(GENCXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ lua_externalhdr
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-c++' INTERFACE='example2.i' lua_swig_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) GENCXXSRCS='$(GENCXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static_cpp
clean:
diff --git a/Examples/lua/embed/Makefile b/Examples/lua/embed/Makefile
index 5e3a9189389..7f405449284 100644
--- a/Examples/lua/embed/Makefile
+++ b/Examples/lua/embed/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = embed
SRCS = example.c
INTERFACE = example.i
@@ -12,7 +13,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
clean:
diff --git a/Examples/lua/embed2/Makefile b/Examples/lua/embed2/Makefile
index d30ba094233..28d9682b40d 100644
--- a/Examples/lua/embed2/Makefile
+++ b/Examples/lua/embed2/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = embed2
SRCS = example.c
INTERFACE = example.i
@@ -12,7 +13,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static
clean:
diff --git a/Examples/lua/embed3/Makefile b/Examples/lua/embed3/Makefile
index fc002612218..d8e7c7385dc 100644
--- a/Examples/lua/embed3/Makefile
+++ b/Examples/lua/embed3/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = embed3
SRCS = example.cpp
INTERFACE = example.i
@@ -12,8 +13,11 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run
build:
- $(SWIG) -c++ -lua $(SWIGOPT) -external-runtime swigluarun.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ lua_externalhdr
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static_cpp
clean:
diff --git a/Examples/lua/exception/Makefile b/Examples/lua/exception/Makefile
index ac9c28b6918..a476f0b9138 100644
--- a/Examples/lua/exception/Makefile
+++ b/Examples/lua/exception/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static
clean:
diff --git a/Examples/lua/funcptr3/Makefile b/Examples/lua/funcptr3/Makefile
index aeeaad46989..fb363cbe9a5 100644
--- a/Examples/lua/funcptr3/Makefile
+++ b/Examples/lua/funcptr3/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/functest/Makefile b/Examples/lua/functest/Makefile
index aeeaad46989..fb363cbe9a5 100644
--- a/Examples/lua/functest/Makefile
+++ b/Examples/lua/functest/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/functor/Makefile b/Examples/lua/functor/Makefile
index e647fb2a823..1bc860a70df 100644
--- a/Examples/lua/functor/Makefile
+++ b/Examples/lua/functor/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static
clean:
diff --git a/Examples/lua/import/Makefile b/Examples/lua/import/Makefile
index 8d64a21c623..ff73702c46c 100644
--- a/Examples/lua/import/Makefile
+++ b/Examples/lua/import/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' lua_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' lua_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' lua_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' lua_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' lua_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' lua_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' lua_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' lua_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean
diff --git a/Examples/lua/import/README b/Examples/lua/import/README
index 1a52e3c1e24..af83d29b914 100644
--- a/Examples/lua/import/README
+++ b/Examples/lua/import/README
@@ -1,36 +1,36 @@
-This example tests the %import directive and working with multiple modules.
-
-Use 'lua runme.lua' to run a test.
-
-Overview:
----------
-
-The example defines 4 different extension modules--each wrapping
-a separate C++ class.
-
- base.i - Base class
- foo.i - Foo class derived from Base
- bar.i - Bar class derived from Base
- spam.i - Spam class derived from Bar
-
-Each module uses %import to refer to another module. For
-example, the 'foo.i' module uses '%import base.i' to get
-definitions for its base class.
-
-If everything is okay, all of the modules will load properly and
-type checking will work correctly. Caveat: Some compilers, for example
-gcc-3.2.x, generate broken vtables with the inline methods in this test.
-This is not a SWIG problem and can usually be solved with non-inlined
-destructors compiled into separate shared objects/DLLs.
-
-Unix:
------
-- Run make
-- Run the test as described above
-
-Windows:
+This example tests the %import directive and working with multiple modules.
+
+Use 'lua runme.lua' to run a test.
+
+Overview:
+---------
+
+The example defines 4 different extension modules--each wrapping
+a separate C++ class.
+
+ base.i - Base class
+ foo.i - Foo class derived from Base
+ bar.i - Bar class derived from Base
+ spam.i - Spam class derived from Bar
+
+Each module uses %import to refer to another module. For
+example, the 'foo.i' module uses '%import base.i' to get
+definitions for its base class.
+
+If everything is okay, all of the modules will load properly and
+type checking will work correctly. Caveat: Some compilers, for example
+gcc-3.2.x, generate broken vtables with the inline methods in this test.
+This is not a SWIG problem and can usually be solved with non-inlined
+destructors compiled into separate shared objects/DLLs.
+
+Unix:
+-----
+- Run make
+- Run the test as described above
+
+Windows:
--------
Sorry, no files here.
-If you know how, you could copy the python or ruby example dsw & dsp and try editing that
+If you know how, you could copy the python or ruby example dsw & dsp and try editing that
+
-
diff --git a/Examples/lua/nspace/Makefile b/Examples/lua/nspace/Makefile
index 17757c2ec29..fdedebca1d2 100644
--- a/Examples/lua/nspace/Makefile
+++ b/Examples/lua/nspace/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static
clean:
diff --git a/Examples/lua/owner/Makefile b/Examples/lua/owner/Makefile
index 96308f0dfc8..dd78fdbe90f 100644
--- a/Examples/lua/owner/Makefile
+++ b/Examples/lua/owner/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static
clean:
diff --git a/Examples/lua/pointer/Makefile b/Examples/lua/pointer/Makefile
index aeeaad46989..fb363cbe9a5 100644
--- a/Examples/lua/pointer/Makefile
+++ b/Examples/lua/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/simple/Makefile b/Examples/lua/simple/Makefile
index 4191f7ec32c..70de9c453c3 100644
--- a/Examples/lua/simple/Makefile
+++ b/Examples/lua/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/lua/variables/Makefile b/Examples/lua/variables/Makefile
index 4191f7ec32c..70de9c453c3 100644
--- a/Examples/lua/variables/Makefile
+++ b/Examples/lua/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static
clean:
diff --git a/Examples/modula3/class/Makefile b/Examples/modula3/class/Makefile
index 2e2f375264d..b25f636c3d7 100644
--- a/Examples/modula3/class/Makefile
+++ b/Examples/modula3/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
PLATFORM = LINUXLIBC6
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
m3ppinplace $(MODULA3SRCS)
# compilation of example_wrap.cxx is started by cm3
diff --git a/Examples/modula3/enum/Makefile b/Examples/modula3/enum/Makefile
index 3915e540551..2c5c9b0a555 100644
--- a/Examples/modula3/enum/Makefile
+++ b/Examples/modula3/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -11,11 +12,12 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(SWIG) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h
+ $(SWIGEXE) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h
$(CXX) -Wall $(CONSTNUMERIC).c -o $(CONSTNUMERIC)
$(CONSTNUMERIC) >$(CONSTNUMERIC).i
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
m3ppinplace $(MODULA3SRCS)
mv m3makefile $(MODULA3SRCS) src/
diff --git a/Examples/modula3/exception/Makefile b/Examples/modula3/exception/Makefile
index 1dbf1a156ea..8d12ef19e24 100644
--- a/Examples/modula3/exception/Makefile
+++ b/Examples/modula3/exception/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -11,7 +12,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3_cpp
# $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile
m3ppinplace $(MODULA3SRCS)
diff --git a/Examples/modula3/reference/Makefile b/Examples/modula3/reference/Makefile
index 3b68fe822ac..eaceceb1fff 100644
--- a/Examples/modula3/reference/Makefile
+++ b/Examples/modula3/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
m3ppinplace $(MODULA3SRCS)
mv m3makefile $(MODULA3SRCS) src/
diff --git a/Examples/modula3/simple/Makefile b/Examples/modula3/simple/Makefile
index 2796b25f800..3ba35d18bca 100644
--- a/Examples/modula3/simple/Makefile
+++ b/Examples/modula3/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
m3ppinplace $(MODULA3SRCS)
mv m3makefile $(MODULA3SRCS) src/
diff --git a/Examples/modula3/typemap/Makefile b/Examples/modula3/typemap/Makefile
index 2796b25f800..3ba35d18bca 100644
--- a/Examples/modula3/typemap/Makefile
+++ b/Examples/modula3/typemap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,7 +11,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3
m3ppinplace $(MODULA3SRCS)
mv m3makefile $(MODULA3SRCS) src/
diff --git a/Examples/mzscheme/multimap/Makefile b/Examples/mzscheme/multimap/Makefile
index ecf83fbeba2..713ee43a702 100644
--- a/Examples/mzscheme/multimap/Makefile
+++ b/Examples/mzscheme/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/mzscheme/simple/Makefile b/Examples/mzscheme/simple/Makefile
index ecf83fbeba2..713ee43a702 100644
--- a/Examples/mzscheme/simple/Makefile
+++ b/Examples/mzscheme/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean
diff --git a/Examples/mzscheme/std_vector/Makefile b/Examples/mzscheme/std_vector/Makefile
index 75918a61e59..96f5e80cf2f 100644
--- a/Examples/mzscheme/std_vector/Makefile
+++ b/Examples/mzscheme/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -12,7 +13,7 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run
build:
- $(SWIG) -mzscheme -c++ $(SWIGOPT) $(INTERFACE)
+ $(SWIGEXE) -mzscheme -c++ $(SWIGOPT) $(INTERFACE)
$(MZC) --compiler $(GPP) ++ccf "-I." --cc example_wrap.cxx
$(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o
diff --git a/Examples/ocaml/argout_ref/Makefile b/Examples/ocaml/argout_ref/Makefile
index 09893af65ce..8b7fc959eae 100644
--- a/Examples/ocaml/argout_ref/Makefile
+++ b/Examples/ocaml/argout_ref/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -13,13 +14,15 @@ check: build
build: static
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
diff --git a/Examples/ocaml/contract/Makefile b/Examples/ocaml/contract/Makefile
index df5d6a6f5ac..c77e6dcc417 100644
--- a/Examples/ocaml/contract/Makefile
+++ b/Examples/ocaml/contract/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -13,19 +14,22 @@ check: build
build: static
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_toplevel
diff --git a/Examples/ocaml/scoped_enum/Makefile b/Examples/ocaml/scoped_enum/Makefile
index 79473397186..9655c98e6fd 100644
--- a/Examples/ocaml/scoped_enum/Makefile
+++ b/Examples/ocaml/scoped_enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -13,19 +14,22 @@ check: build
build: static
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
toplevel:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
diff --git a/Examples/ocaml/shapes/Makefile b/Examples/ocaml/shapes/Makefile
index 69102f3b18e..b291d07e80c 100644
--- a/Examples/ocaml/shapes/Makefile
+++ b/Examples/ocaml/shapes/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
SRCS = example.c
TARGET = example
@@ -14,19 +15,22 @@ check: build
build: static static_top
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
static_top:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)'
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
diff --git a/Examples/ocaml/simple/Makefile b/Examples/ocaml/simple/Makefile
index 49bf81c1eeb..88fef743554 100644
--- a/Examples/ocaml/simple/Makefile
+++ b/Examples/ocaml/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -13,19 +14,22 @@ check: build
build: static
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static
toplevel:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \
PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_toplevel
diff --git a/Examples/ocaml/std_string/Makefile b/Examples/ocaml/std_string/Makefile
index 8f8b2f684ac..099b1fceee3 100644
--- a/Examples/ocaml/std_string/Makefile
+++ b/Examples/ocaml/std_string/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -11,12 +12,14 @@ check: build
build: static
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_dynamic_cpp
diff --git a/Examples/ocaml/std_vector/Makefile b/Examples/ocaml/std_vector/Makefile
index 8f8b2f684ac..099b1fceee3 100644
--- a/Examples/ocaml/std_vector/Makefile
+++ b/Examples/ocaml/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -11,12 +12,14 @@ check: build
build: static
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_dynamic_cpp
diff --git a/Examples/ocaml/stl/Makefile b/Examples/ocaml/stl/Makefile
index e4cce48839f..912dd9f8d61 100644
--- a/Examples/ocaml/stl/Makefile
+++ b/Examples/ocaml/stl/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -11,22 +12,26 @@ check: build
build: static
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
director:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp_director
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
toplevel:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp_toplevel
diff --git a/Examples/ocaml/string_from_ptr/Makefile b/Examples/ocaml/string_from_ptr/Makefile
index 294bdec83c1..f9b0278029e 100644
--- a/Examples/ocaml/string_from_ptr/Makefile
+++ b/Examples/ocaml/string_from_ptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT = -c++
SRCS =
TARGET = example
@@ -14,19 +15,22 @@ check: build
build: static static_top
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp
static_top:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_static_cpp_toplevel
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)'
MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \
ocaml_dynamic_cpp
diff --git a/Examples/ocaml/strings_test/Makefile b/Examples/ocaml/strings_test/Makefile
index b6b866669e1..24e2e6cca52 100644
--- a/Examples/ocaml/strings_test/Makefile
+++ b/Examples/ocaml/strings_test/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -11,17 +12,20 @@ check: build
build: static top
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
dynamic:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp
top:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
ocaml_static_cpp_toplevel
diff --git a/Examples/octave/callback/example.i b/Examples/octave/callback/example.i
index 50ef5096d5d..333127a9db1 100644
--- a/Examples/octave/callback/example.i
+++ b/Examples/octave/callback/example.i
@@ -7,8 +7,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/octave/example.mk b/Examples/octave/example.mk
index e0b1e4efb7a..1ab96f038b6 100644
--- a/Examples/octave/example.mk
+++ b/Examples/octave/example.mk
@@ -2,7 +2,8 @@
# These paths are relative to such an example directory
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = swigexample
INTERFACE = example.i
@@ -11,18 +12,22 @@ check: build
build:
ifneq (,$(SRCS))
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
else
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
endif
ifneq (,$(TARGET2)$(SWIGOPT2))
ifneq (,$(SRCS))
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave
else
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave_cpp
endif
endif
diff --git a/Examples/octave/module_load/runme.m b/Examples/octave/module_load/runme.m
index bc311b5e695..30b7badb282 100644
--- a/Examples/octave/module_load/runme.m
+++ b/Examples/octave/module_load/runme.m
@@ -61,9 +61,8 @@
testme
clear all
-# octave 3.0.5 randomly crashes on the remaining tests, so skip them
-api_version = sscanf(octave_config_info("api_version"), "api-v%i");
-if api_version < 37
+# octave 3.0.5 randomly crashes on the remaining tests
+if !swig_octave_prereq(3,2,0)
exit
endif
diff --git a/Examples/octave/operator/example.i b/Examples/octave/operator/example.i
index 7fad8e60977..937e8d39d03 100644
--- a/Examples/octave/operator/example.i
+++ b/Examples/octave/operator/example.i
@@ -26,4 +26,25 @@
ComplexVal __paren__(int j) {
return ComplexVal($self->re()*j,$self->im()*j);
}
+
+ double __float__() {
+ return (double) $self->re();
+ }
+
+ double __real__() {
+ return $self->re();
+ }
+ double __imag__() {
+ return $self->im();
+ }
+ double __abs__() {
+ return sqrt($self->re()*$self->re() + $self->im()*$self->im());
+ }
+ ComplexVal __conj__() {
+ return ComplexVal($self->re(), -$self->im());
+ }
+ ComplexVal __exp__() {
+ return exp($self->re()) * ComplexVal(cos($self->im()), sin($self->im()));
+ }
+
};
diff --git a/Examples/octave/operator/runme.m b/Examples/octave/operator/runme.m
index 9ab614ffbe7..83197b410cb 100644
--- a/Examples/octave/operator/runme.m
+++ b/Examples/octave/operator/runme.m
@@ -24,3 +24,16 @@
# friend operator
printf("2*a = %s\n",disp(2*a));
+
+# conversions
+printf("single(a) = %g\n", single(a));
+printf("double(a) = %g\n", double(a));
+
+# unary functions
+if swig_octave_prereq(3,8,0)
+ printf("real(a) = %g\n", real(a));
+ printf("imag(a) = %g\n", imag(a));
+ printf("abs(a) = %g\n", abs(a));
+ printf("conj(a) = %s\n", disp(conj(a)));
+ printf("exp(a) = %s\n", disp(exp(a)));
+endif
diff --git a/Examples/perl5/callback/Makefile b/Examples/perl5/callback/Makefile
index 0d1cc574fe3..08271768c4f 100644
--- a/Examples/perl5/callback/Makefile
+++ b/Examples/perl5/callback/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean:
diff --git a/Examples/perl5/callback/example.i b/Examples/perl5/callback/example.i
index 5f9072e61bd..821a9e6b532 100644
--- a/Examples/perl5/callback/example.i
+++ b/Examples/perl5/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/perl5/class/Makefile b/Examples/perl5/class/Makefile
index 0d1cc574fe3..08271768c4f 100644
--- a/Examples/perl5/class/Makefile
+++ b/Examples/perl5/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean:
diff --git a/Examples/perl5/constants/Makefile b/Examples/perl5/constants/Makefile
index b7b411534eb..b0dc678060b 100644
--- a/Examples/perl5/constants/Makefile
+++ b/Examples/perl5/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/constants2/Makefile b/Examples/perl5/constants2/Makefile
index 85dd13741d5..db676cc4eba 100644
--- a/Examples/perl5/constants2/Makefile
+++ b/Examples/perl5/constants2/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/extend/Makefile b/Examples/perl5/extend/Makefile
index 0d1cc574fe3..08271768c4f 100644
--- a/Examples/perl5/extend/Makefile
+++ b/Examples/perl5/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean:
diff --git a/Examples/perl5/funcptr/Makefile b/Examples/perl5/funcptr/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/funcptr/Makefile
+++ b/Examples/perl5/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/import/Makefile b/Examples/perl5/import/Makefile
index b31ab795253..e9225af25ad 100644
--- a/Examples/perl5/import/Makefile
+++ b/Examples/perl5/import/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='baseclass' INTERFACE='base.i' perl5_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' perl5_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' perl5_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' perl5_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='baseclass' INTERFACE='base.i' perl5_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' perl5_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' perl5_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' perl5_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean
diff --git a/Examples/perl5/java/Makefile b/Examples/perl5/java/Makefile
index 5eaea321223..7c133235f62 100644
--- a/Examples/perl5/java/Makefile
+++ b/Examples/perl5/java/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
CXXSHARED="gcj -fpic -shared Example.class" PERL5_CCFLAGS='' PERL5_EXP='' LIBS="-lstdc++" perl5_cpp
diff --git a/Examples/perl5/multimap/Makefile b/Examples/perl5/multimap/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/multimap/Makefile
+++ b/Examples/perl5/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/multiple_inheritance/Makefile b/Examples/perl5/multiple_inheritance/Makefile
index 1fe5a51bb6a..b73356e3e03 100644
--- a/Examples/perl5/multiple_inheritance/Makefile
+++ b/Examples/perl5/multiple_inheritance/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean:
diff --git a/Examples/perl5/pointer/Makefile b/Examples/perl5/pointer/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/pointer/Makefile
+++ b/Examples/perl5/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/reference/Makefile b/Examples/perl5/reference/Makefile
index a22f5a68d23..c4212099e5b 100644
--- a/Examples/perl5/reference/Makefile
+++ b/Examples/perl5/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' SWIGOPT='$(SWIGOPT)' perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' SWIGOPT='$(SWIGOPT)' perl5_cpp_static
clean:
diff --git a/Examples/perl5/simple/Makefile b/Examples/perl5/simple/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/simple/Makefile
+++ b/Examples/perl5/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/value/Makefile b/Examples/perl5/value/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/value/Makefile
+++ b/Examples/perl5/value/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/variables/Makefile b/Examples/perl5/variables/Makefile
index 3e1de1fc1ee..dfc01843e96 100644
--- a/Examples/perl5/variables/Makefile
+++ b/Examples/perl5/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static
clean:
diff --git a/Examples/perl5/xmlstring/Makefile b/Examples/perl5/xmlstring/Makefile
index 4f02d3ee47a..3b4ba0ea4f7 100644
--- a/Examples/perl5/xmlstring/Makefile
+++ b/Examples/perl5/xmlstring/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS=$(LIBS) CXX="g++ -g3" perl5_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static
clean:
diff --git a/Examples/php/callback/Makefile b/Examples/php/callback/Makefile
index 3ad3999a5e5..cbc75774ccb 100644
--- a/Examples/php/callback/Makefile
+++ b/Examples/php/callback/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static
clean:
diff --git a/Examples/php/callback/example.i b/Examples/php/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/php/callback/example.i
+++ b/Examples/php/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/php/class/Makefile b/Examples/php/class/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/class/Makefile
+++ b/Examples/php/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/constants/Makefile b/Examples/php/constants/Makefile
index e5b49571e19..9dbd3842d9c 100644
--- a/Examples/php/constants/Makefile
+++ b/Examples/php/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/cpointer/Makefile b/Examples/php/cpointer/Makefile
index f2c15c5c1a7..05679f844ed 100644
--- a/Examples/php/cpointer/Makefile
+++ b/Examples/php/cpointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/disown/Makefile b/Examples/php/disown/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/disown/Makefile
+++ b/Examples/php/disown/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/enum/Makefile b/Examples/php/enum/Makefile
index 2028d03c794..95ebf8fc17b 100644
--- a/Examples/php/enum/Makefile
+++ b/Examples/php/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/extend/Makefile b/Examples/php/extend/Makefile
index 3ad3999a5e5..cbc75774ccb 100644
--- a/Examples/php/extend/Makefile
+++ b/Examples/php/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static
clean:
diff --git a/Examples/php/funcptr/Makefile b/Examples/php/funcptr/Makefile
index f2c15c5c1a7..05679f844ed 100644
--- a/Examples/php/funcptr/Makefile
+++ b/Examples/php/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/overloading/Makefile b/Examples/php/overloading/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/overloading/Makefile
+++ b/Examples/php/overloading/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/pointer/Makefile b/Examples/php/pointer/Makefile
index f2c15c5c1a7..05679f844ed 100644
--- a/Examples/php/pointer/Makefile
+++ b/Examples/php/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/pragmas/Makefile b/Examples/php/pragmas/Makefile
index e5b49571e19..9dbd3842d9c 100644
--- a/Examples/php/pragmas/Makefile
+++ b/Examples/php/pragmas/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/proxy/Makefile b/Examples/php/proxy/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/proxy/Makefile
+++ b/Examples/php/proxy/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/reference/Makefile b/Examples/php/reference/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/reference/Makefile
+++ b/Examples/php/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/simple/Makefile b/Examples/php/simple/Makefile
index f2c15c5c1a7..05679f844ed 100644
--- a/Examples/php/simple/Makefile
+++ b/Examples/php/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/sync/Makefile b/Examples/php/sync/Makefile
index 8b2b340e990..02a8668ac10 100644
--- a/Examples/php/sync/Makefile
+++ b/Examples/php/sync/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_cpp_static
diff --git a/Examples/php/value/Makefile b/Examples/php/value/Makefile
index 3db7afec511..674e4368e1f 100644
--- a/Examples/php/value/Makefile
+++ b/Examples/php/value/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/php/variables/Makefile b/Examples/php/variables/Makefile
index f2c15c5c1a7..05679f844ed 100644
--- a/Examples/php/variables/Makefile
+++ b/Examples/php/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
php
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \
php_static
diff --git a/Examples/pike/class/Makefile b/Examples/pike/class/Makefile
index d8cf4ea7e05..e5319dbe24e 100644
--- a/Examples/pike/class/Makefile
+++ b/Examples/pike/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
clean:
diff --git a/Examples/pike/constants/Makefile b/Examples/pike/constants/Makefile
index 736d30f03c0..45da7d269ca 100644
--- a/Examples/pike/constants/Makefile
+++ b/Examples/pike/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
clean:
diff --git a/Examples/pike/enum/Makefile b/Examples/pike/enum/Makefile
index d8cf4ea7e05..e5319dbe24e 100644
--- a/Examples/pike/enum/Makefile
+++ b/Examples/pike/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
clean:
diff --git a/Examples/pike/overload/Makefile b/Examples/pike/overload/Makefile
index f111b113756..5e5fe669bd4 100644
--- a/Examples/pike/overload/Makefile
+++ b/Examples/pike/overload/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
clean:
diff --git a/Examples/pike/simple/Makefile b/Examples/pike/simple/Makefile
index d7f6b209eed..8b49b4ea5f7 100644
--- a/Examples/pike/simple/Makefile
+++ b/Examples/pike/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static
clean:
diff --git a/Examples/pike/template/Makefile b/Examples/pike/template/Makefile
index da115c1d51b..513dc3b4ba1 100644
--- a/Examples/pike/template/Makefile
+++ b/Examples/pike/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static
clean:
diff --git a/Examples/python/callback/Makefile b/Examples/python/callback/Makefile
index a4c4d2a69ea..71926f397b3 100644
--- a/Examples/python/callback/Makefile
+++ b/Examples/python/callback/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/callback/example.i b/Examples/python/callback/example.i
index 90beda01af1..cf61ef9d2f8 100644
--- a/Examples/python/callback/example.i
+++ b/Examples/python/callback/example.i
@@ -4,8 +4,6 @@
#include "example.h"
%}
-%include "std_string.i"
-
/* turn on director wrapping Callback */
%feature("director") Callback;
diff --git a/Examples/python/callback/runme.py b/Examples/python/callback/runme.py
index ddb6684078a..345a3eb6e65 100644
--- a/Examples/python/callback/runme.py
+++ b/Examples/python/callback/runme.py
@@ -2,14 +2,16 @@
# This file illustrates the cross language polymorphism using directors.
-import example
+import example
class PyCallback(example.Callback):
- def __init__(self):
- example.Callback.__init__(self)
- def run(self):
- print "PyCallback.run()"
+
+ def __init__(self):
+ example.Callback.__init__(self)
+
+ def run(self):
+ print "PyCallback.run()"
# Create an Caller instance
@@ -25,7 +27,7 @@ def run(self):
callback.thisown = 0
caller.setCallback(callback)
caller.call()
-caller.delCallback();
+caller.delCallback()
print
print "Adding and calling a Python callback"
@@ -53,4 +55,3 @@ def run(self):
print
print "python exit"
-
diff --git a/Examples/python/class/Makefile b/Examples/python/class/Makefile
index 41cded28496..471e3907364 100644
--- a/Examples/python/class/Makefile
+++ b/Examples/python/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/class/runme.py b/Examples/python/class/runme.py
index 8f4f27eb9f2..34d21505c42 100644
--- a/Examples/python/class/runme.py
+++ b/Examples/python/class/runme.py
@@ -3,7 +3,7 @@
# This file illustrates the proxy class C++ interface generated
# by SWIG.
-import example
+import example
# ----- Object creation -----
@@ -15,7 +15,7 @@
# ----- Access a static member -----
-print "\nA total of", example.cvar.Shape_nshapes,"shapes were created"
+print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
# ----- Member data access -----
@@ -28,16 +28,16 @@
s.y = 5
print "\nHere is their current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-print " Square = (%f, %f)" % (s.x,s.y)
+print " Circle = (%f, %f)" % (c.x, c.y)
+print " Square = (%f, %f)" % (s.x, s.y)
# ----- Call some methods -----
print "\nHere are some properties of the shapes:"
-for o in [c,s]:
- print " ", o
- print " area = ", o.area()
- print " perimeter = ", o.perimeter()
+for o in [c, s]:
+ print " ", o
+ print " area = ", o.area()
+ print " perimeter = ", o.perimeter()
# prevent o from holding a reference to the last object looked at
o = None
@@ -47,5 +47,5 @@
del c
del s
-print example.cvar.Shape_nshapes,"shapes remain"
+print example.cvar.Shape_nshapes, "shapes remain"
print "Goodbye"
diff --git a/Examples/python/constants/Makefile b/Examples/python/constants/Makefile
index 8ec6e9cc9cb..a412cf2993a 100644
--- a/Examples/python/constants/Makefile
+++ b/Examples/python/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/constants/runme.py b/Examples/python/constants/runme.py
index 8d25b878bc9..415d1adc420 100644
--- a/Examples/python/constants/runme.py
+++ b/Examples/python/constants/runme.py
@@ -1,6 +1,6 @@
# file: runme.py
-import example
+import example
print "ICONST =", example.ICONST, "(should be 42)"
print "FCONST =", example.FCONST, "(should be 2.1828)"
@@ -8,7 +8,7 @@
print "CCONST2 =", example.CCONST2, "(this should be on a new line)"
print "SCONST =", example.SCONST, "(should be 'Hello World')"
print "SCONST2 =", example.SCONST2, "(should be '\"Hello World\"')"
-print "EXPR =", example.EXPR, "(should be 48.5484)"
+print "EXPR =", example.EXPR, "(should be 48.5484)"
print "iconst =", example.iconst, "(should be 37)"
print "fconst =", example.fconst, "(should be 3.14)"
@@ -21,7 +21,3 @@
print "FOO = ", example.FOO, "(Arg! This shouldn't print anything)"
except AttributeError:
print "FOO isn't defined (good)"
-
-
-
-
diff --git a/Examples/python/contract/Makefile b/Examples/python/contract/Makefile
index fe1d9325ecb..54817c79d55 100644
--- a/Examples/python/contract/Makefile
+++ b/Examples/python/contract/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -9,12 +10,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean
diff --git a/Examples/python/contract/runme.py b/Examples/python/contract/runme.py
index d484ae916ed..ce01e5a1db4 100644
--- a/Examples/python/contract/runme.py
+++ b/Examples/python/contract/runme.py
@@ -1,13 +1,13 @@
# file: runme.py
-import example
+import example
# Call our gcd() function
x = 42
y = 105
-g = example.gcd(x,y)
-print "The gcd of %d and %d is %d" % (x,y,g)
+g = example.gcd(x, y)
+print "The gcd of %d and %d is %d" % (x, y, g)
# Manipulate the Foo global variable
@@ -19,12 +19,3 @@
# See if the change took effect
print "Foo = ", example.cvar.Foo
-
-
-
-
-
-
-
-
-
diff --git a/Examples/python/docstrings/Makefile b/Examples/python/docstrings/Makefile
index f471930dd78..f1365a59975 100644
--- a/Examples/python/docstrings/Makefile
+++ b/Examples/python/docstrings/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
diff --git a/Examples/python/docstrings/runme.py b/Examples/python/docstrings/runme.py
index b6c95e613e6..c25d291b68c 100644
--- a/Examples/python/docstrings/runme.py
+++ b/Examples/python/docstrings/runme.py
@@ -1,6 +1,5 @@
# file: runme.py
-import example
+import example
print "example.Foo.bar.__doc__ =", repr(example.Foo.bar.__doc__), "(Should be 'No comment')"
-
diff --git a/Examples/python/enum/Makefile b/Examples/python/enum/Makefile
index 41cded28496..471e3907364 100644
--- a/Examples/python/enum/Makefile
+++ b/Examples/python/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/enum/runme.py b/Examples/python/enum/runme.py
index 10c4a260d07..def01b147e6 100644
--- a/Examples/python/enum/runme.py
+++ b/Examples/python/enum/runme.py
@@ -18,9 +18,9 @@
print "\nTesting use of enums with functions\n"
example.enum_test(example.RED, example.Foo.IMPULSE)
-example.enum_test(example.BLUE, example.Foo.WARP)
+example.enum_test(example.BLUE, example.Foo.WARP)
example.enum_test(example.GREEN, example.Foo.LUDICROUS)
-example.enum_test(1234,5678)
+example.enum_test(1234, 5678)
print "\nTesting use of enum with class method"
f = example.Foo()
@@ -28,4 +28,3 @@
f.enum_test(example.Foo.IMPULSE)
f.enum_test(example.Foo.WARP)
f.enum_test(example.Foo.LUDICROUS)
-
diff --git a/Examples/python/exception/Makefile b/Examples/python/exception/Makefile
index ad3d49fe1c6..8420c829768 100644
--- a/Examples/python/exception/Makefile
+++ b/Examples/python/exception/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/exception/runme.py b/Examples/python/exception/runme.py
index 9e924119477..7fae4903028 100644
--- a/Examples/python/exception/runme.py
+++ b/Examples/python/exception/runme.py
@@ -6,38 +6,37 @@
t = example.Test()
try:
- t.unknown()
-except RuntimeError,e:
- print "incomplete type", e.args[0]
+ t.unknown()
+except RuntimeError, e:
+ print "incomplete type", e.args[0]
try:
- t.simple()
-except RuntimeError,e:
- print e.args[0]
+ t.simple()
+except RuntimeError, e:
+ print e.args[0]
try:
- t.message()
-except RuntimeError,e:
- print e.args[0]
+ t.message()
+except RuntimeError, e:
+ print e.args[0]
if not example.is_python_builtin():
- try:
+ try:
t.hosed()
- except example.Exc,e:
+ except example.Exc, e:
print e.code, e.msg
else:
- try:
+ try:
t.hosed()
- except BaseException,e:
- # Throwing builtin classes as exceptions not supported (-builtin option)
+ except BaseException, e:
+ # Throwing builtin classes as exceptions not supported (-builtin
+ # option)
print e
-for i in range(1,4):
- try:
- t.multi(i)
- except RuntimeError,e:
- print e.args[0]
- except example.Exc,e:
- print e.code, e.msg
-
-
+for i in range(1, 4):
+ try:
+ t.multi(i)
+ except RuntimeError, e:
+ print e.args[0]
+ except example.Exc, e:
+ print e.code, e.msg
diff --git a/Examples/python/exceptproxy/Makefile b/Examples/python/exceptproxy/Makefile
index f406dfaf480..65af5ec82cc 100644
--- a/Examples/python/exceptproxy/Makefile
+++ b/Examples/python/exceptproxy/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/exceptproxy/runme.py b/Examples/python/exceptproxy/runme.py
index 07e4b0a7fbb..970d6201d22 100644
--- a/Examples/python/exceptproxy/runme.py
+++ b/Examples/python/exceptproxy/runme.py
@@ -2,8 +2,8 @@
import example
if example.is_python_builtin():
- print "Skipping example: -builtin option does not support %exceptionclass"
- exit(0)
+ print "Skipping example: -builtin option does not support %exceptionclass"
+ exit(0)
q = example.intQueue(10)
@@ -12,18 +12,18 @@
print type(example.FullError)
try:
- for i in range(0,100):
- q.enqueue(i)
-except example.FullError,e:
- print "Maxsize is", e.maxsize
+ for i in range(0, 100):
+ q.enqueue(i)
+except example.FullError, e:
+ print "Maxsize is", e.maxsize
print "Removing items"
try:
- while 1:
- q.dequeue()
-except example.EmptyError,e:
- pass
+ while 1:
+ q.dequeue()
+except example.EmptyError, e:
+ pass
q = example.doubleQueue(1000)
@@ -31,21 +31,15 @@
print "Inserting items into doubleQueue"
try:
- for i in range(0,10000):
- q.enqueue(i*1.5)
-except example.FullError,e:
- print "Maxsize is", e.maxsize
+ for i in range(0, 10000):
+ q.enqueue(i * 1.5)
+except example.FullError, e:
+ print "Maxsize is", e.maxsize
print "Removing items"
try:
- while 1:
- q.dequeue()
-except example.EmptyError,e:
- pass
-
-
-
-
-
-
+ while 1:
+ q.dequeue()
+except example.EmptyError, e:
+ pass
diff --git a/Examples/python/extend/Makefile b/Examples/python/extend/Makefile
index a4c4d2a69ea..71926f397b3 100644
--- a/Examples/python/extend/Makefile
+++ b/Examples/python/extend/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/extend/runme.py b/Examples/python/extend/runme.py
index 240b098948e..2bb38fadce7 100644
--- a/Examples/python/extend/runme.py
+++ b/Examples/python/extend/runme.py
@@ -2,16 +2,18 @@
# This file illustrates the cross language polymorphism using directors.
-import example
+import example
# CEO class, which overrides Employee::getPosition().
class CEO(example.Manager):
- def __init__(self, name):
- example.Manager.__init__(self, name)
- def getPosition(self):
- return "CEO"
+
+ def __init__(self, name):
+ example.Manager.__init__(self, name)
+
+ def getPosition(self):
+ return "CEO"
# Create an instance of our employee extension class, CEO. The calls to
@@ -78,4 +80,3 @@ def getPosition(self):
# All done.
print "python exit"
-
diff --git a/Examples/python/funcptr/Makefile b/Examples/python/funcptr/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/funcptr/Makefile
+++ b/Examples/python/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/funcptr/runme.py b/Examples/python/funcptr/runme.py
index bce06505781..bf0c6e1acff 100644
--- a/Examples/python/funcptr/runme.py
+++ b/Examples/python/funcptr/runme.py
@@ -1,6 +1,6 @@
# file: runme.py
-import example
+import example
a = 37
b = 42
@@ -10,9 +10,9 @@
print "Trying some C callback functions"
print " a =", a
print " b =", b
-print " ADD(a,b) =", example.do_op(a,b,example.ADD)
-print " SUB(a,b) =", example.do_op(a,b,example.SUB)
-print " MUL(a,b) =", example.do_op(a,b,example.MUL)
+print " ADD(a,b) =", example.do_op(a, b, example.ADD)
+print " SUB(a,b) =", example.do_op(a, b, example.SUB)
+print " MUL(a,b) =", example.do_op(a, b, example.MUL)
print "Here is what the C callback function objects look like in Python"
print " ADD =", example.ADD
diff --git a/Examples/python/funcptr2/Makefile b/Examples/python/funcptr2/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/funcptr2/Makefile
+++ b/Examples/python/funcptr2/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/funcptr2/runme.py b/Examples/python/funcptr2/runme.py
index bd58fb6206a..a4405d9d9b7 100644
--- a/Examples/python/funcptr2/runme.py
+++ b/Examples/python/funcptr2/runme.py
@@ -1,6 +1,6 @@
# file: runme.py
-import example
+import example
a = 37
b = 42
@@ -10,9 +10,9 @@
print "Trying some C callback functions"
print " a =", a
print " b =", b
-print " ADD(a,b) =", example.do_op(a,b,example.ADD)
-print " SUB(a,b) =", example.do_op(a,b,example.SUB)
-print " MUL(a,b) =", example.do_op(a,b,example.MUL)
+print " ADD(a,b) =", example.do_op(a, b, example.ADD)
+print " SUB(a,b) =", example.do_op(a, b, example.SUB)
+print " MUL(a,b) =", example.do_op(a, b, example.MUL)
print "Here is what the C callback function objects look like in Python"
print " ADD =", example.ADD
@@ -20,5 +20,5 @@
print " MUL =", example.MUL
print "Call the functions directly..."
-print " add(a,b) =", example.add(a,b)
-print " sub(a,b) =", example.sub(a,b)
+print " add(a,b) =", example.add(a, b)
+print " sub(a,b) =", example.sub(a, b)
diff --git a/Examples/python/functor/Makefile b/Examples/python/functor/Makefile
index 1234c310e01..e5de5c5b782 100644
--- a/Examples/python/functor/Makefile
+++ b/Examples/python/functor/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/functor/runme.py b/Examples/python/functor/runme.py
index 8fc0f2ff2f0..7f6f2b649bc 100644
--- a/Examples/python/functor/runme.py
+++ b/Examples/python/functor/runme.py
@@ -8,10 +8,9 @@
# Use the objects. They should be callable just like a normal
# python function.
-for i in range(0,100):
+for i in range(0, 100):
a(i) # Note: function call
b(math.sqrt(i)) # Note: function call
print a.result()
print b.result()
-
diff --git a/Examples/python/import/Makefile b/Examples/python/import/Makefile
index d83dfeaa8be..ad208b3e789 100644
--- a/Examples/python/import/Makefile
+++ b/Examples/python/import/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
clean:
diff --git a/Examples/python/import/runme.py b/Examples/python/import/runme.py
index 6b800ecb8b2..0e83acad0e5 100644
--- a/Examples/python/import/runme.py
+++ b/Examples/python/import/runme.py
@@ -81,31 +81,27 @@
print " Spam -> Base -> Foo : ",
y = foo.Foo_fromBase(x)
if y:
- print "bad swig"
+ print "bad swig"
else:
- print "good swig"
+ print "good swig"
print " Spam -> Base -> Bar : ",
y = bar.Bar_fromBase(x)
if y:
- print "good swig"
+ print "good swig"
else:
- print "bad swig"
-
+ print "bad swig"
+
print " Spam -> Base -> Spam : ",
y = spam.Spam_fromBase(x)
if y:
- print "good swig"
+ print "good swig"
else:
- print "bad swig"
+ print "bad swig"
print " Foo -> Spam : ",
y = spam.Spam_fromBase(b)
if y:
- print "bad swig"
+ print "bad swig"
else:
- print "good swig"
-
-
-
-
+ print "good swig"
diff --git a/Examples/python/import_packages/Makefile b/Examples/python/import_packages/Makefile
index dfd46d05c5f..72b424a906f 100644
--- a/Examples/python/import_packages/Makefile
+++ b/Examples/python/import_packages/Makefile
@@ -1,8 +1,6 @@
TOP = ../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
-PY3 =
import_packages_subdirs = \
same_modnames1 \
@@ -26,12 +24,12 @@ check: build
build:
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build); \
done
static:
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static); \
+ (cd $$s && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static); \
done
clean:
diff --git a/Examples/python/import_packages/from_init1/Makefile b/Examples/python/import_packages/from_init1/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/from_init1/Makefile
+++ b/Examples/python/import_packages/from_init1/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init1/py2/Makefile b/Examples/python/import_packages/from_init1/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init1/py2/Makefile
+++ b/Examples/python/import_packages/from_init1/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
index 1eb810e0566..102a8938b9f 100644
--- a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
@@ -1,19 +1,24 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
clean::
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init1/py3/Makefile b/Examples/python/import_packages/from_init1/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init1/py3/Makefile
+++ b/Examples/python/import_packages/from_init1/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
index 1eb810e0566..102a8938b9f 100644
--- a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
@@ -1,19 +1,24 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
clean::
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py
index bbe092babfd..dda397487de 100644
--- a/Examples/python/import_packages/from_init1/runme.py
+++ b/Examples/python/import_packages/from_init1/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
-if sys.version_info < (3,0):
- import py2.pkg2
- print " Finished importing py2.pkg2"
+if sys.version_info < (3, 0):
+ import py2.pkg2
+ print " Finished importing py2.pkg2"
else:
- import py3.pkg2
- print " Finished importing py3.pkg2"
+ import py3.pkg2
+ print " Finished importing py3.pkg2"
diff --git a/Examples/python/import_packages/from_init2/Makefile b/Examples/python/import_packages/from_init2/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/from_init2/Makefile
+++ b/Examples/python/import_packages/from_init2/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init2/py2/Makefile b/Examples/python/import_packages/from_init2/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init2/py2/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init2/py3/Makefile b/Examples/python/import_packages/from_init2/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init2/py3/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py
index bbe092babfd..dda397487de 100644
--- a/Examples/python/import_packages/from_init2/runme.py
+++ b/Examples/python/import_packages/from_init2/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
-if sys.version_info < (3,0):
- import py2.pkg2
- print " Finished importing py2.pkg2"
+if sys.version_info < (3, 0):
+ import py2.pkg2
+ print " Finished importing py2.pkg2"
else:
- import py3.pkg2
- print " Finished importing py3.pkg2"
+ import py3.pkg2
+ print " Finished importing py3.pkg2"
diff --git a/Examples/python/import_packages/from_init3/Makefile b/Examples/python/import_packages/from_init3/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/from_init3/Makefile
+++ b/Examples/python/import_packages/from_init3/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init3/py2/Makefile b/Examples/python/import_packages/from_init3/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init3/py2/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
index d6ae1b2bc44..6f193fa336b 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
index 286d90070a5..a870607e23d 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init3/py3/Makefile b/Examples/python/import_packages/from_init3/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/from_init3/py3/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
index d6ae1b2bc44..6f193fa336b 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
index 286d90070a5..a870607e23d 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py
index bbe092babfd..dda397487de 100644
--- a/Examples/python/import_packages/from_init3/runme.py
+++ b/Examples/python/import_packages/from_init3/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
-if sys.version_info < (3,0):
- import py2.pkg2
- print " Finished importing py2.pkg2"
+if sys.version_info < (3, 0):
+ import py2.pkg2
+ print " Finished importing py2.pkg2"
else:
- import py3.pkg2
- print " Finished importing py3.pkg2"
+ import py3.pkg2
+ print " Finished importing py3.pkg2"
diff --git a/Examples/python/import_packages/relativeimport1/Makefile b/Examples/python/import_packages/relativeimport1/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/relativeimport1/Makefile
+++ b/Examples/python/import_packages/relativeimport1/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/Makefile b/Examples/python/import_packages/relativeimport1/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport1/py2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/Makefile b/Examples/python/import_packages/relativeimport1/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport1/py3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py
index 99b6e513ec8..997476b1d19 100644
--- a/Examples/python/import_packages/relativeimport1/runme.py
+++ b/Examples/python/import_packages/relativeimport1/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) with -relativeimport"
-if sys.version_info < (3,0):
- import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+if sys.version_info < (3, 0):
+ import py2.pkg2.bar
+ print " Finished importing py2.pkg2.bar"
else:
- import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ import py3.pkg2.bar
+ print " Finished importing py3.pkg2.bar"
diff --git a/Examples/python/import_packages/relativeimport2/Makefile b/Examples/python/import_packages/relativeimport2/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/relativeimport2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/Makefile b/Examples/python/import_packages/relativeimport2/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport2/py2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
index d6ae1b2bc44..6f193fa336b 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
index 286d90070a5..a870607e23d 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/Makefile b/Examples/python/import_packages/relativeimport2/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport2/py3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
index d6ae1b2bc44..6f193fa336b 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg4 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
index 286d90070a5..a870607e23d 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py
index f0ab6c44690..9789afc1898 100644
--- a/Examples/python/import_packages/relativeimport2/runme.py
+++ b/Examples/python/import_packages/relativeimport2/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
-if sys.version_info < (3,0):
- import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+if sys.version_info < (3, 0):
+ import py2.pkg2.bar
+ print " Finished importing py2.pkg2.bar"
else:
- import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ import py3.pkg2.bar
+ print " Finished importing py3.pkg2.bar"
diff --git a/Examples/python/import_packages/relativeimport3/Makefile b/Examples/python/import_packages/relativeimport3/Makefile
index b9d803a0e79..90c92ab1c88 100644
--- a/Examples/python/import_packages/relativeimport3/Makefile
+++ b/Examples/python/import_packages/relativeimport3/Makefile
@@ -1,8 +1,5 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
-PY3 =
ifeq (,$(PY3))
PKG1DIR = "py2"
@@ -14,10 +11,10 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
static:
- cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+ cd $(PKG1DIR) && $(MAKE) SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/Makefile b/Examples/python/import_packages/relativeimport3/py2/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport3/py2/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py2/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/Makefile b/Examples/python/import_packages/relativeimport3/py3/Makefile
index 9595397d81e..62962514409 100644
--- a/Examples/python/import_packages/relativeimport3/py3/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py3/Makefile
@@ -1,13 +1,12 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
SWIGOPT =
LIBS =
build:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile
index 36e099b782a..c1f234e34dc 100644
--- a/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile
@@ -1,17 +1,20 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile
index cb20bd25f94..7a0cb18ad83 100644
--- a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py
index 99b6e513ec8..997476b1d19 100644
--- a/Examples/python/import_packages/relativeimport3/runme.py
+++ b/Examples/python/import_packages/relativeimport3/runme.py
@@ -5,9 +5,9 @@
testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
print "Testing " + testname + " - %module(package=...) with -relativeimport"
-if sys.version_info < (3,0):
- import py2.pkg2.bar
- print " Finished importing py2.pkg2.bar"
+if sys.version_info < (3, 0):
+ import py2.pkg2.bar
+ print " Finished importing py2.pkg2.bar"
else:
- import py3.pkg2.bar
- print " Finished importing py3.pkg2.bar"
+ import py3.pkg2.bar
+ print " Finished importing py3.pkg2.bar"
diff --git a/Examples/python/import_packages/same_modnames1/Makefile b/Examples/python/import_packages/same_modnames1/Makefile
index e05c130178c..57148c61425 100644
--- a/Examples/python/import_packages/same_modnames1/Makefile
+++ b/Examples/python/import_packages/same_modnames1/Makefile
@@ -1,18 +1,16 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
- cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/same_modnames1/pkg1/Makefile b/Examples/python/import_packages/same_modnames1/pkg1/Makefile
index df1b30321b7..3ca7fab03af 100644
--- a/Examples/python/import_packages/same_modnames1/pkg1/Makefile
+++ b/Examples/python/import_packages/same_modnames1/pkg1/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames1/pkg2/Makefile b/Examples/python/import_packages/same_modnames1/pkg2/Makefile
index df1b30321b7..3ca7fab03af 100644
--- a/Examples/python/import_packages/same_modnames1/pkg2/Makefile
+++ b/Examples/python/import_packages/same_modnames1/pkg2/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index 7bec1ec1e85..3c3c00c1a57 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -8,6 +8,12 @@
print " Finished importing pkg2.foo"
var2 = pkg2.foo.Pkg2_Foo()
-if str(type(var2)).find("'pkg2.foo.Pkg2_Foo'") == -1:
- raise RuntimeError("failed type checking: " + str(type(var2)))
+
+classname = str(type(var2))
+# Check for an old-style class if swig was run in -classic mode
+if classname == "":
+ classname = str(var2.__class__)
+
+if classname.find("pkg2.foo.Pkg2_Foo") == -1:
+ raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg2.foo.Pkg2_Foo"
diff --git a/Examples/python/import_packages/same_modnames2/Makefile b/Examples/python/import_packages/same_modnames2/Makefile
index 770343a800a..cf6db0c411b 100644
--- a/Examples/python/import_packages/same_modnames2/Makefile
+++ b/Examples/python/import_packages/same_modnames2/Makefile
@@ -1,18 +1,16 @@
TOP = ../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
-SWIGOPT =
LIBS =
check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
- cd pkg1/pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+ cd pkg1/pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
- cd pkg1/pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg1 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+ cd pkg1/pkg2 && $(MAKE) SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/python/import_packages/same_modnames2/pkg1/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/Makefile
index df1b30321b7..3ca7fab03af 100644
--- a/Examples/python/import_packages/same_modnames2/pkg1/Makefile
+++ b/Examples/python/import_packages/same_modnames2/pkg1/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
index 11e8573ad2c..921bb995167 100644
--- a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
+++ b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
@@ -1,15 +1,18 @@
TOP = ../../../../..
-SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index eec6121ebec..38daad0a356 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -6,7 +6,13 @@
import pkg1.pkg2.foo
print " Finished importing pkg1.pkg2.foo"
-var2 = pkg1.pkg2.foo.Pkg2_Foo();
-if str(type(var2)).find("'pkg1.pkg2.foo.Pkg2_Foo'") == -1:
- raise RuntimeError("failed type checking: " + str(type(var2)))
+var2 = pkg1.pkg2.foo.Pkg2_Foo()
+
+classname = str(type(var2))
+# Check for an old-style class if swig was run in -classic mode
+if classname == "":
+ classname = str(var2.__class__)
+
+if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1:
+ raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg1.pkg2.foo.Pkg2_Foo"
diff --git a/Examples/python/import_template/Makefile b/Examples/python/import_template/Makefile
index d83dfeaa8be..ad208b3e789 100644
--- a/Examples/python/import_template/Makefile
+++ b/Examples/python/import_template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp
clean:
diff --git a/Examples/python/import_template/runme.py b/Examples/python/import_template/runme.py
index 0d5aded1469..35f8924c123 100644
--- a/Examples/python/import_template/runme.py
+++ b/Examples/python/import_template/runme.py
@@ -81,31 +81,27 @@
print " Spam -> Base -> Foo : ",
y = foo.intFoo_fromBase(x)
if y:
- print "bad swig"
+ print "bad swig"
else:
- print "good swig"
+ print "good swig"
print " Spam -> Base -> Bar : ",
y = bar.intBar_fromBase(x)
if y:
- print "good swig"
+ print "good swig"
else:
- print "bad swig"
-
+ print "bad swig"
+
print " Spam -> Base -> Spam : ",
y = spam.intSpam_fromBase(x)
if y:
- print "good swig"
+ print "good swig"
else:
- print "bad swig"
+ print "bad swig"
print " Foo -> Spam : ",
y = spam.intSpam_fromBase(b)
if y:
- print "bad swig"
+ print "bad swig"
else:
- print "good swig"
-
-
-
-
+ print "good swig"
diff --git a/Examples/python/java/Makefile b/Examples/python/java/Makefile
index 4befa38ba35..7c75e6b91c5 100644
--- a/Examples/python/java/Makefile
+++ b/Examples/python/java/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
CXXSHARED="gcj -fpic -shared Example.class" DEFS='' LIBS="-lstdc++" python_cpp
diff --git a/Examples/python/java/runme.py b/Examples/python/java/runme.py
index 0cec8a7cb3c..641ba27dd61 100644
--- a/Examples/python/java/runme.py
+++ b/Examples/python/java/runme.py
@@ -6,11 +6,11 @@
e1 = Example(1)
e2 = Example(2)
-print e1.Add(1,2)
-print e1.Add(1.0,2.0)
-e3 = e1.Add(e1,e2)
+print e1.Add(1, 2)
+print e1.Add(1.0, 2.0)
+e3 = e1.Add(e1, e2)
print e3.mPublicInt
-print e1.Add("1","2")
+print e1.Add("1", "2")
JvDetachCurrentThread()
diff --git a/Examples/python/libffi/Makefile b/Examples/python/libffi/Makefile
index db5dfe13888..0875fdd9666 100644
--- a/Examples/python/libffi/Makefile
+++ b/Examples/python/libffi/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS='-L/usr/local/lib -lffi' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/multimap/Makefile b/Examples/python/multimap/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/multimap/Makefile
+++ b/Examples/python/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/multimap/example.i b/Examples/python/multimap/example.i
index cc2482cc8b6..635f61c13d5 100644
--- a/Examples/python/multimap/example.i
+++ b/Examples/python/multimap/example.i
@@ -20,7 +20,7 @@ extern int gcd(int x, int y);
if (!PyList_Check($input)) {
SWIG_exception(SWIG_ValueError, "Expecting a list");
}
- $1 = PyList_Size($input);
+ $1 = (int)PyList_Size($input);
if ($1 == 0) {
SWIG_exception(SWIG_ValueError, "List must contain at least 1 element");
}
@@ -73,7 +73,7 @@ extern int gcdmain(int argc, char *argv[]);
}
utf8str = PyUnicode_AsUTF8String($input);
PyBytes_AsStringAndSize(utf8str, &cstr, &len);
- $1 = strndup(cstr, (size_t)len);
+ $1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len;
Py_DECREF(utf8str);
%#else
@@ -82,7 +82,7 @@ extern int gcdmain(int argc, char *argv[]);
return NULL;
}
$1 = PyString_AsString($input);
- $2 = PyString_Size($input);
+ $2 = (int)PyString_Size($input);
%#endif
}
@@ -106,11 +106,11 @@ extern int count(char *bytes, int len, char c);
Py_ssize_t len;
PyObject *utf8str = PyUnicode_AsUTF8String($input);
PyBytes_AsStringAndSize(utf8str, &cstr, &len);
- $1 = strndup(cstr, (size_t)len);
+ $1 = strncpy((char *)malloc(len+1), cstr, (size_t)len);
$2 = (int)len;
Py_DECREF(utf8str);
%#else
- $2 = PyString_Size($input);
+ $2 = (int)PyString_Size($input);
$1 = (char *) malloc($2+1);
memmove($1,PyString_AsString($input),$2);
%#endif
diff --git a/Examples/python/multimap/runme.py b/Examples/python/multimap/runme.py
index f996ab3aee8..ad693b73a3e 100644
--- a/Examples/python/multimap/runme.py
+++ b/Examples/python/multimap/runme.py
@@ -1,16 +1,16 @@
# file: runme.py
-import example
+import example
# Call our gcd() function
x = 42
y = 105
-g = example.gcd(x,y)
-print "The gcd of %d and %d is %d" % (x,y,g)
+g = example.gcd(x, y)
+print "The gcd of %d and %d is %d" % (x, y, g)
# Call the gcdmain() function
-example.gcdmain(["gcdmain","42","105"])
+example.gcdmain(["gcdmain", "42", "105"])
# Call the count function
print example.count("Hello World", "l")
@@ -18,10 +18,3 @@
# Call the capitalize function
print example.capitalize("hello world")
-
-
-
-
-
-
-
diff --git a/Examples/python/operator/Makefile b/Examples/python/operator/Makefile
index 1234c310e01..e5de5c5b782 100644
--- a/Examples/python/operator/Makefile
+++ b/Examples/python/operator/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/operator/runme.py b/Examples/python/operator/runme.py
index 3687a38de6c..ac48f267604 100644
--- a/Examples/python/operator/runme.py
+++ b/Examples/python/operator/runme.py
@@ -1,21 +1,20 @@
# Operator overloading example
import example
-a = example.Complex(2,3)
-b = example.Complex(-5,10)
+a = example.Complex(2, 3)
+b = example.Complex(-5, 10)
-print "a =",a
-print "b =",b
+print "a =", a
+print "b =", b
c = a + b
-print "c =",c
-print "a*b =",a*b
-print "a-c =",a-c
+print "c =", c
+print "a*b =", a * b
+print "a-c =", a - c
-e = example.ComplexCopy(a-c)
-print "e =",e
+e = example.ComplexCopy(a - c)
+print "e =", e
# Big expression
-f = ((a+b)*(c+b*e)) + (-a)
-print "f =",f
-
+f = ((a + b) * (c + b * e)) + (-a)
+print "f =", f
diff --git a/Examples/python/performance/constructor/Makefile b/Examples/python/performance/constructor/Makefile
index 8e65123cf27..cbc11543ffd 100644
--- a/Examples/python/performance/constructor/Makefile
+++ b/Examples/python/performance/constructor/Makefile
@@ -1,19 +1,24 @@
TOP = ../../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = Simple
INTERFACE = Simple.i
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \
- TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \
- TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \
- TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-module Simple_baseline' TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-O -module Simple_optimized' TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-builtin -O -module Simple_builtin' TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/performance/constructor/runme.py b/Examples/python/performance/constructor/runme.py
index 274cbf85e17..1771fba7b24 100644
--- a/Examples/python/performance/constructor/runme.py
+++ b/Examples/python/performance/constructor/runme.py
@@ -2,8 +2,9 @@
sys.path.append('..')
import harness
-def proc (mod) :
- for i in range(1000000) :
+
+def proc(mod):
+ for i in range(1000000):
x = mod.MyClass()
harness.run(proc)
diff --git a/Examples/python/performance/func/Makefile b/Examples/python/performance/func/Makefile
index 8e65123cf27..cbc11543ffd 100644
--- a/Examples/python/performance/func/Makefile
+++ b/Examples/python/performance/func/Makefile
@@ -1,19 +1,24 @@
TOP = ../../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = Simple
INTERFACE = Simple.i
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \
- TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \
- TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \
- TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-module Simple_baseline' TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-O -module Simple_optimized' TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-builtin -O -module Simple_builtin' TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/performance/func/runme.py b/Examples/python/performance/func/runme.py
index f9032b9d226..760a8ab6dd8 100644
--- a/Examples/python/performance/func/runme.py
+++ b/Examples/python/performance/func/runme.py
@@ -2,9 +2,10 @@
sys.path.append('..')
import harness
-def proc (mod) :
+
+def proc(mod):
x = mod.MyClass()
- for i in range(10000000) :
+ for i in range(10000000):
x.func()
harness.run(proc)
diff --git a/Examples/python/performance/harness.py b/Examples/python/performance/harness.py
index 00f48e66a7b..c3d38b4fbfb 100644
--- a/Examples/python/performance/harness.py
+++ b/Examples/python/performance/harness.py
@@ -3,9 +3,10 @@
import imp
from subprocess import *
-def run (proc) :
- try :
+def run(proc):
+
+ try:
mod = imp.find_module(sys.argv[1])
mod = imp.load_module(sys.argv[1], *mod)
@@ -14,15 +15,18 @@ def run (proc) :
t2 = time.clock()
print "%s took %f seconds" % (mod.__name__, t2 - t1)
- except IndexError :
- proc = Popen([sys.executable, 'runme.py', 'Simple_baseline'], stdout=PIPE)
+ except IndexError:
+ proc = Popen(
+ [sys.executable, 'runme.py', 'Simple_baseline'], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
- proc = Popen([sys.executable, 'runme.py', 'Simple_optimized'], stdout=PIPE)
+ proc = Popen(
+ [sys.executable, 'runme.py', 'Simple_optimized'], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
- proc = Popen([sys.executable, 'runme.py', 'Simple_builtin'], stdout=PIPE)
+ proc = Popen(
+ [sys.executable, 'runme.py', 'Simple_builtin'], stdout=PIPE)
(stdout, stderr) = proc.communicate()
print stdout
diff --git a/Examples/python/performance/hierarchy/Makefile b/Examples/python/performance/hierarchy/Makefile
index 8e65123cf27..cbc11543ffd 100644
--- a/Examples/python/performance/hierarchy/Makefile
+++ b/Examples/python/performance/hierarchy/Makefile
@@ -1,19 +1,24 @@
TOP = ../../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = Simple
INTERFACE = Simple.i
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \
- TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \
- TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \
- TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-module Simple_baseline' TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-O -module Simple_optimized' TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-builtin -O -module Simple_builtin' TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/performance/hierarchy/runme.py b/Examples/python/performance/hierarchy/runme.py
index 9b22586a1d0..8255cdc86c0 100644
--- a/Examples/python/performance/hierarchy/runme.py
+++ b/Examples/python/performance/hierarchy/runme.py
@@ -2,9 +2,10 @@
sys.path.append('..')
import harness
-def proc (mod) :
+
+def proc(mod):
x = mod.H()
- for i in range(10000000) :
+ for i in range(10000000):
x.func()
harness.run(proc)
diff --git a/Examples/python/performance/hierarchy_operator/Makefile b/Examples/python/performance/hierarchy_operator/Makefile
index 8e65123cf27..cbc11543ffd 100644
--- a/Examples/python/performance/hierarchy_operator/Makefile
+++ b/Examples/python/performance/hierarchy_operator/Makefile
@@ -1,19 +1,24 @@
TOP = ../../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = Simple
INTERFACE = Simple.i
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \
- TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \
- TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \
- TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-module Simple_baseline' TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-O -module Simple_optimized' TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-builtin -O -module Simple_builtin' TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/performance/hierarchy_operator/runme.py b/Examples/python/performance/hierarchy_operator/runme.py
index 5a8c5255709..eabfae864cc 100644
--- a/Examples/python/performance/hierarchy_operator/runme.py
+++ b/Examples/python/performance/hierarchy_operator/runme.py
@@ -2,9 +2,10 @@
sys.path.append('..')
import harness
-def proc (mod) :
+
+def proc(mod):
x = mod.H()
- for i in range(10000000) :
+ for i in range(10000000):
x += i
harness.run(proc)
diff --git a/Examples/python/performance/operator/Makefile b/Examples/python/performance/operator/Makefile
index 8e65123cf27..cbc11543ffd 100644
--- a/Examples/python/performance/operator/Makefile
+++ b/Examples/python/performance/operator/Makefile
@@ -1,19 +1,24 @@
TOP = ../../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = Simple
INTERFACE = Simple.i
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \
- TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \
- TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \
- TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-module Simple_baseline' TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-O -module Simple_optimized' TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-builtin -O -module Simple_builtin' TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/performance/operator/runme.py b/Examples/python/performance/operator/runme.py
index 4a6031f4865..d75ae404c33 100644
--- a/Examples/python/performance/operator/runme.py
+++ b/Examples/python/performance/operator/runme.py
@@ -2,9 +2,10 @@
sys.path.append('..')
import harness
-def proc (mod) :
+
+def proc(mod):
x = mod.MyClass()
- for i in range(10000000) :
+ for i in range(10000000):
x = x + i
harness.run(proc)
diff --git a/Examples/python/pointer/Makefile b/Examples/python/pointer/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/pointer/Makefile
+++ b/Examples/python/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/pointer/runme.py b/Examples/python/pointer/runme.py
index e38a306c178..5b5f16bc22d 100644
--- a/Examples/python/pointer/runme.py
+++ b/Examples/python/pointer/runme.py
@@ -1,25 +1,25 @@
# file: runme.py
-import example;
+import example
# First create some objects using the pointer library.
-print "Testing the pointer library";
-a = example.new_intp();
-b = example.new_intp();
-c = example.new_intp();
-example.intp_assign(a,37);
-example.intp_assign(b,42);
+print "Testing the pointer library"
+a = example.new_intp()
+b = example.new_intp()
+c = example.new_intp()
+example.intp_assign(a, 37)
+example.intp_assign(b, 42)
-print " a =",a
-print " b =",b
-print " c =",c
+print " a =", a
+print " b =", b
+print " c =", c
# Call the add() function with some pointers
-example.add(a,b,c)
+example.add(a, b, c)
# Now get the result
r = example.intp_value(c)
-print " 37 + 42 =",r
+print " 37 + 42 =", r
# Clean up the pointers
example.delete_intp(a)
@@ -30,15 +30,12 @@
# This should be much easier. Now how it is no longer
# necessary to manufacture pointers.
-print "Trying the typemap library";
-r = example.sub(37,42)
-print " 37 - 42 =",r
+print "Trying the typemap library"
+r = example.sub(37, 42)
+print " 37 - 42 =", r
# Now try the version with multiple return values
-print "Testing multiple return values";
-q,r = example.divide(42,37)
-print " 42/37 = %d remainder %d" % (q,r)
-
-
-
+print "Testing multiple return values"
+q, r = example.divide(42, 37)
+print " 42/37 = %d remainder %d" % (q, r)
diff --git a/Examples/python/reference/Makefile b/Examples/python/reference/Makefile
index 41cded28496..471e3907364 100644
--- a/Examples/python/reference/Makefile
+++ b/Examples/python/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/reference/runme.py b/Examples/python/reference/runme.py
index a1f53368e6c..0ff217b0226 100644
--- a/Examples/python/reference/runme.py
+++ b/Examples/python/reference/runme.py
@@ -7,22 +7,22 @@
# ----- Object creation -----
print "Creating some objects:"
-a = example.Vector(3,4,5)
-b = example.Vector(10,11,12)
+a = example.Vector(3, 4, 5)
+b = example.Vector(10, 11, 12)
-print " Created",a.cprint()
-print " Created",b.cprint()
+print " Created", a.cprint()
+print " Created", b.cprint()
# ----- Call an overloaded operator -----
# This calls the wrapper we placed around
#
-# operator+(const Vector &a, const Vector &)
+# operator+(const Vector &a, const Vector &)
#
# It returns a new allocated object.
print "Adding a+b"
-c = example.addv(a,b)
+c = example.addv(a, b)
print " a+b =", c.cprint()
# Note: Unless we free the result, a memory leak will occur
@@ -33,25 +33,25 @@
# Note: Using the high-level interface here
print "Creating an array of vectors"
va = example.VectorArray(10)
-print " va = ",va
+print " va = ", va
# ----- Set some values in the array -----
# These operators copy the value of $a and $b to the vector array
-va.set(0,a)
-va.set(1,b)
+va.set(0, a)
+va.set(1, b)
-va.set(2,example.addv(a,b))
+va.set(2, example.addv(a, b))
# Get some values from the array
print "Getting some array values"
-for i in range(0,5):
+for i in range(0, 5):
print " va(%d) = %s" % (i, va.get(i).cprint())
# Watch under resource meter to check on this
print "Making sure we don't leak memory."
-for i in xrange(0,1000000):
+for i in xrange(0, 1000000):
c = va.get(i % 10)
# ----- Clean up -----
@@ -60,4 +60,3 @@
del va
del a
del b
-
diff --git a/Examples/python/simple/Makefile b/Examples/python/simple/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/simple/Makefile
+++ b/Examples/python/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/simple/runme.py b/Examples/python/simple/runme.py
index d484ae916ed..ce01e5a1db4 100644
--- a/Examples/python/simple/runme.py
+++ b/Examples/python/simple/runme.py
@@ -1,13 +1,13 @@
# file: runme.py
-import example
+import example
# Call our gcd() function
x = 42
y = 105
-g = example.gcd(x,y)
-print "The gcd of %d and %d is %d" % (x,y,g)
+g = example.gcd(x, y)
+print "The gcd of %d and %d is %d" % (x, y, g)
# Manipulate the Foo global variable
@@ -19,12 +19,3 @@
# See if the change took effect
print "Foo = ", example.cvar.Foo
-
-
-
-
-
-
-
-
-
diff --git a/Examples/python/smartptr/Makefile b/Examples/python/smartptr/Makefile
index 19609353d30..34edcfc40d8 100644
--- a/Examples/python/smartptr/Makefile
+++ b/Examples/python/smartptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/smartptr/runme.py b/Examples/python/smartptr/runme.py
index 5ea1fb9473d..5f8b7347642 100644
--- a/Examples/python/smartptr/runme.py
+++ b/Examples/python/smartptr/runme.py
@@ -3,7 +3,7 @@
# This file illustrates the proxy class C++ interface generated
# by SWIG.
-import example
+import example
# ----- Object creation -----
@@ -17,7 +17,7 @@
# ----- Access a static member -----
-print "\nA total of", example.cvar.Shape_nshapes,"shapes were created"
+print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
# ----- Member data access -----
@@ -30,16 +30,16 @@
s.y = 5
print "\nHere is their current position:"
-print " Circle = (%f, %f)" % (c.x,c.y)
-print " Square = (%f, %f)" % (s.x,s.y)
+print " Circle = (%f, %f)" % (c.x, c.y)
+print " Square = (%f, %f)" % (s.x, s.y)
# ----- Call some methods -----
print "\nHere are some properties of the shapes:"
-for o in [c,s]:
- print " ", o
- print " area = ", o.area()
- print " perimeter = ", o.perimeter()
+for o in [c, s]:
+ print " ", o
+ print " area = ", o.area()
+ print " perimeter = ", o.perimeter()
print "\nGuess I'll clean up now"
@@ -50,6 +50,5 @@
del ss
s = 3
-print example.cvar.Shape_nshapes,"shapes remain"
+print example.cvar.Shape_nshapes, "shapes remain"
print "Goodbye"
-
diff --git a/Examples/python/std_map/Makefile b/Examples/python/std_map/Makefile
index f406dfaf480..65af5ec82cc 100644
--- a/Examples/python/std_map/Makefile
+++ b/Examples/python/std_map/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/std_map/runme.py b/Examples/python/std_map/runme.py
index b521c9c9c90..26031f3f4d0 100644
--- a/Examples/python/std_map/runme.py
+++ b/Examples/python/std_map/runme.py
@@ -7,8 +7,6 @@
pmap["hello"] = 2
-
-
dmap = {}
dmap["hello"] = 1.0
dmap["hi"] = 2.0
@@ -28,8 +26,8 @@
for i in dmap.itervalues():
print "val", i
-for k,v in dmap.iteritems():
- print "item", k,v
+for k, v in dmap.iteritems():
+ print "item", k, v
dmap = example.DoubleMap()
dmap["hello"] = 1.0
@@ -41,8 +39,8 @@
for i in dmap.itervalues():
print "val", i
-for k,v in dmap.iteritems():
- print "item", k,v
+for k, v in dmap.iteritems():
+ print "item", k, v
print dmap.items()
@@ -54,7 +52,6 @@
print hmap.values()
-
dmap = {}
dmap["hello"] = 2
dmap["hi"] = 4
@@ -76,7 +73,7 @@
for i in dmap.iteritems():
print "item", i
-for k,v in dmap.iteritems():
- print "item", k,v
+for k, v in dmap.iteritems():
+ print "item", k, v
print dmap
diff --git a/Examples/python/std_vector/Makefile b/Examples/python/std_vector/Makefile
index f406dfaf480..65af5ec82cc 100644
--- a/Examples/python/std_vector/Makefile
+++ b/Examples/python/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/std_vector/runme.py b/Examples/python/std_vector/runme.py
index d248ccbbbaf..d7d3c2ea49e 100644
--- a/Examples/python/std_vector/runme.py
+++ b/Examples/python/std_vector/runme.py
@@ -4,13 +4,13 @@
# Call average with a Python list...
-print example.average([1,2,3,4])
+print example.average([1, 2, 3, 4])
# ... or a wrapped std::vector
v = example.IntVector(4)
for i in range(len(v)):
- v[i] = i+1
+ v[i] = i + 1
print example.average(v)
@@ -22,8 +22,8 @@
# ... or a wrapped std::vector
v = example.DoubleVector()
-for i in [1,2,3,4]:
- v.append(i)
+for i in [1, 2, 3, 4]:
+ v.append(i)
print example.half(v)
@@ -31,6 +31,5 @@
example.halve_in_place(v)
for i in range(len(v)):
- print v[i], "; ",
+ print v[i], "; ",
print
-
diff --git a/Examples/python/template/Makefile b/Examples/python/template/Makefile
index f406dfaf480..65af5ec82cc 100644
--- a/Examples/python/template/Makefile
+++ b/Examples/python/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static
clean:
diff --git a/Examples/python/template/runme.py b/Examples/python/template/runme.py
index 05940bc6723..e408e15f9e6 100644
--- a/Examples/python/template/runme.py
+++ b/Examples/python/template/runme.py
@@ -3,32 +3,30 @@
import example
# Call some templated functions
-print example.maxint(3,7)
-print example.maxdouble(3.14,2.18)
+print example.maxint(3, 7)
+print example.maxdouble(3.14, 2.18)
# Create some class
iv = example.vecint(100)
dv = example.vecdouble(1000)
-for i in range(0,100):
- iv.setitem(i,2*i)
+for i in range(0, 100):
+ iv.setitem(i, 2 * i)
-for i in range(0,1000):
- dv.setitem(i, 1.0/(i+1))
+for i in range(0, 1000):
+ dv.setitem(i, 1.0 / (i + 1))
sum = 0
-for i in range(0,100):
- sum = sum + iv.getitem(i)
+for i in range(0, 100):
+ sum = sum + iv.getitem(i)
print sum
sum = 0.0
-for i in range(0,1000):
- sum = sum + dv.getitem(i)
+for i in range(0, 1000):
+ sum = sum + dv.getitem(i)
print sum
del iv
del dv
-
-
diff --git a/Examples/python/varargs/Makefile b/Examples/python/varargs/Makefile
index 8ec6e9cc9cb..a412cf2993a 100644
--- a/Examples/python/varargs/Makefile
+++ b/Examples/python/varargs/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/varargs/runme.py b/Examples/python/varargs/runme.py
index 8eab77041ea..48e3134f3f5 100644
--- a/Examples/python/varargs/runme.py
+++ b/Examples/python/varargs/runme.py
@@ -1,13 +1,13 @@
# file: runme.py
import sys
-import example
+import example
# Call printf
example.printf("Hello World. I'm printf\n")
# Note: We call printf, but use *python* string formatting
-for i in range(0,10):
+for i in range(0, 10):
example.printf("i is %d\n" % i)
# This will probably be garbled because %d is interpreted by C
@@ -15,21 +15,13 @@
stdout = example.stdout_stream()
# Call fprintf
-example.fprintf(stdout,"Hello World. I'm fprintf\n")
-for i in range(0,10):
- example.fprintf(stdout,"i is %d\n" % i)
+example.fprintf(stdout, "Hello World. I'm fprintf\n")
+for i in range(0, 10):
+ example.fprintf(stdout, "i is %d\n" % i)
# This won't be garbled since %d is not interpreted
-example.fprintf(stdout,"The value is %d\n")
+example.fprintf(stdout, "The value is %d\n")
# This function calls our NULL-terminated function
-example.printv("Hello","World","this","is","a","test.")
-
-
-
-
-
-
-
-
+example.printv("Hello", "World", "this", "is", "a", "test.")
diff --git a/Examples/python/variables/Makefile b/Examples/python/variables/Makefile
index 222916fa11c..26bfd946ea9 100644
--- a/Examples/python/variables/Makefile
+++ b/Examples/python/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
clean:
diff --git a/Examples/python/variables/runme.py b/Examples/python/variables/runme.py
index b635b985977..3388a0eba82 100644
--- a/Examples/python/variables/runme.py
+++ b/Examples/python/variables/runme.py
@@ -4,21 +4,21 @@
# Try to set the values of some global variables
-example.cvar.ivar = 42
-example.cvar.svar = -31000
-example.cvar.lvar = 65537
-example.cvar.uivar = 123456
-example.cvar.usvar = 61000
-example.cvar.ulvar = 654321
-example.cvar.scvar = -13
-example.cvar.ucvar = 251
-example.cvar.cvar = "S"
-example.cvar.fvar = 3.14159
-example.cvar.dvar = 2.1828
-example.cvar.strvar = "Hello World"
-example.cvar.iptrvar= example.new_int(37)
-example.cvar.ptptr = example.new_Point(37,42)
-example.cvar.name = "Bill"
+example.cvar.ivar = 42
+example.cvar.svar = -31000
+example.cvar.lvar = 65537
+example.cvar.uivar = 123456
+example.cvar.usvar = 61000
+example.cvar.ulvar = 654321
+example.cvar.scvar = -13
+example.cvar.ucvar = 251
+example.cvar.cvar = "S"
+example.cvar.fvar = 3.14159
+example.cvar.dvar = 2.1828
+example.cvar.strvar = "Hello World"
+example.cvar.iptrvar = example.new_int(37)
+example.cvar.ptptr = example.new_Point(37, 42)
+example.cvar.name = "Bill"
# Now print out the values of the variables
@@ -46,16 +46,16 @@
example.print_vars()
-print "\nNow I'm going to try and modify some read only variables";
+print "\nNow I'm going to try and modify some read only variables"
-print " Tring to set 'path'";
+print " Tring to set 'path'"
try:
example.cvar.path = "Whoa!"
print "Hey, what's going on?!?! This shouldn't work"
except:
print "Good."
-print " Trying to set 'status'";
+print " Trying to set 'status'"
try:
example.cvar.status = 0
print "Hey, what's going on?!?! This shouldn't work"
@@ -70,6 +70,3 @@
print "The new value is"
example.pt_print()
print "You should see the value", example.Point_print(example.cvar.ptptr)
-
-
-
diff --git a/Examples/r/class/Makefile b/Examples/r/class/Makefile
index 3e5d6a6ca31..6b4b306f328 100644
--- a/Examples/r/class/Makefile
+++ b/Examples/r/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -8,7 +9,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' r_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' r_cpp
clean:
diff --git a/Examples/r/simple/Makefile b/Examples/r/simple/Makefile
index 5cc41530c47..add881898af 100644
--- a/Examples/r/simple/Makefile
+++ b/Examples/r/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,7 +9,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' r_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' r
clean:
diff --git a/Examples/ruby/class/Makefile b/Examples/ruby/class/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/class/Makefile
+++ b/Examples/ruby/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/constants/Makefile b/Examples/ruby/constants/Makefile
index 561d5fd8443..24698f2b4c9 100644
--- a/Examples/ruby/constants/Makefile
+++ b/Examples/ruby/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/enum/Makefile b/Examples/ruby/enum/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/enum/Makefile
+++ b/Examples/ruby/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/exception_class/Makefile b/Examples/ruby/exception_class/Makefile
index 6723a2a7cef..2d4518e1137 100644
--- a/Examples/ruby/exception_class/Makefile
+++ b/Examples/ruby/exception_class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/free_function/Makefile b/Examples/ruby/free_function/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/free_function/Makefile
+++ b/Examples/ruby/free_function/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/funcptr/Makefile b/Examples/ruby/funcptr/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/funcptr/Makefile
+++ b/Examples/ruby/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/funcptr2/Makefile b/Examples/ruby/funcptr2/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/funcptr2/Makefile
+++ b/Examples/ruby/funcptr2/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/functor/Makefile b/Examples/ruby/functor/Makefile
index 348bd66e36b..c7f998c147e 100644
--- a/Examples/ruby/functor/Makefile
+++ b/Examples/ruby/functor/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
TARGET = example
INTERFACE = example.i
LIBS = -lm
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/hashargs/Makefile b/Examples/ruby/hashargs/Makefile
index 59a36c0dd27..2d0d943e1d8 100644
--- a/Examples/ruby/hashargs/Makefile
+++ b/Examples/ruby/hashargs/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/import/Makefile b/Examples/ruby/import/Makefile
index b5d06bdd735..586e4887089 100644
--- a/Examples/ruby/import/Makefile
+++ b/Examples/ruby/import/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean
diff --git a/Examples/ruby/import_template/Makefile b/Examples/ruby/import_template/Makefile
index b5d06bdd735..586e4887089 100644
--- a/Examples/ruby/import_template/Makefile
+++ b/Examples/ruby/import_template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean
diff --git a/Examples/ruby/java/Makefile b/Examples/ruby/java/Makefile
index 7d611abd23b..bec5e1844ff 100644
--- a/Examples/ruby/java/Makefile
+++ b/Examples/ruby/java/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
CXXSHARED="gcj -fpic -shared Example.class" LIBS="-lstdc++" DEFS='' ruby_cpp
diff --git a/Examples/ruby/mark_function/Makefile b/Examples/ruby/mark_function/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/mark_function/Makefile
+++ b/Examples/ruby/mark_function/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/mark_function/runme.rb b/Examples/ruby/mark_function/runme.rb
index 6d84ee88fcf..a7c5b042e2f 100644
--- a/Examples/ruby/mark_function/runme.rb
+++ b/Examples/ruby/mark_function/runme.rb
@@ -9,7 +9,7 @@
zoo.add_animal(tiger1)
# unset variables to force gc
- tiger = nil
+ tiger1 = nil
end
GC.start
@@ -20,4 +20,4 @@
# Call a method to verify the animal is still valid and not gc'ed
if tiger2.get_name != "tiger1"
raise RuntimeError, "Wrong animal name"
-end
+end
diff --git a/Examples/ruby/multimap/Makefile b/Examples/ruby/multimap/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/multimap/Makefile
+++ b/Examples/ruby/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/operator/Makefile b/Examples/ruby/operator/Makefile
index bdcf52646a4..53241eead62 100644
--- a/Examples/ruby/operator/Makefile
+++ b/Examples/ruby/operator/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/overloading/Makefile b/Examples/ruby/overloading/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/overloading/Makefile
+++ b/Examples/ruby/overloading/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/pointer/Makefile b/Examples/ruby/pointer/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/pointer/Makefile
+++ b/Examples/ruby/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/reference/Makefile b/Examples/ruby/reference/Makefile
index 516f842d7d8..0d469c6559d 100644
--- a/Examples/ruby/reference/Makefile
+++ b/Examples/ruby/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/simple/Makefile b/Examples/ruby/simple/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/simple/Makefile
+++ b/Examples/ruby/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/std_vector/Makefile b/Examples/ruby/std_vector/Makefile
index 370bd8fb6d1..636a0f19ffe 100644
--- a/Examples/ruby/std_vector/Makefile
+++ b/Examples/ruby/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/template/Makefile b/Examples/ruby/template/Makefile
index 370bd8fb6d1..636a0f19ffe 100644
--- a/Examples/ruby/template/Makefile
+++ b/Examples/ruby/template/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
SWIGOPT='$(SWIGOPT)' TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static
clean:
diff --git a/Examples/ruby/value/Makefile b/Examples/ruby/value/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/value/Makefile
+++ b/Examples/ruby/value/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/ruby/variables/Makefile b/Examples/ruby/variables/Makefile
index 15b39cf0d57..d320c9a83b9 100644
--- a/Examples/ruby/variables/Makefile
+++ b/Examples/ruby/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = example
INTERFACE = example.i
@@ -8,11 +9,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static
clean:
diff --git a/Examples/s-exp/uffi.lisp b/Examples/s-exp/uffi.lisp
index 253f85abae0..aea9a1405cf 100644
--- a/Examples/s-exp/uffi.lisp
+++ b/Examples/s-exp/uffi.lisp
@@ -15,7 +15,7 @@
(defvar *swig-source-directory* #p"/home/mkoeppe/s/swig1.3/")
-(defvar *swig-program* (merge-pathnames "preinst-swig" *swig-source-directory*))
+(defvar *swig-program* (merge-pathnames "swig" *swig-source-directory*))
(defun run-swig (swig-interface-file-name &key directory-search-list module
ignore-errors c++)
diff --git a/Examples/scilab/check.list b/Examples/scilab/check.list
new file mode 100644
index 00000000000..0bcf457c27c
--- /dev/null
+++ b/Examples/scilab/check.list
@@ -0,0 +1,16 @@
+# see top-level Makefile.in
+class
+constants
+contract
+enum
+funcptr
+matrix
+matrix2
+pointer
+simple
+std_list
+std_vector
+struct
+template
+variables
+
diff --git a/Examples/scilab/class/Makefile b/Examples/scilab/class/Makefile
new file mode 100644
index 00000000000..40c97a5f7be
--- /dev/null
+++ b/Examples/scilab/class/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+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_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/class/example.cxx b/Examples/scilab/class/example.cxx
new file mode 100644
index 00000000000..0463045196a
--- /dev/null
+++ b/Examples/scilab/class/example.cxx
@@ -0,0 +1,28 @@
+/* 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;
+}
diff --git a/Examples/scilab/class/example.h b/Examples/scilab/class/example.h
new file mode 100644
index 00000000000..0dff185b265
--- /dev/null
+++ b/Examples/scilab/class/example.h
@@ -0,0 +1,34 @@
+/* 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();
+};
diff --git a/Examples/scilab/class/example.i b/Examples/scilab/class/example.i
new file mode 100644
index 00000000000..fbdf7249fd2
--- /dev/null
+++ b/Examples/scilab/class/example.i
@@ -0,0 +1,9 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
diff --git a/Examples/scilab/class/runme.sci b/Examples/scilab/class/runme.sci
new file mode 100644
index 00000000000..236e541107e
--- /dev/null
+++ b/Examples/scilab/class/runme.sci
@@ -0,0 +1,52 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// ----- Object creation -----
+
+printf("Creating some objects:\n");
+c = new_Circle(10)
+s = new_Square(10)
+
+// ----- Access a static member -----
+
+printf("\nA total of %i shapes were created\n", Shape_nshapes_get());
+
+// ----- Member data access -----
+
+// Set the location of the object
+
+Shape_x_set(c, 20);
+Shape_y_set(c, 30);
+
+Shape_x_set(s, -10);
+Shape_y_set(s, 5);
+
+printf("\nHere is their current position:\n");
+printf(" Circle = (%f, %f)\n", Shape_x_get(c), Shape_y_get(c));
+printf(" Square = (%f, %f)\n", Shape_x_get(s), Shape_y_get(s));
+
+// ----- Call some methods -----
+
+printf("\nHere are some properties of the shapes:\n");
+function print_shape(o)
+ printf(" area = %f\n", Shape_area(o));
+ printf(" perimeter = %f\n", Shape_perimeter(o));
+endfunction
+print_shape(c);
+print_shape(s);
+
+printf("\nGuess I will clean up now\n");
+
+// Note: this invokes the virtual destructor
+delete_Circle(c);
+delete_Square(s);
+
+printf("%i shapes remain\n", Shape_nshapes_get());
+printf("Goodbye\n");
+
+exit
diff --git a/Examples/scilab/constants/Makefile b/Examples/scilab/constants/Makefile
new file mode 100644
index 00000000000..d47674b3756
--- /dev/null
+++ b/Examples/scilab/constants/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS =
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/constants/example.i b/Examples/scilab/constants/example.i
new file mode 100644
index 00000000000..1172a4edc62
--- /dev/null
+++ b/Examples/scilab/constants/example.i
@@ -0,0 +1,30 @@
+/* File : example.i */
+%module example
+
+/* Wraps enums and constants as Scilab variables (instead of functions) */
+%scilabconst(1);
+
+/* A few preprocessor macros */
+
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
+
+/* This should work just fine */
+#define EXPR ICONST + 3*(FCONST)
+
+/* This shouldn't do anything */
+#define EXTERN extern
+
+/* Neither should this (BAR isn't defined) */
+#define FOO (ICONST + BAR)
+
+/* The following directives also produce constants */
+
+%constant int iconst = 37;
+%constant double fconst = 3.14;
+
+
diff --git a/Examples/scilab/constants/runme.sci b/Examples/scilab/constants/runme.sci
new file mode 100644
index 00000000000..cfb28b6b4d5
--- /dev/null
+++ b/Examples/scilab/constants/runme.sci
@@ -0,0 +1,18 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+example_Init();
+
+printf("\nTest constants\n");
+printf("ICONST = %i (should be 42)\n", ICONST);
+printf("FCONST = %5.4f (should be 2.1828)\n", FCONST);
+printf("SCONST = ''%s'' (should be ''Hello World'')\n", SCONST);
+printf("EXPR = %5.4f (should be 48.5484)\n", EXPR);
+printf("iconst = %i (should be 37)\n", iconst);
+printf("fconst = %3.2f (should be 3.14)\n", fconst);
+
+exit
diff --git a/Examples/scilab/contract/Makefile b/Examples/scilab/contract/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/contract/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/contract/example.c b/Examples/scilab/contract/example.c
new file mode 100644
index 00000000000..1a644543fad
--- /dev/null
+++ b/Examples/scilab/contract/example.c
@@ -0,0 +1,23 @@
+/* File : example.c */
+
+/* A global variable */
+double Foo = 3.0;
+
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
+}
+
+int fact(int n) {
+ if (n <= 0) return 1;
+ return n*fact(n-1);
+}
+
+
diff --git a/Examples/scilab/contract/example.i b/Examples/scilab/contract/example.i
new file mode 100644
index 00000000000..8fd1a80af72
--- /dev/null
+++ b/Examples/scilab/contract/example.i
@@ -0,0 +1,21 @@
+/* File : example.i */
+%module example
+
+%contract gcd(int x, int y) {
+require:
+ x >= 0;
+ y >= 0;
+}
+
+%contract fact(int n) {
+require:
+ n >= 0;
+ensure:
+ fact >= 1;
+}
+
+%inline %{
+extern int gcd(int x, int y);
+extern int fact(int n);
+extern double Foo;
+%}
diff --git a/Examples/scilab/contract/runme.sci b/Examples/scilab/contract/runme.sci
new file mode 100644
index 00000000000..718424b29fd
--- /dev/null
+++ b/Examples/scilab/contract/runme.sci
@@ -0,0 +1,46 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+
+// Call our gcd() function
+x = 42;
+y = 105;
+g = gcd(x, y);
+printf("The gcd of %d and %d is %d\n", x, y, g);
+
+// Call our fact() function
+x = 5;
+g = fact(x);
+printf("The fact of %d is %d\n", x, g);
+
+// Manipulate the Foo global variable
+
+// Output its current value
+printf("Foo = %f\n", Foo_get());
+
+// Change its value
+Foo_set(3.1415926);
+
+// See if the change took effect
+printf("Foo = %f\n", Foo_get());
+
+// Check error messages when violating contract
+ierr = execstr('gcd(-42, 105)', 'errcatch');
+if ierr <> 20003 then
+ error("gcd(-42, 105) must provoke a RunTimeError")
+end
+
+ierr = execstr('fact(-4)', 'errcatch');
+if ierr <> 20003 then
+ error("fact(-4) must provoke a RunTimeError")
+end
+
+exit
+
+
+
diff --git a/Examples/scilab/enum/Makefile b/Examples/scilab/enum/Makefile
new file mode 100644
index 00000000000..40c97a5f7be
--- /dev/null
+++ b/Examples/scilab/enum/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+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_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/enum/example.cxx b/Examples/scilab/enum/example.cxx
new file mode 100644
index 00000000000..6785e57acd4
--- /dev/null
+++ b/Examples/scilab/enum/example.cxx
@@ -0,0 +1,37 @@
+/* File : example.c */
+
+#include "example.h"
+#include
+
+void Foo::enum_test(speed s) {
+ if (s == IMPULSE) {
+ printf("IMPULSE speed\n");
+ } else if (s == WARP) {
+ printf("WARP speed\n");
+ } else if (s == LUDICROUS) {
+ printf("LUDICROUS speed\n");
+ } else {
+ printf("Unknown speed\n");
+ }
+}
+
+void enum_test(color c, Foo::speed s) {
+ if (c == RED) {
+ printf("color = RED, ");
+ } else if (c == BLUE) {
+ printf("color = BLUE, ");
+ } else if (c == GREEN) {
+ printf("color = GREEN, ");
+ } else {
+ printf("color = Unknown color!, ");
+ }
+ if (s == Foo::IMPULSE) {
+ printf("speed = IMPULSE speed\n");
+ } else if (s == Foo::WARP) {
+ printf("speed = WARP speed\n");
+ } else if (s == Foo::LUDICROUS) {
+ printf("speed = LUDICROUS speed\n");
+ } else {
+ printf("speed = Unknown speed!\n");
+ }
+}
diff --git a/Examples/scilab/enum/example.h b/Examples/scilab/enum/example.h
new file mode 100644
index 00000000000..525d62afc57
--- /dev/null
+++ b/Examples/scilab/enum/example.h
@@ -0,0 +1,13 @@
+/* File : example.h */
+
+enum color { RED, BLUE, GREEN };
+
+class Foo {
+ public:
+ Foo() { }
+ enum speed { IMPULSE, WARP, LUDICROUS };
+ void enum_test(speed s);
+};
+
+void enum_test(color c, Foo::speed s);
+
diff --git a/Examples/scilab/enum/example.i b/Examples/scilab/enum/example.i
new file mode 100644
index 00000000000..a9c71c5abc7
--- /dev/null
+++ b/Examples/scilab/enum/example.i
@@ -0,0 +1,10 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+%include "example.h"
+
+
diff --git a/Examples/scilab/enum/runme.sci b/Examples/scilab/enum/runme.sci
new file mode 100644
index 00000000000..0895fc340ac
--- /dev/null
+++ b/Examples/scilab/enum/runme.sci
@@ -0,0 +1,36 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+example_Init();
+
+printf("\nTest enums\n");
+printf("*** color ***\n");
+printf(" RED_get() = %i\n", RED_get());
+printf(" BLUE_get() = %i\n", BLUE_get());
+printf(" GREEN_get() = %i\n", GREEN_get());
+
+printf("\n*** Foo::speed ***\n")
+printf(" Foo_IMPULSE = %i\n", Foo_IMPULSE_get());
+printf(" Foo_WARP = %i\n", Foo_WARP_get());
+printf(" Foo_LUDICROUS = %i\n", Foo_LUDICROUS_get());
+
+printf("\nTest enums as argument of functions\n");
+
+enum_test(RED_get(), Foo_IMPULSE_get());
+enum_test(BLUE_get(), Foo_WARP_get());
+enum_test(GREEN_get(), Foo_LUDICROUS_get());
+enum_test(1234, 5678);
+
+printf("\nTest enums as argument of class methods\n");
+
+f = new_Foo();
+Foo_enum_test(f, Foo_IMPULSE_get());
+Foo_enum_test(f, Foo_WARP_get());
+Foo_enum_test(f, Foo_LUDICROUS_get());
+delete_Foo(f);
+
+exit
diff --git a/Examples/scilab/funcptr/Makefile b/Examples/scilab/funcptr/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/funcptr/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/funcptr/example.c b/Examples/scilab/funcptr/example.c
new file mode 100644
index 00000000000..5c4a3dabfe1
--- /dev/null
+++ b/Examples/scilab/funcptr/example.c
@@ -0,0 +1,19 @@
+/* File : example.c */
+
+int do_op(int a, int b, int (*op)(int,int)) {
+ return (*op)(a,b);
+}
+
+int add(int a, int b) {
+ return a+b;
+}
+
+int sub(int a, int b) {
+ return a-b;
+}
+
+int mul(int a, int b) {
+ return a*b;
+}
+
+int (*funcvar)(int,int) = add;
diff --git a/Examples/scilab/funcptr/example.h b/Examples/scilab/funcptr/example.h
new file mode 100644
index 00000000000..9936e24fc9f
--- /dev/null
+++ b/Examples/scilab/funcptr/example.h
@@ -0,0 +1,9 @@
+/* file: example.h */
+
+extern int do_op(int,int, int (*op)(int,int));
+extern int add(int,int);
+extern int sub(int,int);
+extern int mul(int,int);
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/scilab/funcptr/example.i b/Examples/scilab/funcptr/example.i
new file mode 100644
index 00000000000..e8af50e6ff4
--- /dev/null
+++ b/Examples/scilab/funcptr/example.i
@@ -0,0 +1,11 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+/* Wrap a function taking a pointer to a function */
+extern int do_op(int a, int b, int (*op)(int, int));
+
+extern int (*funcvar)(int,int);
+
diff --git a/Examples/scilab/funcptr/runme.sci b/Examples/scilab/funcptr/runme.sci
new file mode 100644
index 00000000000..d3cbed394e9
--- /dev/null
+++ b/Examples/scilab/funcptr/runme.sci
@@ -0,0 +1,22 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+a = 37
+b = 42
+
+// Now call our C function with a bunch of callbacks
+
+printf("Trying some C callback functions\n");
+printf(" a = %i\n", a);
+printf(" b = %i\n", b);
+printf(" ADD(a,b) = %i\n", do_op(a,b,funcvar_get()));
+
+exit
+
+
+
diff --git a/Examples/scilab/matrix/Makefile b/Examples/scilab/matrix/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/matrix/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/matrix/example.c b/Examples/scilab/matrix/example.c
new file mode 100644
index 00000000000..6ce10098b59
--- /dev/null
+++ b/Examples/scilab/matrix/example.c
@@ -0,0 +1,61 @@
+/* FILE : matrix.c : some simple 4x4 matrix operations */
+#include
+#include
+
+double **new_matrix() {
+
+ int i;
+ double **M;
+
+ M = (double **) malloc(4*sizeof(double *));
+ M[0] = (double *) malloc(16*sizeof(double));
+
+ for (i = 0; i < 4; i++) {
+ M[i] = M[0] + 4*i;
+ }
+ return M;
+}
+
+void destroy_matrix(double **M) {
+
+ free(M[0]);
+ free(M);
+
+}
+
+void print_matrix(double **M) {
+
+ int i,j;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ printf("%10g ", M[i][j]);
+ }
+ printf("\n");
+ }
+
+}
+
+void mat_mult(double **m1, double **m2, double **m3) {
+
+ int i,j,k;
+ double temp[4][4];
+
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++) {
+ temp[i][j] = 0;
+ for (k = 0; k < 4; k++)
+ temp[i][j] += m1[i][k]*m2[k][j];
+ }
+
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++)
+ m3[i][j] = temp[i][j];
+}
+
+
+
+
+
+
+
diff --git a/Examples/scilab/matrix/example.i b/Examples/scilab/matrix/example.i
new file mode 100644
index 00000000000..c930e92f5d2
--- /dev/null
+++ b/Examples/scilab/matrix/example.i
@@ -0,0 +1,36 @@
+%module example
+// FILE : matrix.i
+
+%{
+
+void set_m(double **M, int i, int j, double val) {
+ M[i][j] = val;
+}
+
+double get_m(double **M, int i, int j) {
+ return M[i][j];
+}
+%}
+
+%inline {
+/*** Matrix Operations ***/
+
+extern double **new_matrix();
+/* Creates a new matrix and returns a pointer to it */
+
+extern void destroy_matrix(double **M);
+/* Destroys the matrix M */
+
+extern void print_matrix(double **M);
+/* Prints out the matrix M */
+
+extern void set_m(double **M, int i, int j, double val);
+/* Sets M[i][j] = val*/
+
+extern double get_m(double **M, int i, int j);
+/* Returns M[i][j] */
+
+extern void mat_mult(double **a, double **b, double **c);
+/* Multiplies matrix a by b and places the result in c*/
+
+}
diff --git a/Examples/scilab/matrix/runme.sci b/Examples/scilab/matrix/runme.sci
new file mode 100644
index 00000000000..26943b1841d
--- /dev/null
+++ b/Examples/scilab/matrix/runme.sci
@@ -0,0 +1,43 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// create a new matrix
+x = new_matrix();
+for i = 0 : 3;
+ for j = 0 : 3;
+ set_m(x, i, j, i+j);
+ end;
+end;
+
+// print the matrix
+print_matrix(x);
+
+// another matrix
+y = new_matrix();
+ for i = 0 : 3;
+ for j = 0 : 3;
+ set_m(y, i, j, i-j);
+ end;
+ end;
+
+// print the matrix
+print_matrix(y);
+
+// mat_mult the two matrix, and the result is stored in a new matrix
+z = new_matrix();
+
+mat_mult(x, y, z);
+
+print_matrix(z);
+
+//destroy the matrix
+destroy_matrix(x);
+destroy_matrix(y);
+destroy_matrix(z);
+
+exit
diff --git a/Examples/scilab/matrix2/Makefile b/Examples/scilab/matrix2/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/matrix2/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/matrix2/example.c b/Examples/scilab/matrix2/example.c
new file mode 100644
index 00000000000..476067df916
--- /dev/null
+++ b/Examples/scilab/matrix2/example.c
@@ -0,0 +1,118 @@
+#include
+#include
+#include
+
+
+// Double matrix functions
+
+double sumDoubleMatrix(double *inputMatrix, int nbRow, int nbCol)
+{
+ int i;
+ double total = 0.0;
+ for (i=0; i myMatrix=[ 103 3 1 12;0 0 2043 1];
+ * --> sumitems(myMatrix);
+ * 32
+ */
+ double B[] = {1,3,4,9,2,8,3,2}; /* Declare the matrix */
+ int rowB = 2, colB = 4;
+ printf("sumitems: %6.2f\n",sumitems(B, rowB, colB));
+
+
+/**
+ * --> myOtherMatrix=generateValues();
+ * --> size(myOtherMatrix);
+ */
+ int numberRow, numberCol, i;
+ double * matrix=getValues(&numberRow, &numberCol);
+ printf("Matrix of size [%d,%d]",numberRow, numberCol);
+ for(i=0; i < numberRow*numberCol; i++)
+ {
+ printf("A[%d] = %5.2f\n",i,matrix[i]);
+ }
+}
diff --git a/Examples/scilab/matrix2/runme.sci b/Examples/scilab/matrix2/runme.sci
new file mode 100644
index 00000000000..0af7df4e7c8
--- /dev/null
+++ b/Examples/scilab/matrix2/runme.sci
@@ -0,0 +1,51 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// Test lib double matrix functions
+disp("Call lib function getDoubleMatrix()");
+doubleMatrix = getDoubleMatrix();
+disp(doubleMatrix);
+
+disp("Call lib function sumDoubleMatrix()");
+s = sumDoubleMatrix(doubleMatrix);
+disp(s);
+
+disp("Call lib function squareDoubleMatrix()");
+sqrd = squareDoubleMatrix(doubleMatrix);
+disp(sqrd);
+
+
+// Test lib integer matrix functions
+
+disp("Call lib function getIntegerMatrix()");
+integerMatrix = getIntegerMatrix();
+disp(integerMatrix);
+
+disp("Call lib function sumIntegerMatrix()");
+s = sumIntegerMatrix(integerMatrix);
+disp(s);
+
+disp("Call lib function squareIntegerMatrix()");
+sqri = squareIntegerMatrix(integerMatrix);
+disp(sqri);
+
+
+// Test lib string matrix functions
+
+disp("Call lib function getStringVector()");
+stringVector = getStringVector();
+disp(stringVector);
+
+disp("Call lib function concatStringVector()");
+stringVector2 = concatStringVector(stringVector);
+disp(stringVector2);
+
+exit
+
+
+
diff --git a/Examples/scilab/pointer/Makefile b/Examples/scilab/pointer/Makefile
new file mode 100644
index 00000000000..9ce2685bfc3
--- /dev/null
+++ b/Examples/scilab/pointer/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/pointer/example.c b/Examples/scilab/pointer/example.c
new file mode 100644
index 00000000000..b877d9a5bfc
--- /dev/null
+++ b/Examples/scilab/pointer/example.c
@@ -0,0 +1,16 @@
+/* File : example.c */
+
+void add(int *x, int *y, int *result) {
+ *result = *x + *y;
+}
+
+void sub(int *x, int *y, int *result) {
+ *result = *x - *y;
+}
+
+int divide(int n, int d, int *r) {
+ int q;
+ q = n/d;
+ *r = n - q*d;
+ return q;
+}
diff --git a/Examples/scilab/pointer/example.i b/Examples/scilab/pointer/example.i
new file mode 100644
index 00000000000..a8ac79499f8
--- /dev/null
+++ b/Examples/scilab/pointer/example.i
@@ -0,0 +1,30 @@
+/* File : example.i */
+%module example
+
+%{
+extern void add(int *, int *, int *);
+extern void sub(int *, int *, int *);
+extern int divide(int, int, int *);
+%}
+
+/* This example illustrates a couple of different techniques
+ for manipulating C pointers */
+
+/* First we'll use the pointer library */
+extern void add(int *x, int *y, int *result);
+%include cpointer.i
+%pointer_functions(int, intp);
+
+/* Next we'll use some typemaps */
+
+%include typemaps.i
+extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
+
+/* Next we'll use typemaps and the %apply directive */
+
+%apply int *OUTPUT { int *r };
+extern int divide(int n, int d, int *r);
+
+
+
+
diff --git a/Examples/scilab/pointer/runme.sci b/Examples/scilab/pointer/runme.sci
new file mode 100644
index 00000000000..3400ab3e5d8
--- /dev/null
+++ b/Examples/scilab/pointer/runme.sci
@@ -0,0 +1,47 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// First create some objects using the pointer library.
+printf("Testing the pointer library\n")
+a = new_intp();
+b = new_intp();
+c = new_intp(); // Memory for result
+
+intp_assign(a, 37);
+intp_assign(b, 42);
+
+printf(" a = %d\n", intp_value(a));
+printf(" b = %d\n", intp_value(b));
+printf(" c = %d\n", intp_value(c));
+
+// Call the add() function with some pointers
+add(a, b, c);
+
+// Now get the result
+r = intp_value(c);
+printf(" 37 + 42 = %d\n", r);
+
+// Clean up the pointers
+delete_intp(a);
+delete_intp(b);
+delete_intp(c);
+
+// Now try the typemap library
+// This should be much easier. Now how it is no longer
+// necessary to manufacture pointers.
+printf("Trying the typemap library\n");
+r = sub(37, 42);
+printf(" 37 - 42 = %d\n", r);
+
+// Now try the version with multiple return values
+printf("Testing multiple return values\n");
+[q, r] = divide(42, 37);
+printf(" 42/37 = %d remainder %d\n", q, r);
+
+exit
+
diff --git a/Examples/scilab/simple/Makefile b/Examples/scilab/simple/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/simple/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/simple/example.c b/Examples/scilab/simple/example.c
new file mode 100644
index 00000000000..1c2af789ce3
--- /dev/null
+++ b/Examples/scilab/simple/example.c
@@ -0,0 +1,18 @@
+/* File : example.c */
+
+/* A global variable */
+double Foo = 3.0;
+
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+ int g;
+ g = y;
+ while (x > 0) {
+ g = x;
+ x = y % x;
+ y = g;
+ }
+ return g;
+}
+
+
diff --git a/Examples/scilab/simple/example.i b/Examples/scilab/simple/example.i
new file mode 100644
index 00000000000..24093b9bf0a
--- /dev/null
+++ b/Examples/scilab/simple/example.i
@@ -0,0 +1,7 @@
+/* File : example.i */
+%module example
+
+%inline %{
+extern int gcd(int x, int y);
+extern double Foo;
+%}
diff --git a/Examples/scilab/simple/runme.sci b/Examples/scilab/simple/runme.sci
new file mode 100644
index 00000000000..ed8b0f6c37a
--- /dev/null
+++ b/Examples/scilab/simple/runme.sci
@@ -0,0 +1,29 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// Call our gcd() function
+
+x = 42;
+y = 105;
+g = gcd(x,y);
+printf("The gcd of %d and %d is %d\n",x,y,g);
+
+// Manipulate the Foo global variable
+
+// Get its default value (see in example.c)
+defaultValue = Foo_get()
+if defaultValue <> 3 then pause; end
+
+// Change its value
+Foo_set(3.1415926)
+
+// See if the change took effect
+if Foo_get() <> 3.1415926 then pause,end
+
+exit
+
diff --git a/Examples/scilab/std_list/Makefile b/Examples/scilab/std_list/Makefile
new file mode 100644
index 00000000000..40c97a5f7be
--- /dev/null
+++ b/Examples/scilab/std_list/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+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_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/std_list/example.cxx b/Examples/scilab/std_list/example.cxx
new file mode 100644
index 00000000000..e58d6a38bad
--- /dev/null
+++ b/Examples/scilab/std_list/example.cxx
@@ -0,0 +1,61 @@
+/* File : example.cpp */
+
+#include "example.h"
+
+#include
+#include
+#include
+#include
+#include
+
+
+template
+std::list concat_list(const std::list list, const std::list other_list)
+{
+ std::list out_list(list);
+ out_list.insert(out_list.end(), other_list.begin(), other_list.end());
+ return out_list;
+}
+
+// int lists
+
+std::list create_integer_list(const int rangemin, const int rangemax)
+{
+ std::list out_list;
+ for (int i = rangemin; i <= rangemax; i++)
+ {
+ out_list.push_back(i);
+ }
+ return out_list;
+}
+
+int sum_integer_list(const std::list& list)
+{
+ return std::accumulate(list.begin(), list.end(), 0);
+}
+
+std::list concat_integer_list(const std::list list, const std::list other_list)
+{
+ return concat_list(list, other_list);
+}
+
+// string lists
+
+std::list create_string_list(const char* svalue)
+{
+ std::list out_list;
+ std::string str(svalue);
+
+ std::istringstream iss(str);
+ std::copy(std::istream_iterator(iss),
+ std::istream_iterator(),
+ std::inserter >(out_list, out_list.begin()));
+
+ return out_list;
+}
+
+std::list concat_string_list(const std::list list, const std::list other_list)
+{
+ return concat_list(list, other_list);
+}
+
diff --git a/Examples/scilab/std_list/example.h b/Examples/scilab/std_list/example.h
new file mode 100644
index 00000000000..769627e080b
--- /dev/null
+++ b/Examples/scilab/std_list/example.h
@@ -0,0 +1,14 @@
+/* File : example.h */
+
+#include
+#include
+
+
+// integer lists
+std::list create_integer_list(const int size, const int value);
+int sum_integer_list(const std::list& list);
+std::list concat_integer_list(const std::list list, const std::list other_list);
+
+// string lists
+std::list create_string_list(const char* value);
+std::list concat_string_list(const std::list list, const std::list other_list);
diff --git a/Examples/scilab/std_list/example.i b/Examples/scilab/std_list/example.i
new file mode 100644
index 00000000000..dbe2a73e46e
--- /dev/null
+++ b/Examples/scilab/std_list/example.i
@@ -0,0 +1,19 @@
+/* File : example.i */
+
+%module example
+
+%{
+#include "example.h"
+%}
+
+%include stl.i
+%include std_list.i
+
+/* instantiate the required template specializations */
+namespace std
+{
+ %template(IntList) list;
+ %template(StringList) list;
+}
+
+%include "example.h"
diff --git a/Examples/scilab/std_list/runme.sci b/Examples/scilab/std_list/runme.sci
new file mode 100644
index 00000000000..e4c04b029f5
--- /dev/null
+++ b/Examples/scilab/std_list/runme.sci
@@ -0,0 +1,39 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+example_Init();
+
+// This example shows how to use C++ fonctions with STL lists arguments
+// Here, STL lists are converted from/to Scilab matrices (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS is not defined)
+
+// integer lists
+
+disp("Example of passing matrices of int as list arguments of C++ functions.");
+disp("get a list of int {1...4} from create_integer_list():");
+is = create_integer_list(1, 4);
+disp(is);
+disp("get the sum of this list elements with sum_integer_list():")
+sum = sum_integer_list(is);
+disp(is);
+is2 = create_integer_list(3, 6);
+disp("concat this list with the list of int {3...6} with concat_integer_list():");
+is3 = concat_integer_list(is, is2);
+disp(is3);
+
+// string lists
+
+disp("Example of passing matrices of string as list arguments of C++ functions.");
+disp("get a list of string {''aa'', ''bb'', ''cc'', ''dd''} with create_string_list():");
+ss = create_string_list("aa bb cc dd");
+disp(ss);
+ss2 = create_string_list("cc dd ee ff");
+disp("concat this list with the list of string {''cc'', ''dd'', ''ee'', ''ff''} with concat_string_list():");
+ss3 = concat_string_list(ss, ss2);
+disp(ss3);
+
+exit
+
diff --git a/Examples/scilab/std_vector/Makefile b/Examples/scilab/std_vector/Makefile
new file mode 100644
index 00000000000..490ac73b568
--- /dev/null
+++ b/Examples/scilab/std_vector/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+CXXSRCS =
+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_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/std_vector/example.h b/Examples/scilab/std_vector/example.h
new file mode 100644
index 00000000000..4f0dac70d8c
--- /dev/null
+++ b/Examples/scilab/std_vector/example.h
@@ -0,0 +1,25 @@
+/* File : example.h */
+
+#include
+#include
+#include
+#include
+
+double average(std::vector v) {
+ return std::accumulate(v.begin(),v.end(),0.0)/v.size();
+}
+
+std::vector half(const std::vector& v) {
+ std::vector w(v);
+ for (unsigned int i=0; i& v) {
+ // would you believe this is the same as the above?
+ std::transform(v.begin(),v.end(),v.begin(),
+ std::bind2nd(std::divides(),2.0));
+}
+
+
diff --git a/Examples/scilab/std_vector/example.i b/Examples/scilab/std_vector/example.i
new file mode 100644
index 00000000000..1ba9e927e33
--- /dev/null
+++ b/Examples/scilab/std_vector/example.i
@@ -0,0 +1,19 @@
+/* File : example.i */
+%module example
+
+%warnfilter(SWIGWARN_SCILAB_TRUNCATED_NAME) std::vector::get_allocator;
+
+%{
+#include "example.h"
+%}
+
+%include stl.i
+/* instantiate the required template specializations */
+namespace std {
+ %template(IntVector) vector;
+ %template(DoubleVector) vector;
+}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
diff --git a/Examples/scilab/std_vector/runme.sci b/Examples/scilab/std_vector/runme.sci
new file mode 100644
index 00000000000..3e569454c6a
--- /dev/null
+++ b/Examples/scilab/std_vector/runme.sci
@@ -0,0 +1,37 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+example_Init();
+
+
+disp(mean([1,2,3,4]));
+
+// ... or a wrapped std::vector
+
+v = new_IntVector();
+for i = 1:4
+ IntVector_push_back(v, i);
+end;
+disp(average(v));
+
+
+// half will return a Scilab matrix.
+// Call it with a Scilab matrix...
+
+disp(half([1.0, 1.5, 2.0, 2.5, 3.0]));
+
+
+// ... or a wrapped std::vector
+
+v = new_DoubleVector();
+for i = 1:4
+ DoubleVector_push_back(v, i);
+end;
+disp(half(v));
+
+exit
+
diff --git a/Examples/scilab/struct/Makefile b/Examples/scilab/struct/Makefile
new file mode 100644
index 00000000000..9f8b7e89176
--- /dev/null
+++ b/Examples/scilab/struct/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS =
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/struct/example.i b/Examples/scilab/struct/example.i
new file mode 100644
index 00000000000..af2cd3f4a9b
--- /dev/null
+++ b/Examples/scilab/struct/example.i
@@ -0,0 +1,11 @@
+%module example
+
+%rename(Bar) Foo;
+
+%inline %{
+typedef struct {
+ int x;
+} Foo;
+
+%}
+
diff --git a/Examples/scilab/struct/runme.sci b/Examples/scilab/struct/runme.sci
new file mode 100644
index 00000000000..4d47ef0dcc8
--- /dev/null
+++ b/Examples/scilab/struct/runme.sci
@@ -0,0 +1,18 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// Test use of a struct (Bar)
+
+a = new_Bar();
+
+Bar_x_set(a, 100);
+printf("a.x = %d (Should be 100)\n", Bar_x_get(a));
+
+delete_Bar(a);
+
+exit
diff --git a/Examples/scilab/template/Makefile b/Examples/scilab/template/Makefile
new file mode 100644
index 00000000000..490ac73b568
--- /dev/null
+++ b/Examples/scilab/template/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+CXXSRCS =
+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_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab_cpp
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/template/example.h b/Examples/scilab/template/example.h
new file mode 100644
index 00000000000..7401df650a0
--- /dev/null
+++ b/Examples/scilab/template/example.h
@@ -0,0 +1,32 @@
+/* File : example.h */
+
+// Some template definitions
+
+template T max(T a, T b) { return a>b ? a : b; }
+
+template class vector {
+ T *v;
+ int sz;
+ public:
+ vector(int _sz) {
+ v = new T[_sz];
+ sz = _sz;
+ }
+ T &get(int index) {
+ return v[index];
+ }
+ void set(int index, T &val) {
+ v[index] = val;
+ }
+#ifdef SWIG
+ %extend {
+ T getitem(int index) {
+ return $self->get(index);
+ }
+ void setitem(int index, T val) {
+ $self->set(index,val);
+ }
+ }
+#endif
+};
+
diff --git a/Examples/scilab/template/example.i b/Examples/scilab/template/example.i
new file mode 100644
index 00000000000..8f94c4da132
--- /dev/null
+++ b/Examples/scilab/template/example.i
@@ -0,0 +1,17 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
+/* Now instantiate some specific template declarations */
+
+%template(maxint) max;
+%template(maxdouble) max;
+%template(vecint) vector;
+%template(vecdouble) vector;
+
diff --git a/Examples/scilab/template/runme.sci b/Examples/scilab/template/runme.sci
new file mode 100644
index 00000000000..35ca9d1c2f9
--- /dev/null
+++ b/Examples/scilab/template/runme.sci
@@ -0,0 +1,45 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+example_Init();
+
+// Call some templated functions
+printf("maxint(3, 7) = %i\n", maxint(3, 7));
+printf("maxdouble(3.14, 2.18) = %3.2f\n", maxdouble(3.14, 2.18));
+
+// Create some class
+
+iv = new_vecint(100);
+dv = new_vecdouble(1000);
+
+for i = 0:100
+ vecint_setitem(iv, i, 2*i);
+end
+
+for i = 0:100
+ vecdouble_setitem(dv, i, 1.0/(i+1));
+end
+
+isum = 0
+for i = 0:100
+ isum = isum + vecint_getitem(iv, i);
+end
+
+printf("isum = %i\n", isum);
+
+dsum = 0
+for i = 0:100
+ dsum = dsum + vecdouble_getitem(dv, i);
+end
+
+printf("dsum = %3.2f\n", dsum);
+
+delete_vecint(iv);
+delete_vecdouble(dv);
+
+exit
+
diff --git a/Examples/scilab/variables/Makefile b/Examples/scilab/variables/Makefile
new file mode 100644
index 00000000000..6604d191bea
--- /dev/null
+++ b/Examples/scilab/variables/Makefile
@@ -0,0 +1,17 @@
+TOP = ../..
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
+SRCS = example.c
+TARGET = example
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_run
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' scilab
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' scilab_clean
diff --git a/Examples/scilab/variables/example.c b/Examples/scilab/variables/example.c
new file mode 100644
index 00000000000..9f88d90a41a
--- /dev/null
+++ b/Examples/scilab/variables/example.c
@@ -0,0 +1,95 @@
+/* File : example.c */
+
+/* I'm a file containing some C global variables */
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#include
+#include
+#include "example.h"
+
+int ivar = 0;
+short svar = 0;
+long lvar = 0;
+unsigned int uivar = 0;
+unsigned short usvar = 0;
+unsigned long ulvar = 0;
+signed char scvar = 0;
+unsigned char ucvar = 0;
+char cvar = 0;
+float fvar = 0;
+double dvar = 0;
+char *strvar = 0;
+const char cstrvar[] = "Goodbye";
+int *iptrvar = 0;
+char name[256] = "Dave";
+char path[256] = "/home/beazley";
+
+
+/* Global variables involving a structure */
+Point *ptptr = 0;
+Point pt = { 10, 20 };
+
+/* A variable that we will make read-only in the interface */
+int status = 1;
+
+/* A debugging function to print out their values */
+
+void print_vars() {
+ printf("ivar = %d\n", ivar);
+ printf("svar = %d\n", svar);
+ printf("lvar = %ld\n", lvar);
+ printf("uivar = %u\n", uivar);
+ printf("usvar = %u\n", usvar);
+ printf("ulvar = %lu\n", ulvar);
+ printf("scvar = %d\n", scvar);
+ printf("ucvar = %u\n", ucvar);
+ printf("fvar = %g\n", fvar);
+ printf("dvar = %g\n", dvar);
+ printf("cvar = %c\n", cvar);
+ printf("strvar = %s\n", strvar ? strvar : "(null)");
+ printf("cstrvar = %s\n", cstrvar);
+ printf("iptrvar = %p\n", (void *)iptrvar);
+ printf("name = %s\n", name);
+ printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
+ printf("pt = (%d, %d)\n", pt.x, pt.y);
+ printf("status = %d\n", status);
+}
+
+/* A function to create an integer (to test iptrvar) */
+
+int *new_int(int value) {
+ int *ip = (int *) malloc(sizeof(int));
+ *ip = value;
+ return ip;
+}
+
+int value_int(int *value) {
+ return *value;
+}
+
+/* A function to create a point */
+
+Point *new_Point(int x, int y) {
+ Point *p = (Point *) malloc(sizeof(Point));
+ p->x = x;
+ p->y = y;
+ return p;
+}
+
+char * Point_print(Point *p) {
+ static char buffer[256];
+ if (p) {
+ sprintf(buffer,"(%d,%d)", p->x,p->y);
+ } else {
+ sprintf(buffer,"null");
+ }
+ return buffer;
+}
+
+void pt_print() {
+ printf("(%d, %d)\n", pt.x, pt.y);
+}
diff --git a/Examples/scilab/variables/example.h b/Examples/scilab/variables/example.h
new file mode 100644
index 00000000000..0f7e8959487
--- /dev/null
+++ b/Examples/scilab/variables/example.h
@@ -0,0 +1,6 @@
+/* File: example.h */
+
+typedef struct {
+ int x,y;
+} Point;
+
diff --git a/Examples/scilab/variables/example.i b/Examples/scilab/variables/example.i
new file mode 100644
index 00000000000..97ba1f0e696
--- /dev/null
+++ b/Examples/scilab/variables/example.i
@@ -0,0 +1,52 @@
+/* File : example.i */
+%module example
+%{
+#include "example.h"
+%}
+
+#pragma SWIG nowarn=SWIGWARN_TYPEMAP_SWIGTYPELEAK
+
+/* Some global variable declarations */
+%inline %{
+extern int ivar;
+extern short svar;
+extern long lvar;
+extern unsigned int uivar;
+extern unsigned short usvar;
+extern unsigned long ulvar;
+extern signed char scvar;
+extern unsigned char ucvar;
+extern char cvar;
+extern float fvar;
+extern double dvar;
+extern char *strvar;
+extern const char cstrvar[];
+extern int *iptrvar;
+extern char name[256];
+
+extern Point *ptptr;
+extern Point pt;
+%}
+
+
+/* Some read-only variables */
+
+%immutable;
+
+%inline %{
+extern int status;
+extern char path[256];
+%}
+
+%mutable;
+
+/* Some helper functions to make it easier to test */
+%inline %{
+extern void print_vars();
+extern int *new_int(int value);
+extern int value_int(int *value);
+extern Point *new_Point(int x, int y);
+extern char *Point_print(Point *p);
+extern void pt_print();
+%}
+
diff --git a/Examples/scilab/variables/runme.sci b/Examples/scilab/variables/runme.sci
new file mode 100644
index 00000000000..98d76cfa008
--- /dev/null
+++ b/Examples/scilab/variables/runme.sci
@@ -0,0 +1,73 @@
+lines(0);
+ilib_verbose(0);
+ierr = exec('loader.sce', 'errcatch');
+if ierr <> 0 then
+ disp(lasterror());
+ exit(ierr);
+end
+
+// Try to set the values of some global variables
+ivar_set(42);
+svar_set(-31000);
+lvar_set(65537);
+uivar_set(uint32(123456));
+usvar_set(uint16(61000));
+ulvar_set(654321);
+scvar_set(int8(-13));
+ucvar_set(uint8(251));
+cvar_set("S");
+fvar_set(3.14159);
+dvar_set(2.1828);
+strvar_set("Hello World");
+iptrvar_set(new_int(37));
+ptptr_set(new_Point(37,42));
+name_set("Bill");
+
+// Now print out the values of the variables
+printf("Variables (values printed from Scilab)\n");
+printf("ivar = %i\n", ivar_get());
+printf("svar = %i\n", svar_get());
+printf("lvar = %i\n", lvar_get());
+printf("uivar = %i\n", uivar_get());
+printf("usvar = %i\n", usvar_get());
+printf("ulvar = %i\n", ulvar_get());
+printf("scvar = %i\n", scvar_get());
+printf("ucvar = %i\n", ucvar_get());
+printf("fvar = %f\n", fvar_get());
+printf("dvar = %f\n", dvar_get());
+printf("cvar = %s\n", cvar_get());
+printf("strvar = %s\n", strvar_get());
+printf("cstrvar = %s\n", cstrvar_get());
+printf("iptrvar = %i\n", value_int(iptrvar_get()));
+printf("name = %s\n", name_get());
+printf("ptptr = %s\n", Point_print(ptptr_get()));
+printf("pt = %s\n", Point_print(pt_get()));
+printf("status = %d\n", status_get());
+
+printf("\nVariables (values printed from C)\n");
+print_vars()
+
+// Immutable variables
+printf("\nNow I''m going to try and modify some read only variables\n");
+printf(" Tring to set ''path''\n");
+try
+ path_set("Whoa!");
+ printf("Hey, what''s going on?!?! This shouldn''t work\n");
+catch
+ printf("Good.\n");
+end
+printf(" Trying to set ''status''\n");
+try
+ status_set(0);
+ printf("Hey, what''s going on?!?! This shouldn''t work\n");
+catch
+ printf("Good.\n");
+end
+
+// Structure
+printf("\nI''m going to try and update a structure variable.\n");
+pt_set(ptptr_get());
+printf("The new value is %s\n", Point_print(pt_get()));
+
+exit
+
diff --git a/Examples/tcl/class/Makefile b/Examples/tcl/class/Makefile
index aacf30e04a7..3fd77cff595 100644
--- a/Examples/tcl/class/Makefile
+++ b/Examples/tcl/class/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static
clean:
diff --git a/Examples/tcl/constants/Makefile b/Examples/tcl/constants/Makefile
index 17c8afa3f25..67f6567a8aa 100644
--- a/Examples/tcl/constants/Makefile
+++ b/Examples/tcl/constants/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS =
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/contract/Makefile b/Examples/tcl/contract/Makefile
index 01fdc37b3f4..bab90552bee 100644
--- a/Examples/tcl/contract/Makefile
+++ b/Examples/tcl/contract/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -10,12 +11,14 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean
diff --git a/Examples/tcl/enum/Makefile b/Examples/tcl/enum/Makefile
index aacf30e04a7..3fd77cff595 100644
--- a/Examples/tcl/enum/Makefile
+++ b/Examples/tcl/enum/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static
clean:
diff --git a/Examples/tcl/funcptr/Makefile b/Examples/tcl/funcptr/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/funcptr/Makefile
+++ b/Examples/tcl/funcptr/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/import/Makefile b/Examples/tcl/import/Makefile
index 6aa48e7a8ad..64ef0cdd1f8 100644
--- a/Examples/tcl/import/Makefile
+++ b/Examples/tcl/import/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SWIGOPT =
LIBS =
@@ -7,14 +8,18 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' tcl_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' tcl_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' tcl_cpp
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
- LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' tcl_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' tcl_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' tcl_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' tcl_cpp
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' tcl_cpp
clean:
diff --git a/Examples/tcl/java/Makefile b/Examples/tcl/java/Makefile
index 4be3764e247..e4dfc536bc7 100644
--- a/Examples/tcl/java/Makefile
+++ b/Examples/tcl/java/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,7 +10,8 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build: Example.class Example.h
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \
TCLCXXSHARED="gcj -fpic -shared Example.class " LIBS="-lstdc++" DEFS='' tcl_cpp
diff --git a/Examples/tcl/multimap/Makefile b/Examples/tcl/multimap/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/multimap/Makefile
+++ b/Examples/tcl/multimap/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/operator/Makefile b/Examples/tcl/operator/Makefile
index 1c6e1be9800..73dca485a62 100644
--- a/Examples/tcl/operator/Makefile
+++ b/Examples/tcl/operator/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static
clean:
diff --git a/Examples/tcl/pointer/Makefile b/Examples/tcl/pointer/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/pointer/Makefile
+++ b/Examples/tcl/pointer/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/reference/Makefile b/Examples/tcl/reference/Makefile
index aacf30e04a7..3fd77cff595 100644
--- a/Examples/tcl/reference/Makefile
+++ b/Examples/tcl/reference/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static
clean:
diff --git a/Examples/tcl/simple/Makefile b/Examples/tcl/simple/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/simple/Makefile
+++ b/Examples/tcl/simple/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/std_vector/Makefile b/Examples/tcl/std_vector/Makefile
index f29f933ba39..3ed97f27cb9 100644
--- a/Examples/tcl/std_vector/Makefile
+++ b/Examples/tcl/std_vector/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
CXXSRCS =
TARGET = my_tclsh
DLTARGET = example
@@ -10,11 +11,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh_cpp_static
clean:
diff --git a/Examples/tcl/value/Makefile b/Examples/tcl/value/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/value/Makefile
+++ b/Examples/tcl/value/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/tcl/variables/Makefile b/Examples/tcl/variables/Makefile
index 7155bf3c3a1..8765f7ef9d8 100644
--- a/Examples/tcl/variables/Makefile
+++ b/Examples/tcl/variables/Makefile
@@ -1,5 +1,6 @@
TOP = ../..
-SWIG = $(TOP)/../preinst-swig
+SWIGEXE = $(TOP)/../swig
+SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib
SRCS = example.c
TARGET = my_tclsh
DLTARGET = example
@@ -9,11 +10,13 @@ check: build
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run
build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl
static:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
clean:
diff --git a/Examples/test-suite/allegrocl/Makefile.in b/Examples/test-suite/allegrocl/Makefile.in
index 02ef8e3022c..b13d546daeb 100644
--- a/Examples/test-suite/allegrocl/Makefile.in
+++ b/Examples/test-suite/allegrocl/Makefile.in
@@ -35,7 +35,7 @@ CPP_TEST_BROKEN_ACL = \
dynamic_cast \
extend_variable \
# cdata.i support needed \
- li_cdata \
+ li_cdata_cpp \
# warning generated. otherwise all good. \
operator_overload \
# std_common.i support \
diff --git a/Examples/test-suite/allprotected.i b/Examples/test-suite/allprotected.i
index bd4dfe5c7a6..086cfb2456f 100644
--- a/Examples/test-suite/allprotected.i
+++ b/Examples/test-suite/allprotected.i
@@ -8,6 +8,11 @@
%include "std_string.i"
+#ifdef SWIGSCILAB
+%rename(ProcBase) ProtectedBase;
+%rename(PubBase) PublicBase;
+#endif
+
%feature("director") PublicBase;
%feature("director") ProtectedBase;
diff --git a/Examples/test-suite/apply_signed_char.i b/Examples/test-suite/apply_signed_char.i
index c0fa00cfe76..d3116f02488 100644
--- a/Examples/test-suite/apply_signed_char.i
+++ b/Examples/test-suite/apply_signed_char.i
@@ -4,6 +4,10 @@
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) DirectorTest;
+#if defined(SWIGSCILAB)
+%rename(DirTest) DirectorTest;
+#endif
+
%apply signed char {char, const char};
%apply const signed char & {const char &};
diff --git a/Examples/test-suite/apply_strings.i b/Examples/test-suite/apply_strings.i
index 54a91f83aed..62b578bf225 100644
--- a/Examples/test-suite/apply_strings.i
+++ b/Examples/test-suite/apply_strings.i
@@ -1,5 +1,5 @@
-/* Test %apply for char *, signed char *, unsigned char *
- This won't work in all situations, so does not necessarily have to be implemented. See
+/* Test %apply for char *, signed char *, unsigned char *
+ This won't work in all situations, so does not necessarily have to be implemented. See
http://groups.google.com.ai/group/comp.lang.c++.moderated/browse_thread/thread/ad5873ce25d49324/0ae94552452366be?lnk=raot */
%module(directors="1") apply_strings
@@ -7,6 +7,11 @@
%warnfilter(SWIGWARN_TYPEMAP_VARIN_UNDEF) DigitsGlobalB;
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK) DigitsGlobalC;
+#if defined(SWIGSCILAB)
+%rename(TNum) TNumber;
+%rename(DirTest) DirectorTest;
+#endif
+
%apply char * {UCharPtr};
%apply char * {SCharPtr};
%apply const char * {CUCharPtr};
@@ -53,12 +58,12 @@ typedef struct {
TAscii DigitsMemberA[20];
TAscii *DigitsMemberB;
} TNumber;
-
+
TAscii DigitsGlobalA[20];
TAscii DigitsGlobalB[] = {(unsigned char)'A', (unsigned char)'B', 0};
TAscii *DigitsGlobalC;
-%}
+%}
// Director test
%feature("director");
diff --git a/Examples/test-suite/array_member.i b/Examples/test-suite/array_member.i
index d8e2f873ccc..845eeb72cda 100644
--- a/Examples/test-suite/array_member.i
+++ b/Examples/test-suite/array_member.i
@@ -1,5 +1,9 @@
%module array_member
+#if defined(SWIGSCILAB)
+%rename(RayPkt) RayPacketData;
+#endif
+
%inline %{
typedef struct Foo {
diff --git a/Examples/test-suite/array_typedef_memberin.i b/Examples/test-suite/array_typedef_memberin.i
index ed49543a383..ad2855eed38 100644
--- a/Examples/test-suite/array_typedef_memberin.i
+++ b/Examples/test-suite/array_typedef_memberin.i
@@ -1,5 +1,14 @@
%module array_typedef_memberin
+
+#if defined(SWIGSCILAB)
+%rename(ExDetail) ExampleDetail;
+#endif
+
%inline %{
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4351) // new behavior: elements of array 'xyz' will be default initialized
+#endif
+
typedef short Eight[8];
typedef const short ConstEight[8];
namespace ArrayExample
@@ -8,13 +17,8 @@ namespace ArrayExample
{
public:
Eight node_list;
-#ifndef _MSC_VER
const Eight node_list2;
ConstEight node_list3;
-#else
- Eight node_list2;
- Eight node_list3;
-#endif
void fn1(Eight a) {}
void fn2(const Eight a) {}
@@ -27,6 +31,8 @@ namespace ArrayExample
void fn7(Eight*& a) {}
void fn8(ConstEight*& a) {}
void fn9(const ConstEight*& a) {}
+
+ ExampleDetail() : node_list(), node_list2(), node_list3() {}
};
}
diff --git a/Examples/test-suite/arrays.i b/Examples/test-suite/arrays.i
index decce74153f..07162aa9049 100644
--- a/Examples/test-suite/arrays.i
+++ b/Examples/test-suite/arrays.i
@@ -7,6 +7,10 @@ This test case tests that various types of arrays are working.
#include
%}
+#if defined(SWIGSCILAB)
+%rename(ArrSt) ArrayStruct;
+#endif
+
%inline %{
#define ARRAY_LEN 2
diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i
index d858997564e..a2d9f5b4e93 100644
--- a/Examples/test-suite/autodoc.i
+++ b/Examples/test-suite/autodoc.i
@@ -1,4 +1,4 @@
-%module(docstring="hello") autodoc
+%module(docstring="hello.") autodoc
%feature("autodoc");
@@ -27,7 +27,7 @@
%feature("autodoc","2") A::variable_c; // extended
%feature("autodoc","3") A::variable_d; // extended + types
-%feature("autodoc","just a string") A::funk; // names
+%feature("autodoc","just a string.") A::funk; // names
%inline {
diff --git a/Examples/test-suite/bloody_hell.i b/Examples/test-suite/bloody_hell.i
index e580f0dd439..ff296a24cd6 100644
--- a/Examples/test-suite/bloody_hell.i
+++ b/Examples/test-suite/bloody_hell.i
@@ -2,16 +2,20 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) kMaxIOCTLSpaceParmsSize;
-#define kMaxIOCTLSpaceParmsSize 128
+#ifdef SWIGSCILAB
+%rename(Parms) sm_channel_ix_dump_parms;
+#endif
+
+#define kMaxIOCTLSpaceParmsSize 128
%{
-#define kMaxIOCTLSpaceParmsSize 128
+#define kMaxIOCTLSpaceParmsSize 128
%}
%inline %{
-typedef struct sm_channel_ix_dump_parms {
- unsigned data[(kMaxIOCTLSpaceParmsSize - ((4*sizeof(int)) + (2*sizeof(unsigned))))/sizeof(unsigned)];
-} SM_CHANNEL_IX_DUMP_PARMS;
+typedef struct sm_channel_ix_dump_parms {
+ unsigned data[(kMaxIOCTLSpaceParmsSize - ((4*sizeof(int)) + (2*sizeof(unsigned))))/sizeof(unsigned)];
+} SM_CHANNEL_IX_DUMP_PARMS;
%}
diff --git a/Examples/test-suite/bools.i b/Examples/test-suite/bools.i
index 7b94fcf884d..2ef3d93a632 100644
--- a/Examples/test-suite/bools.i
+++ b/Examples/test-suite/bools.i
@@ -1,5 +1,10 @@
// bool typemaps check
%module bools
+
+#if defined(SWIGSCILAB)
+%rename(BoolSt) BoolStructure;
+#endif
+
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) constbool; /* Ruby, wrong class name */
diff --git a/Examples/test-suite/callback.i b/Examples/test-suite/callback.i
index c4d50d3fe42..4db63353ba1 100644
--- a/Examples/test-suite/callback.i
+++ b/Examples/test-suite/callback.i
@@ -1,10 +1,18 @@
%module callback
+// Not specifying the callback name is only possible in Python.
+#ifdef SWIGPYTHON
%callback(1) foo;
%callback(1) foof;
%callback(1) A::bar;
%callback(1) A::foom;
-%callback("%s_Cb_Ptr") foo_T; // old style, still works.
+#else
+%callback("%s") foo;
+%callback("%s") foof;
+%callback("%s") A::bar;
+%callback("%s") A::foom;
+#endif
+%callback("%(uppercase)s_Cb_Ptr") foo_T; // this works in Python too
%inline %{
@@ -57,6 +65,22 @@
return pf(a);
}
+#if defined(__SUNPRO_CC)
+// workaround for: Error: Could not find a match for foobar_T(int, extern "C" int(*)(int)).
+ extern "C" {
+ typedef int (*foobar_int_int)(int a);
+ typedef double (*foobar_double_double)(double a);
+ };
+ template
+ int foobar_T(int a, foobar_int_int pf) {
+ return pf(a);
+ }
+ template
+ double foobar_T(double a, foobar_double_double pf) {
+ return pf(a);
+ }
+#endif
+
template
const T& ident(const T& x) {
return x;
diff --git a/Examples/test-suite/cffi/Makefile.in b/Examples/test-suite/cffi/Makefile.in
index ee7e3f61e0d..6eebaa07c23 100644
--- a/Examples/test-suite/cffi/Makefile.in
+++ b/Examples/test-suite/cffi/Makefile.in
@@ -48,4 +48,4 @@ run_testcase = \
@exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" cffi_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' cffi_clean
diff --git a/Examples/test-suite/char_binary.i b/Examples/test-suite/char_binary.i
index 778792946b3..394565438c2 100644
--- a/Examples/test-suite/char_binary.i
+++ b/Examples/test-suite/char_binary.i
@@ -5,12 +5,16 @@ A test case for testing non null terminated char pointers.
%module char_binary
%apply (char *STRING, size_t LENGTH) { (const char *str, size_t len) }
+%apply (char *STRING, size_t LENGTH) { (const unsigned char *str, size_t len) }
%inline %{
struct Test {
size_t strlen(const char *str, size_t len) {
return len;
}
+ size_t ustrlen(const unsigned char *str, size_t len) {
+ return len;
+ }
};
typedef char namet[5];
diff --git a/Examples/test-suite/char_strings.i b/Examples/test-suite/char_strings.i
index cc59815b284..9a87df4e3d6 100644
--- a/Examples/test-suite/char_strings.i
+++ b/Examples/test-suite/char_strings.i
@@ -9,13 +9,9 @@ below.
%warnfilter(SWIGWARN_TYPEMAP_VARIN_UNDEF) global_char_array1; // Unable to set variable of type char[]
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) global_const_char; // Setting a const char * variable may leak memory.
-#ifdef SWIG_ALLEGRO_CL
%{
#include
-%}
-#endif
-%{
#define OTHERLAND_MSG "Little message from the safe world."
#define CPLUSPLUS_MSG "A message from the deep dark world of C++, where anything is possible."
static char *global_str = NULL;
diff --git a/Examples/test-suite/chartest.i b/Examples/test-suite/chartest.i
new file mode 100644
index 00000000000..e81cf54a461
--- /dev/null
+++ b/Examples/test-suite/chartest.i
@@ -0,0 +1,15 @@
+%module chartest
+
+%inline %{
+char printable_global_char = 'a';
+char unprintable_global_char = 0x7F;
+
+char GetPrintableChar() {
+ return 'a';
+}
+
+char GetUnprintableChar() {
+ return 0x7F;
+}
+
+%}
diff --git a/Examples/test-suite/chicken/Makefile.in b/Examples/test-suite/chicken/Makefile.in
index 31ab311bbcf..b3dccc9c3b8 100644
--- a/Examples/test-suite/chicken/Makefile.in
+++ b/Examples/test-suite/chicken/Makefile.in
@@ -97,5 +97,5 @@ run_testcase = \
@exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" chicken_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' chicken_clean
rm -f *.scm
diff --git a/Examples/test-suite/chicken/overload_extend_c_runme.ss b/Examples/test-suite/chicken/overload_extend_c_runme.ss
new file mode 100644
index 00000000000..75c0ea8a85c
--- /dev/null
+++ b/Examples/test-suite/chicken/overload_extend_c_runme.ss
@@ -0,0 +1,2 @@
+(load "overload_extend_c.so")
+(include "../schemerunme/overload_extend_c.scm")
diff --git a/Examples/test-suite/clisp/Makefile.in b/Examples/test-suite/clisp/Makefile.in
index 6837ed60b9f..3d207178fc3 100644
--- a/Examples/test-suite/clisp/Makefile.in
+++ b/Examples/test-suite/clisp/Makefile.in
@@ -48,4 +48,4 @@ run_testcase = \
@exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" clisp_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' clisp_clean
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk
index 742db540b65..9f948c2ca4c 100644
--- a/Examples/test-suite/common.mk
+++ b/Examples/test-suite/common.mk
@@ -33,9 +33,7 @@
# can be used for memory checking of the runtime tests using:
# make RUNTOOL="valgrind --leak-check=full"
# and valgrind can be used when invoking SWIG using:
-# make SWIGTOOL="valgrind --tool=memcheck --trace-children=yes"
-# Note: trace-children needed because of preinst-swig shell wrapper
-# to the swig executable.
+# make SWIGTOOL="valgrind --tool=memcheck"
#
# An individual test run can be debugged easily:
# make director_string.cpptest RUNTOOL="gdb --args"
@@ -56,8 +54,8 @@ endif
COMPILETOOL=
SWIGTOOL =
-SWIG = $(SWIGTOOL) $(top_builddir)/preinst-swig
-SWIG_LIB = $(top_srcdir)/Lib
+SWIGEXE = $(top_builddir)/swig
+SWIG_LIB_DIR = $(top_srcdir)/Lib
TEST_SUITE = test-suite
EXAMPLES = Examples
CXXSRCS =
@@ -138,6 +136,7 @@ CPP_TEST_CASES += \
casts \
char_binary \
char_strings \
+ chartest \
class_forward \
class_ignore \
class_scope_weird \
@@ -156,6 +155,7 @@ CPP_TEST_CASES += \
conversion \
conversion_namespace \
conversion_ns_template \
+ conversion_operators \
cplusplus_throw \
cpp_basic \
cpp_enum \
@@ -198,6 +198,7 @@ CPP_TEST_CASES += \
director_protected \
director_protected_overloaded \
director_redefined \
+ director_ref \
director_smartptr \
director_thread \
director_unroll \
@@ -217,6 +218,7 @@ CPP_TEST_CASES += \
evil_diamond \
evil_diamond_ns \
evil_diamond_prop \
+ exception_classname \
exception_order \
extend \
extend_constructor_destructor \
@@ -233,6 +235,7 @@ CPP_TEST_CASES += \
features \
fragments \
friends \
+ friends_template \
funcptr_cpp \
fvirtual \
global_namespace \
@@ -243,6 +246,7 @@ CPP_TEST_CASES += \
ignore_parameter \
import_nomodule \
inherit \
+ inherit_member \
inherit_missing \
inherit_same_name \
inherit_target_language \
@@ -255,13 +259,14 @@ CPP_TEST_CASES += \
langobj \
li_attribute \
li_attribute_template \
+ li_boost_array \
li_boost_shared_ptr \
li_boost_shared_ptr_bits \
li_boost_shared_ptr_template \
li_boost_shared_ptr_attribute \
- li_carrays \
- li_cdata \
- li_cpointer \
+ li_carrays_cpp \
+ li_cdata_cpp \
+ li_cpointer_cpp \
li_std_auto_ptr \
li_stdint \
li_swigtype_inout \
@@ -308,6 +313,7 @@ CPP_TEST_CASES += \
operator_pointer_ref \
operbool \
ordering \
+ overload_arrays \
overload_bool \
overload_copy \
overload_extend \
@@ -368,6 +374,7 @@ CPP_TEST_CASES += \
smart_pointer_templatevariables \
smart_pointer_typedef \
special_variables \
+ special_variable_attributes \
special_variable_macros \
static_array_member \
static_const_member \
@@ -388,6 +395,7 @@ CPP_TEST_CASES += \
template_default \
template_default2 \
template_default_arg \
+ template_default_arg_overloaded \
template_default_arg_virtual_destructor \
template_default_class_parms \
template_default_class_parms_typedef \
@@ -406,6 +414,7 @@ CPP_TEST_CASES += \
template_inherit \
template_inherit_abstract \
template_int_const \
+ template_keyword_in_type \
template_methods \
template_namespace_forward_declaration \
template_using_directive_and_declaration_forward \
@@ -462,7 +471,7 @@ CPP_TEST_CASES += \
typedef_reference \
typedef_scope \
typedef_sizet \
- typedef_struct \
+ typedef_struct_cpp \
typedef_typedef \
typemap_arrays \
typemap_array_qualifiers \
@@ -524,6 +533,7 @@ CPP11_TEST_CASES = \
cpp11_initializer_list \
cpp11_initializer_list_extend \
cpp11_lambda_functions \
+ cpp11_li_std_array \
cpp11_noexcept \
cpp11_null_pointer_constant \
cpp11_raw_string_literals \
@@ -539,6 +549,7 @@ CPP11_TEST_CASES = \
cpp11_template_explicit \
cpp11_template_typedefs \
cpp11_type_traits \
+ cpp11_type_aliasing \
cpp11_uniform_initialization \
cpp11_unrestricted_unions \
cpp11_userdefined_literals \
@@ -567,7 +578,6 @@ CPP_STD_TEST_CASES += \
li_std_vector \
li_std_vector_enum \
li_std_vector_member_var\
- naturalvar \
smart_pointer_inherit \
template_typedef_fnc \
template_type_namespace \
@@ -592,7 +602,7 @@ C_TEST_CASES += \
char_constant \
const_const \
constant_expr \
- empty \
+ empty_c \
enums \
enum_forward \
enum_macro \
@@ -605,7 +615,7 @@ C_TEST_CASES += \
inctest \
infinity \
integers \
- keyword_rename \
+ keyword_rename_c \
lextype \
li_carrays \
li_cdata \
@@ -620,8 +630,8 @@ C_TEST_CASES += \
nested_extend_c \
nested_structs \
newobject2 \
- overload_extend \
- overload_extendc \
+ overload_extend_c \
+ overload_extend2 \
preproc \
preproc_constants_c \
preproc_defined \
@@ -698,37 +708,37 @@ partialcheck:
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
swig_and_compile_cpp = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
- TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
$(LANGUAGE)$(VARIANT)_cpp
swig_and_compile_c = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CSRCS="$(CSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
- TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
$(LANGUAGE)$(VARIANT)
swig_and_compile_multi_cpp = \
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
- TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
swig_and_compile_external = \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- TARGET="$*_wrap_hdr.h" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ TARGET='$*_wrap_hdr.h' \
$(LANGUAGE)$(VARIANT)_externalhdr; \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS) $*_external.cxx" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
- TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS) $*_external.cxx' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
$(LANGUAGE)$(VARIANT)_cpp
swig_and_compile_runtime = \
diff --git a/Examples/test-suite/constant_pointers.i b/Examples/test-suite/constant_pointers.i
index 388970c4d85..9094e9dea55 100644
--- a/Examples/test-suite/constant_pointers.i
+++ b/Examples/test-suite/constant_pointers.i
@@ -4,6 +4,11 @@ This testcase primarily test constant pointers, eg int* const. Only a getter is
%module constant_pointers
+#if defined(SWIGSCILAB)
+%rename(MbrVar) MemberVariablesTest;
+%rename(RetVal) ReturnValuesTest;
+#endif
+
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG); /* Setting a pointer/reference variable may leak memory. */
diff --git a/Examples/test-suite/constructor_copy.i b/Examples/test-suite/constructor_copy.i
index 8e92e7840b7..7dcd05e8b26 100644
--- a/Examples/test-suite/constructor_copy.i
+++ b/Examples/test-suite/constructor_copy.i
@@ -5,13 +5,13 @@
%nocopyctor Bar;
%inline %{
-
+
struct Foo1 {
int x;
Foo1(int _x = 2) : x(_x)
{
- }
+ }
};
struct Foo2 {
@@ -25,7 +25,7 @@ struct Foo3 {
struct Foo4 {
Foo4() { }
-
+
protected:
Foo4(const Foo4& ) { }
};
@@ -33,7 +33,7 @@ protected:
struct Foo4a {
Foo4a() { }
-
+
private:
Foo4a(const Foo4a& ) { }
};
@@ -53,7 +53,7 @@ struct Foo8 {
};
template
-class Bar
+class Bar
{
public:
int x;
@@ -73,7 +73,7 @@ public:
%include "std_vector.i"
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT) || defined(SWIGSCILAB)
#define SWIG_GOOD_VECTOR
%ignore std::vector::vector(size_type);
%ignore std::vector::resize(size_type);
@@ -126,7 +126,7 @@ public:
template
struct ModelUtils_T {};
- }
+ }
}
%}
@@ -144,13 +144,13 @@ namespace Space1 {
class TotalReturnSwap {
public:
TotalReturnSwap() {}
- };
+ };
template
class TotalReturnSwap_T {
public:
TotalReturnSwap_T() {}
- };
+ };
}
}
diff --git a/Examples/test-suite/constructor_exception.i b/Examples/test-suite/constructor_exception.i
index 4c867c14428..e3cdc47afaf 100644
--- a/Examples/test-suite/constructor_exception.i
+++ b/Examples/test-suite/constructor_exception.i
@@ -1,14 +1,14 @@
%module constructor_exception
%inline %{
-class Error {
+class MyError {
};
class SomeClass {
public:
SomeClass(int x) {
if (x < 0) {
- throw Error();
+ throw MyError();
}
}
};
@@ -17,7 +17,7 @@ class Test {
SomeClass o;
public:
Test(int x) try : o(x) { }
- catch (Error &) {
+ catch (MyError &) {
}
catch (int) {
}
diff --git a/Examples/test-suite/conversion_ns_template.i b/Examples/test-suite/conversion_ns_template.i
index 0814f2a18e6..bddda5e7b62 100644
--- a/Examples/test-suite/conversion_ns_template.i
+++ b/Examples/test-suite/conversion_ns_template.i
@@ -20,9 +20,13 @@
Bar(){ }
Bar(int){ }
+#if !defined(__SUNPRO_CC)
operator int() { return 0; }
+#endif
operator int&() { static int num = 0; return num; }
+#if !defined(__SUNPRO_CC)
operator Foo() { return Foo(); }
+#endif
operator Foo&() { return *(new Foo()); }
};
}
diff --git a/Examples/test-suite/conversion_operators.i b/Examples/test-suite/conversion_operators.i
new file mode 100644
index 00000000000..fa9e52cac47
--- /dev/null
+++ b/Examples/test-suite/conversion_operators.i
@@ -0,0 +1,55 @@
+%module conversion_operators
+
+// Test bug #401 where the conversion operator name incorrectly included the newline character
+// Also test comments around conversion operators due to special handling in the scanner for conversion operators
+
+// These one line ignores should match the conversion operator names to suppress Warning 503 - SWIGWARN_LANG_IDENTIFIER
+%ignore operator const EcReal;
+%ignore operator EcImaginary const;
+%ignore operator EcComplex const;
+
+%inline %{
+
+struct EcReal {};
+struct EcImaginary {};
+struct EcComplex {};
+
+struct EcAngle {
+ operator const EcReal
+ (
+ ) const;
+ operator EcImaginary
+const (
+ ) const;
+ operator
+EcComplex
+ const (
+ ) const;
+};
+
+struct EcAngle2 {
+ operator const EcReal/* C comment */
+ (
+ ) const;
+ operator EcImaginary/* C comment */
+const (
+ ) const;
+ operator/* C comment */
+EcComplex
+ const (
+ ) const;
+};
+
+struct EcAngle3 {
+ operator const EcReal // C++ comment
+ (
+ ) const;
+ operator EcImaginary // C++ comment
+const (
+ ) const;
+ operator // C++ comment
+EcComplex
+ const (
+ ) const;
+};
+%}
diff --git a/Examples/test-suite/cpp11_lambda_functions.i b/Examples/test-suite/cpp11_lambda_functions.i
index 87c7196d8bb..161e08c65ff 100644
--- a/Examples/test-suite/cpp11_lambda_functions.i
+++ b/Examples/test-suite/cpp11_lambda_functions.i
@@ -100,9 +100,6 @@ int runLambdaInline() {
%{
// TODO
-struct LambdaStruct {
- static constexpr auto lambda_struct1 = [=]() { return thing; };
-};
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
void lambda_init(int = ([=]{ return 0; })());
diff --git a/Examples/test-suite/cpp11_li_std_array.i b/Examples/test-suite/cpp11_li_std_array.i
new file mode 100644
index 00000000000..74e34370c97
--- /dev/null
+++ b/Examples/test-suite/cpp11_li_std_array.i
@@ -0,0 +1,62 @@
+%module cpp11_li_std_array
+
+#if defined(SWIGPYTHON) || defined(SWIGRUBY)
+
+%{
+#include
+%}
+
+%include
+
+%template(ArrayInt6) std::array;
+
+%inline %{
+std::array arrayOutVal() {
+ return { -2, -1, 0, 0, 1, 2 };
+}
+
+std::array & arrayOutRef() {
+ static std::array a = { -2, -1, 0, 0, 1, 2 };
+ return a;
+}
+
+const std::array & arrayOutConstRef() {
+ static std::array a = { -2, -1, 0, 0, 1, 2 };
+ return a;
+}
+
+std::array * arrayOutPtr() {
+ static std::array a = { -2, -1, 0, 0, 1, 2 };
+ return &a;
+}
+
+std::array arrayInVal(std::array myarray) {
+ std::array a = myarray;
+ for (auto& val : a) {
+ val *= 10;
+ }
+ return a;
+}
+
+const std::array & arrayInConstRef(const std::array & myarray) {
+ static std::array a = myarray;
+ for (auto& val : a) {
+ val *= 10;
+ }
+ return a;
+}
+
+void arrayInRef(std::array & myarray) {
+ for (auto& val : myarray) {
+ val *= 10;
+ }
+}
+
+void arrayInPtr(std::array * myarray) {
+ for (auto& val : *myarray) {
+ val *= 10;
+ }
+}
+%}
+
+#endif
diff --git a/Examples/test-suite/cpp11_noexcept.i b/Examples/test-suite/cpp11_noexcept.i
index 6fed5b8dfce..ef96fd8a779 100644
--- a/Examples/test-suite/cpp11_noexcept.i
+++ b/Examples/test-suite/cpp11_noexcept.i
@@ -13,7 +13,7 @@ struct NoExceptClass {
NoExceptClass() noexcept {}
NoExceptClass(const NoExceptClass&) noexcept {}
NoExceptClass(NoExceptClass&&) noexcept {}
- NoExceptClass& operator=(const NoExceptClass&) noexcept {}
+ NoExceptClass& operator=(const NoExceptClass&) noexcept { return *this; }
~NoExceptClass() noexcept {}
void noex0() noexcept {}
diff --git a/Examples/test-suite/cpp11_rvalue_reference2.i b/Examples/test-suite/cpp11_rvalue_reference2.i
index 4ef871c632b..6718a394140 100644
--- a/Examples/test-suite/cpp11_rvalue_reference2.i
+++ b/Examples/test-suite/cpp11_rvalue_reference2.i
@@ -31,14 +31,17 @@ struct Thingy {
// test both primitive and user defined rvalue reference default arguments and compactdefaultargs
void compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef) {}
void privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue) {}
- operator int &&() {}
+ operator int &&() { return std::move(0); }
+ Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(copy_int(rhs.rvalref)) {}
Thingy& operator=(const Thingy& rhs) {
val = rhs.val;
lvalref = rhs.lvalref;
rvalref = rhs.rvalref;
+ return *this;
}
private:
static const bool PrivateTrue;
+ int copy_int(int& i) { return i; }
Thingy();
};
const bool Thingy::PrivateTrue = true;
diff --git a/Examples/test-suite/cpp11_template_typedefs.i b/Examples/test-suite/cpp11_template_typedefs.i
index d6a1a3c8557..97a1da7ed6d 100644
--- a/Examples/test-suite/cpp11_template_typedefs.i
+++ b/Examples/test-suite/cpp11_template_typedefs.i
@@ -2,8 +2,14 @@
%module cpp11_template_typedefs
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefName;
+%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) TypedefNamePtr;
%warnfilter(SWIGWARN_CPP11_ALIAS_TEMPLATE) MyIntKeyClass;
%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) PF;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) BucketAllocator1;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) BucketAllocator2;
+
+// This warning should go away when type aliasing is supported
+#pragma SWIG nowarn=SWIGWARN_PARSE_USING_UNDEF // Nothing known about 'p.SomeType< char *,T2,4 >'.
%inline %{
template< typename T1, typename T2, int >
@@ -16,6 +22,8 @@ class SomeType {
// template aliasing
template< typename T2 >
using TypedefName = SomeType;
+template< typename T2 >
+using TypedefNamePtr = SomeType*;
// type aliasing
typedef void (*PFD)(double); // Old style
@@ -28,5 +36,21 @@ class MyCPP11Class {
};
template using MyIntKeyClass = MyCPP11Class;
MyIntKeyClass intchar;
+
+TypedefName alias1(TypedefName a) { return a; }
+TypedefNamePtr alias1(TypedefNamePtr a = nullptr) { return a; }
%}
+%inline %{
+typedef double Val;
+template struct ListBucket {
+};
+namespace Alloc {
+ template struct rebind {
+ typedef int other;
+ };
+}
+
+using BucketAllocator1 = typename Alloc::template rebind>::other;
+using BucketAllocator2 = typename Alloc::template rebind<::template ListBucket>::other;
+%}
diff --git a/Examples/test-suite/cpp11_type_aliasing.i b/Examples/test-suite/cpp11_type_aliasing.i
new file mode 100644
index 00000000000..87443633a59
--- /dev/null
+++ b/Examples/test-suite/cpp11_type_aliasing.i
@@ -0,0 +1,66 @@
+%module cpp11_type_aliasing
+
+// Type aliasing seg fault : Github issue #424
+
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) Target;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) Int;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntRef;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntPtrRef;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntRValueRef;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) IntArray;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) HalideTargetPtr1;
+%warnfilter(SWIGWARN_CPP11_ALIAS_DECLARATION) HalideTargetPtr2;
+
+%inline %{
+namespace Halide {
+
+struct Target {
+ int bits;
+ Target(int bits=32) : bits(bits) {}
+};
+
+class NamesInterface {
+public:
+ using Target = Halide::Target;
+};
+
+Target get_host_target() {
+ return Target();
+}
+
+namespace Internal {
+
+template class GeneratorParam {
+ T value;
+public:
+ GeneratorParam(const char *name, const T &v) : value(v) {}
+
+ T getValue() {
+ return value;
+ }
+};
+
+class GeneratorBase : public NamesInterface {
+public:
+ GeneratorParam target{ "target", Halide::get_host_target() };
+};
+
+}
+}
+%}
+
+%template(Halide_Target) Halide::Internal::GeneratorParam;
+
+
+%inline %{
+using Int = int;
+using IntRef = int&;
+using IntPtrRef = int*&;
+using IntRValueRef = int&&;
+using IntArray = int[];
+
+using HalideTargetPtr1 = Halide::Target*;
+namespace Halide {
+ using HalideTargetPtr2 = Target*;
+}
+%}
diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in
index 292c751e465..0c799c7d9e1 100644
--- a/Examples/test-suite/csharp/Makefile.in
+++ b/Examples/test-suite/csharp/Makefile.in
@@ -6,8 +6,7 @@ LANGUAGE = csharp
SCRIPTSUFFIX = _runme.cs
CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@
CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@
-CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@"
-CSHARPCYGPATH_W = @CSHARPCYGPATH_W@
+CSHARPCONVERTPATH = @top_srcdir@/@CSHARPCONVERTPATH@
srcdir = @srcdir@
top_srcdir = ../@top_srcdir@
@@ -74,18 +73,18 @@ setup = \
# Compiles C# files then runs the testcase. A testcase is only run if
# a file is found which has _runme.cs appended after the testcase name.
# Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX.
-# DYLD_FALLBACK_LIBRARY_PATH is cleared for MacOSX.
+# DYLD_FALLBACK_LIBRARY_PATH is cleared for Mac OS X.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \
- CSHARPSRCS='`$(CSHARPCYGPATH_W) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \
+ CSHARPSRCS='`$(CSHARPCONVERTPATH) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCONVERTPATH) "{}" \+`' csharp_compile && \
env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \
else \
cd $* && \
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \
CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -t:module -out:$*.netmodule' \
- CSHARPSRCS='`find . -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile; \
+ CSHARPSRCS='`find . -name "*.cs" -exec ../$(CSHARPCONVERTPATH) "{}" \+`' csharp_compile; \
fi
# Clean: remove testcase directories
diff --git a/Examples/test-suite/csharp/default_constructor_runme.cs b/Examples/test-suite/csharp/default_constructor_runme.cs
index acd62dc3d95..9fc8d754bd9 100644
--- a/Examples/test-suite/csharp/default_constructor_runme.cs
+++ b/Examples/test-suite/csharp/default_constructor_runme.cs
@@ -12,13 +12,5 @@ static void Main()
throw new Exception("Protected destructor exception should have been thrown");
} catch (MethodAccessException) {
}
-
- // calling private destructor test
- try {
- using (FFF f = new FFF()) {
- }
- throw new Exception("Private destructor exception should have been thrown");
- } catch (MethodAccessException) {
- }
}
}
diff --git a/Examples/test-suite/csharp/director_smartptr_runme.cs b/Examples/test-suite/csharp/director_smartptr_runme.cs
index ad33c4d3420..559dff7a0c7 100644
--- a/Examples/test-suite/csharp/director_smartptr_runme.cs
+++ b/Examples/test-suite/csharp/director_smartptr_runme.cs
@@ -1,13 +1,13 @@
using director_smartptrNamespace;
+using System;
public class runme
{
-
private class director_smartptr_MyBarFoo : Foo
{
public override string ping()
{
- return "director_smartptr_MyBarFoo.ping();";
+ return "director_smartptr_MyBarFoo.ping()";
}
public override string pong()
@@ -15,27 +15,39 @@ public override string pong()
return "director_smartptr_MyBarFoo.pong();" + ping();
}
- public override string fooBar(FooBar fooBar)
+ public override string upcall(FooBar fooBarPtr)
{
- return fooBar.FooBarDo();
+ return "override;" + fooBarPtr.FooBarDo();
}
public override Foo makeFoo()
{
return new Foo();
}
+ }
- public override FooBar makeFooBar()
- {
- return new FooBar();
- }
+ private static void check(string got, string expected)
+ {
+ if (got != expected)
+ throw new ApplicationException("Failed, got: " + got + " expected: " + expected);
}
static void Main()
{
- director_smartptr_MyBarFoo myBarFoo =
- new director_smartptr_MyBarFoo();
+ FooBar fooBar = new FooBar();
+
+ Foo myBarFoo = new director_smartptr_MyBarFoo();
+ check(myBarFoo.ping(), "director_smartptr_MyBarFoo.ping()");
+ check(Foo.callPong(myBarFoo), "director_smartptr_MyBarFoo.pong();director_smartptr_MyBarFoo.ping()");
+ check(Foo.callUpcall(myBarFoo, fooBar), "override;Bar::Foo2::Foo2Bar()");
+
+ Foo myFoo = myBarFoo.makeFoo();
+ check(myFoo.pong(), "Foo::pong();Foo::ping()");
+ check(Foo.callPong(myFoo), "Foo::pong();Foo::ping()");
+ check(myFoo.upcall(new FooBar()), "Bar::Foo2::Foo2Bar()");
- myBarFoo.ping();
+ Foo myFoo2 = new Foo().makeFoo();
+ check(myFoo2.pong(), "Foo::pong();Foo::ping()");
+ check(Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
}
}
diff --git a/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs b/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
index b4ec47f023d..38f71f97842 100644
--- a/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
+++ b/Examples/test-suite/csharp/li_boost_shared_ptr_bits_runme.cs
@@ -16,5 +16,12 @@ static void Main()
HiddenDestructor hidden = HiddenDestructor.create();
hidden.Dispose();
+
+ HiddenPrivateDestructor hiddenPrivate = HiddenPrivateDestructor.create();
+ if (HiddenPrivateDestructor.DeleteCount != 0)
+ throw new ApplicationException("Count should be zero");
+ hiddenPrivate.Dispose();
+ if (HiddenPrivateDestructor.DeleteCount != 1)
+ throw new ApplicationException("Count should be one");
}
}
diff --git a/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs b/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs
index 62554275122..445c4d74bc2 100644
--- a/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs
+++ b/Examples/test-suite/csharp/li_boost_shared_ptr_runme.cs
@@ -46,7 +46,7 @@ static void Main()
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new ApplicationException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ Console.Error.WriteLine("Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count();
diff --git a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
index 387d504001a..1f66042a6d1 100644
--- a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
+++ b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs
@@ -32,7 +32,7 @@ public static void Main()
};
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new ApplicationException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ Console.Error.WriteLine("Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
if (k2.getLabel() != "second")
@@ -51,7 +51,7 @@ public static void Main()
}
int actualCount = Klass.getTotal_count();
if (actualCount != expectedCount)
- throw new ApplicationException("Expected count: " + expectedCount + " Actual count: " + actualCount);
+ Console.Error.WriteLine("Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't
}
}
}
diff --git a/Examples/test-suite/csharp/special_variable_attributes_runme.cs b/Examples/test-suite/csharp/special_variable_attributes_runme.cs
new file mode 100644
index 00000000000..eca1abfa37f
--- /dev/null
+++ b/Examples/test-suite/csharp/special_variable_attributes_runme.cs
@@ -0,0 +1,30 @@
+
+using System;
+using special_variable_attributesNamespace;
+
+public class special_variable_attributes_runme {
+
+ public static void Main() {
+ if (special_variable_attributes.getNumber1() != 111)
+ throw new ApplicationException("getNumber1 failed");
+ if (special_variable_attributes.getNumber2() != 222)
+ throw new ApplicationException("getNumber2 failed");
+ if (special_variable_attributes.getNumber3() != 333)
+ throw new ApplicationException("getNumber3 failed");
+
+ if (special_variable_attributes.bounceNumber1(10) != 110)
+ throw new ApplicationException("bounceNumber1 failed");
+ if (special_variable_attributes.bounceNumber2(10) != 220)
+ throw new ApplicationException("bounceNumber2 failed");
+ if (special_variable_attributes.bounceNumber3(10) != 330)
+ throw new ApplicationException("bounceNumber3 failed");
+
+ if (special_variable_attributes.multi1(12.34) != 12+34)
+ throw new ApplicationException("multi1 failed");
+ if (special_variable_attributes.multi2(12.34) != 12+34+55)
+ throw new ApplicationException("multi2 failed");
+ if (special_variable_attributes.multi3(12.34) != 12+34+77)
+ throw new ApplicationException("multi3 failed");
+ }
+
+}
diff --git a/Examples/test-suite/csharp_exceptions.i b/Examples/test-suite/csharp_exceptions.i
index 0f11e7d69d4..e5b4d495b86 100644
--- a/Examples/test-suite/csharp_exceptions.i
+++ b/Examples/test-suite/csharp_exceptions.i
@@ -198,7 +198,7 @@ enum UnmanagedExceptions {
UnmanagedSystemException,
UnmanagedArgumentException,
UnmanagedArgumentNullException,
- UnmanagedArgumentOutOfRangeException,
+ UnmanagedArgumentOutOfRangeException
};
void check_exception(UnmanagedExceptions e) {
diff --git a/Examples/test-suite/csharp_typemaps.i b/Examples/test-suite/csharp_typemaps.i
index 32e735ca753..dc5b40c0273 100644
--- a/Examples/test-suite/csharp_typemaps.i
+++ b/Examples/test-suite/csharp_typemaps.i
@@ -77,17 +77,17 @@ public:
Number quadruple(Number n) {
n.Value *= 4;
return n;
-};
+}
Number times8(const Number& num) {
Number n(num);
n.Value *= 8;
return n;
-};
+}
Number times12(const Number* num) {
Number n(*num);
n.Value *= 12;
return n;
-};
+}
%}
// Test $csinput expansion
diff --git a/Examples/test-suite/d/default_constructor_runme.1.d b/Examples/test-suite/d/default_constructor_runme.1.d
index 3640218aeaf..bd79cdf9925 100644
--- a/Examples/test-suite/d/default_constructor_runme.1.d
+++ b/Examples/test-suite/d/default_constructor_runme.1.d
@@ -1,6 +1,5 @@
module default_constructor_runme;
-import default_constructor.FFF;
import default_constructor.G;
void main() {
@@ -15,16 +14,4 @@ void main() {
throw e;
}
}
-
- // Private destructor test.
- try {
- {
- scope f = new FFF();
- }
- throw new Exception("Private destructor exception should have been thrown");
- } catch (Exception e) {
- if (e.msg != "C++ destructor does not have public access") {
- throw e;
- }
- }
}
diff --git a/Examples/test-suite/d/default_constructor_runme.2.d b/Examples/test-suite/d/default_constructor_runme.2.d
index 22f5bffd2f3..991b4186a9b 100644
--- a/Examples/test-suite/d/default_constructor_runme.2.d
+++ b/Examples/test-suite/d/default_constructor_runme.2.d
@@ -1,6 +1,5 @@
module default_constructor_runme;
-import default_constructor.FFF;
import default_constructor.G;
void main() {
@@ -8,7 +7,6 @@ void main() {
// destruction yet.
// enforceThrows((){ scope g = new G(); }, "Protected destructor exception should have been thrown");
- // enforceThrows((){ scope f = new FFF(); }, "Private destructor exception should have been thrown");
}
private void enforceThrows(void delegate() dg, string errorMessage) {
diff --git a/Examples/test-suite/default_arg_values.i b/Examples/test-suite/default_arg_values.i
index 47ca2d12f09..f2fc57c9b5e 100644
--- a/Examples/test-suite/default_arg_values.i
+++ b/Examples/test-suite/default_arg_values.i
@@ -6,6 +6,12 @@ struct Display {
// Bad Python wrappers were being generated when NULL used for primitive type
float draw1(float v = 0) { return v; }
float draw2(float *v = 0) { return v ? *v : 0; }
+ bool bool0(bool x = 0) { return x; }
+ bool bool1(bool x = 1) { return x; }
+
+ typedef bool mybool;
+ bool mybool0(mybool x = 0) { return x; }
+ bool mybool1(mybool x = 1) { return x; }
};
float* createPtr(float v) { static float val; val = v; return &val; }
%}
@@ -14,5 +20,11 @@ struct Display {
// Bad Python wrappers were being generated when NULL used for primitive type
float draw1(float v = NULL) { return v; }
float draw2(float *v = NULL) { return v ? *v : 0; }
+ bool bool0(bool x = 0) { return x; }
+ bool bool1(bool x = 1) { return x; }
+
+ typedef bool mybool;
+ bool mybool0(mybool x = 0) { return x; }
+ bool mybool1(mybool x = 1) { return x; }
};
float* createPtr(float v) { static float val; val = v; return &val; }
diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i
index bcb8766a86c..d3014d3861e 100644
--- a/Examples/test-suite/default_args.i
+++ b/Examples/test-suite/default_args.i
@@ -114,7 +114,10 @@
%rename(renamed2arg) Foo::renameme(int x) const;
%rename(renamed1arg) Foo::renameme() const;
+%typemap(default) double* null_by_default "$1=0;";
+
%inline %{
+ typedef void* MyHandle;
// Define a class
class Foo {
@@ -139,6 +142,12 @@
// test the method itself being renamed
void oldname(int x = 1234) {}
void renameme(int x = 1234, double d=123.4) const {}
+
+ // test default values for pointer arguments
+ int double_if_void_ptr_is_null(int n, void* p = NULL) { return p ? n : 2*n; }
+ int double_if_handle_is_null(int n, MyHandle h = 0) { return h ? n : 2*n; }
+ int double_if_dbl_ptr_is_null(int n, double* null_by_default)
+ { return null_by_default ? n : 2*n; }
};
int Foo::bar = 1;
int Foo::spam = 2;
@@ -269,3 +278,26 @@ struct ConstMethods {
} Pointf;
}
%}
+
+// Default arguments after ignored ones.
+%typemap(in, numinputs=0) int square_error { $1 = 2; };
+%typemap(default, noblock=1) int def17 { $1 = 17; };
+
+// Enabling autodoc feature has a side effect of disabling the generation of
+// aliases for functions that can hide problems with default arguments at
+// Python level.
+%feature("autodoc","0") slightly_off_square;
+
+%inline %{
+ inline int slightly_off_square(int square_error, int def17) { return def17*def17 + square_error; }
+%}
+
+// Python C default args
+%feature("python:cdefaultargs") CDA::cdefaultargs_test1;
+%inline %{
+struct CDA {
+ int cdefaultargs_test1(int a = 1) { return a; }
+ int cdefaultargs_test2(int a = 1) { return a; }
+};
+%}
+
diff --git a/Examples/test-suite/default_constructor.i b/Examples/test-suite/default_constructor.i
index f7fc8cfa6d5..40a088cc9da 100644
--- a/Examples/test-suite/default_constructor.i
+++ b/Examples/test-suite/default_constructor.i
@@ -13,6 +13,16 @@
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) AD; /* C#, D, Java, PHP multiple inheritance */
+%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
+ SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
+ SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE) GGG; /* C#, D, Java, PHP multiple inheritance */
+
+%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
+ SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
+ SWIGWARN_D_MULTIPLE_INHERITANCE,
+ SWIGWARN_PHP_MULTIPLE_INHERITANCE) HHH; /* C#, D, Java, PHP multiple inheritance */
+
%warnfilter(SWIGWARN_LANG_FRIEND_IGNORE) F; /* friend function */
%delobject F::destroy;
@@ -104,12 +114,21 @@ public:
void bar(F *) { }
#if defined(_MSC_VER)
- #pragma warning(disable: 4624) // : destructor could not be generated because a base class destructor is inaccessible
+ #pragma warning(disable: 4624) // destructor could not be generated because a base class destructor is inaccessible or deleted
#endif
+
+// Single inheritance, base has private destructor
class FFF : public F {
};
+
+// Multiple inheritance, one base has private destructor
+class GGG : public A, public F {
+};
+class HHH : public F, public A {
+};
+
#if defined(_MSC_VER)
- #pragma warning(default: 4624) // : destructor could not be generated because a base class destructor is inaccessible
+ #pragma warning(default: 4624) // destructor could not be generated because a base class destructor is inaccessible or deleted
#endif
/* A class with a protected destructor */
diff --git a/Examples/test-suite/director_binary_string.i b/Examples/test-suite/director_binary_string.i
index f842dc2c706..17bdc1b64df 100644
--- a/Examples/test-suite/director_binary_string.i
+++ b/Examples/test-suite/director_binary_string.i
@@ -4,6 +4,7 @@
%apply (char *STRING, size_t LENGTH) { (char *dataBufferAA, int sizeAA) };
%apply (char *STRING, size_t LENGTH) { (char *dataBufferBB, int sizeBB) };
+%apply (char* STRING, size_t LENGTH) { (const void* data, size_t datalen) };
%inline %{
#include
@@ -20,6 +21,7 @@ public:
if (dataBufferBB)
memset(dataBufferBB, -1, sizeBB);
}
+ virtual void writeData(const void* data, size_t datalen) = 0;
};
class Caller {
@@ -50,6 +52,17 @@ public:
void call_null() {
_callback->run(NULL, 0, NULL, 0);
}
+ int callWriteData() {
+ int sum = 0;
+ if (_callback) {
+ char* aa = (char*)malloc(BUFFER_SIZE_AA);
+ memset(aa, 9, BUFFER_SIZE_AA);
+ _callback->writeData(aa, BUFFER_SIZE_AA);
+ for (int i = 0; i < BUFFER_SIZE_AA; i++)
+ sum += aa[i];
+ }
+ return sum;
+ }
};
%}
diff --git a/Examples/test-suite/director_frob.i b/Examples/test-suite/director_frob.i
index cf555eb6631..f1d502dc23b 100644
--- a/Examples/test-suite/director_frob.i
+++ b/Examples/test-suite/director_frob.i
@@ -1,6 +1,12 @@
%module(directors="1") director_frob;
#pragma SWIG nowarn=SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR
+#ifdef SWIGSCILAB
+%rename(cb) coreCallbacks;
+%rename(On3dEngRedrawn) coreCallbacksOn3dEngineRedrawnData;
+%rename (_On3dEngRedrawn) coreCallbacks_On3dEngineRedrawnData;
+#endif
+
%header %{
#include
%}
@@ -17,7 +23,7 @@
virtual ~Alpha() { };
virtual const char* abs_method() = 0;
};
-
+
struct Bravo : Alpha
{
const char* abs_method()
@@ -26,14 +32,14 @@
}
};
- struct Charlie : Bravo
+ struct Charlie : Bravo
{
const char* abs_method()
{
return "Charlie::abs_method()";
}
};
-
+
struct Delta : Charlie
{
};
@@ -50,7 +56,9 @@
public:
Ops() : num(0) {}
virtual ~Ops() {}
+#if !defined(__SUNPRO_CC)
virtual operator int() { return 0; }
+#endif
virtual operator int **() const {
return (int **) 0;
}
diff --git a/Examples/test-suite/director_ignore.i b/Examples/test-suite/director_ignore.i
index 57cbc13d870..edb65732062 100644
--- a/Examples/test-suite/director_ignore.i
+++ b/Examples/test-suite/director_ignore.i
@@ -10,6 +10,7 @@
%ignore OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0);
%ignore DIgnoreConstructor(bool b);
%ignore DIgnoreOnlyConstructor(bool b);
+%ignore DIgnoreDestructor::~DIgnoreDestructor;
%ignore Pointers;
%ignore References;
%ignore PublicMethod1;
@@ -101,6 +102,13 @@ class DIgnoreOnlyConstructor
DIgnoreOnlyConstructor(bool b) {}
};
+class DIgnoreDestructor
+{
+ public:
+ DIgnoreDestructor() {}
+ virtual ~DIgnoreDestructor() {}
+};
+
%{
class DIgnoreConstructor
{
@@ -118,5 +126,12 @@ class DIgnoreOnlyConstructor
private: // Hide constructor
DIgnoreOnlyConstructor(bool b) {}
};
-%}
+class DIgnoreDestructor
+{
+ public:
+ DIgnoreDestructor() {}
+ virtual ~DIgnoreDestructor() {}
+};
+
+%}
diff --git a/Examples/test-suite/director_overload2.i b/Examples/test-suite/director_overload2.i
index 0f3238149d2..e467c18cea6 100644
--- a/Examples/test-suite/director_overload2.i
+++ b/Examples/test-suite/director_overload2.i
@@ -12,10 +12,14 @@ struct OverloadBase {
};
struct OverloadDerived1 : OverloadBase {
virtual void nnn(int vvv) {}
-// virtual void nnn() {}
+#if defined(__SUNPRO_CC)
+ virtual void nnn() {}
+#endif
};
struct OverloadDerived2 : OverloadBase {
-// virtual void nnn(int vvv) {}
+#if defined(__SUNPRO_CC)
+ virtual void nnn(int vvv) {}
+#endif
virtual void nnn() {}
};
%}
diff --git a/Examples/test-suite/director_property.i b/Examples/test-suite/director_property.i
index 3363c3c4f27..da37ca4ae1e 100644
--- a/Examples/test-suite/director_property.i
+++ b/Examples/test-suite/director_property.i
@@ -7,13 +7,13 @@
class Foo {
private:
- std::string a;
+ std::string a_;
public:
virtual ~Foo() {}
virtual std::string ping() { return "Foo::ping()"; }
virtual std::string pong() { return "Foo::pong();" + ping(); }
- virtual std::string getA() { return this->a; }
- virtual void setA(std::string a) { this->a = a; }
+ virtual std::string getA() { return this->a_; }
+ virtual void setA(std::string a) { this->a_ = a; }
static Foo* get_self(Foo *slf) {return slf;}
diff --git a/Examples/test-suite/director_ref.i b/Examples/test-suite/director_ref.i
new file mode 100644
index 00000000000..8bb8a9b631d
--- /dev/null
+++ b/Examples/test-suite/director_ref.i
@@ -0,0 +1,82 @@
+%module(directors="1") director_ref
+
+%{
+#include
+
+class Foo {
+public:
+ Foo(int i = -1) : count(0) {}
+ virtual void OnDelete() {}
+ virtual ~Foo() {}
+ virtual std::string Msg(std::string msg = "default") { return "Foo-" + msg; }
+
+ std::string GetMsg() { return Msg(); }
+ std::string GetMsg(std::string msg) { return Msg(msg); }
+
+ void Ref() { ++count; }
+ void Unref() { --count; if (count == 0) { OnDelete(); delete this; } }
+ int GetRefCount() { return count; }
+private:
+ int count;
+};
+
+class FooPtr {
+public:
+ FooPtr(Foo* f = NULL) : my_f(f) { if (my_f) { my_f->Ref(); } }
+ ~FooPtr() { if (my_f) { my_f->Unref(); } }
+ void Reset(Foo* f = NULL) {
+ if (f) { f->Ref(); }
+ if (my_f) { my_f->Unref(); }
+ my_f = f;
+ }
+ int GetOwnedRefCount() {
+ if (my_f) { return my_f->GetRefCount(); }
+ return 0;
+ }
+
+private:
+ Foo* my_f;
+};
+
+%}
+
+%include
+
+%feature("director") Foo;
+%feature("ref") Foo "$this->Ref();"
+%feature("unref") Foo "$this->Unref();"
+
+class Foo {
+public:
+ Foo(int i = -1) : count(0) {}
+ virtual void OnDelete() {}
+ virtual ~Foo() {}
+ virtual std::string Msg(std::string msg = "default") { return "Foo-" + msg; }
+
+ std::string GetMsg() { return Msg(); }
+ std::string GetMsg(std::string msg) { return Msg(msg); }
+
+ void Ref() { ++count; }
+ void Unref() { --count; if (count == 0) { OnDelete(); delete this; } }
+ int GetRefCount() { return count; }
+private:
+ int count;
+};
+
+class FooPtr {
+public:
+ FooPtr(Foo* f = NULL) : my_f(f) { if (my_f) { my_f->Ref(); } }
+ ~FooPtr() { if (my_f) { my_f->Unref(); } }
+ void Reset(Foo* f = NULL) {
+ if (f) { f->Ref(); }
+ if (my_f) { my_f->Unref(); }
+ my_f = f;
+ }
+ int GetOwnedRefCount() {
+ if (my_f) { return my_f->GetRefCount(); }
+ return 0;
+ }
+
+private:
+ Foo* my_f;
+};
diff --git a/Examples/test-suite/director_smartptr.i b/Examples/test-suite/director_smartptr.i
index 13eb745b635..9d0be80f0fa 100644
--- a/Examples/test-suite/director_smartptr.i
+++ b/Examples/test-suite/director_smartptr.i
@@ -23,16 +23,18 @@ public:
virtual ~Foo() {}
virtual std::string ping() { return "Foo::ping()"; }
virtual std::string pong() { return "Foo::pong();" + ping(); }
- virtual std::string fooBar(FooBar* fooBarPtr) { return fooBarPtr->FooBarDo(); }
+ virtual std::string upcall(FooBar* fooBarPtr) { return fooBarPtr->FooBarDo(); }
virtual Foo makeFoo() { return Foo(); }
virtual FooBar makeFooBar() { return FooBar(); }
+ static std::string callPong(Foo &foo) { return foo.pong(); }
+ static std::string callUpcall(Foo &foo, FooBar* fooBarPtr) { return foo.upcall(fooBarPtr); }
static Foo* get_self(Foo *self_) {return self_;}
};
%}
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
@@ -61,10 +63,12 @@ public:
virtual ~Foo();
virtual std::string ping();
virtual std::string pong();
- virtual std::string fooBar(FooBar* fooBarPtr);
+ virtual std::string upcall(FooBar* fooBarPtr);
virtual Foo makeFoo();
virtual FooBar makeFooBar();
+ static std::string callPong(Foo &foo);
+ static std::string callUpcall(Foo &foo, FooBar* fooBarPtr);
static Foo* get_self(Foo *self_);
};
diff --git a/Examples/test-suite/empty_c.i b/Examples/test-suite/empty_c.i
new file mode 100644
index 00000000000..f5d27ec19f0
--- /dev/null
+++ b/Examples/test-suite/empty_c.i
@@ -0,0 +1 @@
+%module empty_c
diff --git a/Examples/test-suite/enum_forward.i b/Examples/test-suite/enum_forward.i
index c82e17be717..784f4fb029a 100644
--- a/Examples/test-suite/enum_forward.i
+++ b/Examples/test-suite/enum_forward.i
@@ -8,7 +8,20 @@ enum ForwardEnum2 { CCC, DDD };
%}
%inline %{
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+/* ISO C forbids forward references to ‘enum’ types [-Werror=pedantic] */
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
+#if !defined(__SUNPRO_C)
enum ForwardEnum1;
+enum ForwardEnum2;
+enum ForwardEnum2;
+enum ForwardEnum3;
+#endif
+%}
+
+%inline %{
enum ForwardEnum1 get_enum1() { return AAA; }
enum ForwardEnum1 test_function1(enum ForwardEnum1 e) {
return e;
@@ -16,22 +29,25 @@ enum ForwardEnum1 test_function1(enum ForwardEnum1 e) {
%}
%inline %{
-enum ForwardEnum2;
-enum ForwardEnum2;
enum ForwardEnum2 get_enum2() { return CCC; }
enum ForwardEnum2 test_function2(enum ForwardEnum2 e) {
return e;
}
-enum ForwardEnum2;
%}
%inline %{
-enum ForwardEnum3;
enum ForwardEnum3 { EEE, FFF };
enum ForwardEnum3 get_enum3() { return EEE; }
enum ForwardEnum3 test_function3(enum ForwardEnum3 e) {
return e;
}
+%}
+
+%inline %{
+#if !defined(__SUNPRO_C)
+enum ForwardEnum2;
enum ForwardEnum3;
+#endif
%}
+
#endif
diff --git a/Examples/test-suite/enum_macro.i b/Examples/test-suite/enum_macro.i
index b18e02a847f..c058cdf7211 100644
--- a/Examples/test-suite/enum_macro.i
+++ b/Examples/test-suite/enum_macro.i
@@ -1,6 +1,13 @@
%module enum_macro
%inline %{
+
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+/* comma at end of enumerator list [-Werror=pedantic] */
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
+
enum Greeks1
{
#define GREEK1 -1
diff --git a/Examples/test-suite/enum_missing.i b/Examples/test-suite/enum_missing.i
index de71952e712..8a436ba3695 100644
--- a/Examples/test-suite/enum_missing.i
+++ b/Examples/test-suite/enum_missing.i
@@ -14,10 +14,10 @@ enum AVPixelFormat2 {
%}
%inline %{
-typedef struct AVCodecContext {
+typedef struct AVCodecCtx {
enum AVPixelFormat pix_fmt;
enum AVPixelFormat2 pix_fmt2;
-} AVCodecContext;
+} AVCodecCtx;
enum AVPixelFormat global_fmt;
enum AVPixelFormat2 global_fmt2;
@@ -29,7 +29,7 @@ enum AVPixelFormat * use_pixel_format_ptr(enum AVPixelFormat *px) {
return px;
}
-const enum AVPixelFormat2 use_pixel_format2(const enum AVPixelFormat2 px) {
+enum AVPixelFormat2 use_pixel_format2(const enum AVPixelFormat2 px) {
return px;
}
const enum AVPixelFormat2 * use_pixel_format_ptr2(const enum AVPixelFormat2 *px) {
diff --git a/Examples/test-suite/errors/.gitignore b/Examples/test-suite/errors/.gitignore
deleted file mode 100644
index 22ca119479d..00000000000
--- a/Examples/test-suite/errors/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.newerr
-cpp_recursive_typedef.py
-cpp_shared_ptr.py
-xxx.py
diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in
index 4c61001e71e..cf7889a1d4b 100644
--- a/Examples/test-suite/errors/Makefile.in
+++ b/Examples/test-suite/errors/Makefile.in
@@ -20,6 +20,9 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
+SWIG_LIB_SET = @SWIG_LIB_SET@
+SWIGINVOKE = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
+
# All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input
ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i)))
CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES))
@@ -32,7 +35,7 @@ include $(srcdir)/../common.mk
# Portable dos2unix / todos for stripping CR
TODOS = tr -d '\r'
-#TODOS = sed -e 's/\r$$//' # On OSX behaves as if written 's/r$$//'
+#TODOS = sed -e 's/\r$$//' # On Mac OS X behaves as if written 's/r$$//'
# strip source directory from output, so that diffs compare
STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
@@ -40,17 +43,17 @@ STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
# Rules for the different types of tests
%.cpptest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIG) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.ctest:
echo "$(ACTION)ing errors testcase $*"
- -$(SWIG) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
+ -$(SWIGINVOKE) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
%.clean:
@exit 0
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' python_clean
@rm -f *.$(ERROR_EXT) *.py
diff --git a/Examples/test-suite/errors/cpp_macro_locator.i b/Examples/test-suite/errors/cpp_macro_locator.i
index bd441a1212a..e00caf00d42 100644
--- a/Examples/test-suite/errors/cpp_macro_locator.i
+++ b/Examples/test-suite/errors/cpp_macro_locator.i
@@ -100,4 +100,9 @@ void overloadinline2(const int *) {}
void overload5(int *) {}
void overload5(const int *) {}
-
+%ignore Outer2::QuietInner;
+struct Outer2 {
+ struct QuietInner {
+ VARIABLEMACRO(MyInnerVar)
+ };
+};
diff --git a/Examples/test-suite/errors/cpp_template_friend.i b/Examples/test-suite/errors/cpp_template_friend.i
new file mode 100644
index 00000000000..c9d1c9d5d13
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_friend.i
@@ -0,0 +1,26 @@
+%module cpp_template_friend
+
+template T template_friend1(T);
+template T template_friend1(T);
+struct MyTemplate1 {
+ template friend T template_friend1(T);
+};
+
+template T template_friend2(T);
+struct MyTemplate2 {
+ template friend T template_friend2(T);
+};
+template T template_friend2(T);
+
+
+int normal_friend1(int);
+int normal_friend1(int);
+struct MyClass1 {
+ friend int normal_friend1(int);
+};
+
+int normal_friend2(int);
+struct MyClass2 {
+ friend int normal_friend2(int);
+};
+int normal_friend2(int);
diff --git a/Examples/test-suite/errors/cpp_template_friend.stderr b/Examples/test-suite/errors/cpp_template_friend.stderr
new file mode 100644
index 00000000000..8dea195dc0a
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_template_friend.stderr
@@ -0,0 +1,8 @@
+cpp_template_friend.i:4: Warning 302: Identifier 'template_friend1' redefined (ignored),
+cpp_template_friend.i:3: Warning 302: previous definition of 'template_friend1'.
+cpp_template_friend.i:13: Warning 302: Identifier 'template_friend2' redefined (ignored),
+cpp_template_friend.i:9: Warning 302: previous definition of 'template_friend2'.
+cpp_template_friend.i:17: Warning 322: Redundant redeclaration of 'normal_friend1',
+cpp_template_friend.i:16: Warning 322: previous declaration of 'normal_friend1'.
+cpp_template_friend.i:26: Warning 322: Redundant redeclaration of 'normal_friend2',
+cpp_template_friend.i:22: Warning 322: previous declaration of 'normal_friend2'.
diff --git a/Examples/test-suite/errors/cpp_using_type_aliasing.i b/Examples/test-suite/errors/cpp_using_type_aliasing.i
new file mode 100644
index 00000000000..df65dbd3d61
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_using_type_aliasing.i
@@ -0,0 +1,13 @@
+%module cpp_using_type_aliasing
+
+namespace Space {
+ template struct Okay {
+ };
+ struct User {
+ protected:
+ using OkayInt = Okay;
+ };
+ struct Derived : User {
+ Okay ff();
+ };
+};
diff --git a/Examples/test-suite/errors/cpp_using_type_aliasing.stderr b/Examples/test-suite/errors/cpp_using_type_aliasing.stderr
new file mode 100644
index 00000000000..3f256652f91
--- /dev/null
+++ b/Examples/test-suite/errors/cpp_using_type_aliasing.stderr
@@ -0,0 +1,3 @@
+cpp_using_type_aliasing.i:8: Warning 341: The 'using' keyword in type aliasing is not fully supported yet.
+cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'.
+cpp_using_type_aliasing.i:8: Warning 315: Nothing known about 'Okay< int >'.
diff --git a/Examples/test-suite/errors/pp_unknowndirective.i b/Examples/test-suite/errors/pp_unknowndirective.i
index 659a997d3bb..b4e608b343f 100644
--- a/Examples/test-suite/errors/pp_unknowndirective.i
+++ b/Examples/test-suite/errors/pp_unknowndirective.i
@@ -1,5 +1,10 @@
%module xxx
+/* Regression test for bug introduced in 3.0.4 and fixed in 3.0.6 - the '%std'
+ * here led to SWIG calling abort().
+ */
+%typemap(jstype) std::vector, const %std::vector&, std::vector& "List"
+
/* This used to give the rather cryptic "Syntax error in input(1)." prior to
* SWIG 3.0.4. This testcase checks that the improved message is actually
* issued.
diff --git a/Examples/test-suite/errors/pp_unknowndirective.stderr b/Examples/test-suite/errors/pp_unknowndirective.stderr
index d0d5e249f4d..2cc2377c791 100644
--- a/Examples/test-suite/errors/pp_unknowndirective.stderr
+++ b/Examples/test-suite/errors/pp_unknowndirective.stderr
@@ -1 +1 @@
-pp_unknowndirective.i:7: Error: Unknown directive '%remane'.
+pp_unknowndirective.i:12: Error: Unknown directive '%remane'.
diff --git a/Examples/test-suite/errors/pp_unknowndirective2.i b/Examples/test-suite/errors/pp_unknowndirective2.i
index 889e6c5b217..5c914e5078e 100644
--- a/Examples/test-suite/errors/pp_unknowndirective2.i
+++ b/Examples/test-suite/errors/pp_unknowndirective2.i
@@ -1,6 +1,6 @@
%module xxx
-#ifdef FOO
+#ifndef FOO
long long i;
/* Check we get an error for an unknown directive (this should be #elif).
* Unknown directives were silently ignored by SWIG < 3.0.3. */
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad.i b/Examples/test-suite/errors/swig_pythoncode_bad.i
new file mode 100644
index 00000000000..f1d497618d6
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%pythoncode %{
+ def foo():
+ a = 1 # This line starts with a tab instead of 8 spaces.
+ return 2
+%}
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad.stderr b/Examples/test-suite/errors/swig_pythoncode_bad.stderr
new file mode 100644
index 00000000000..4bded567799
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad.stderr
@@ -0,0 +1 @@
+swig_pythoncode_bad.i:7: Error: Line indented less than expected (line 2 of %pythoncode or %insert("python") block) as no line should be indented less than the indentation in line 1
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad2.i b/Examples/test-suite/errors/swig_pythoncode_bad2.i
new file mode 100644
index 00000000000..f80f1be8602
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad2.i
@@ -0,0 +1,13 @@
+%module xxx
+
+%pythoncode %{
+ def one():
+ print "in one"
+%}
+
+%pythoncode %{
+ print "still in one"
+
+ def two():
+ print "in two"
+%}
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad2.stderr b/Examples/test-suite/errors/swig_pythoncode_bad2.stderr
new file mode 100644
index 00000000000..4fce404442f
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad2.stderr
@@ -0,0 +1 @@
+swig_pythoncode_bad2.i:13: Error: Line indented less than expected (line 3 of %pythoncode or %insert("python") block) as no line should be indented less than the indentation in line 1
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad3.i b/Examples/test-suite/errors/swig_pythoncode_bad3.i
new file mode 100644
index 00000000000..5759158d963
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad3.i
@@ -0,0 +1,7 @@
+%module xxx
+
+%pythoncode %{
+ def extra():
+ print "extra a" # indentation is 2 spaces then tab
+ print "extra b" # indentation is tab then 2 spaces
+%}
diff --git a/Examples/test-suite/errors/swig_pythoncode_bad3.stderr b/Examples/test-suite/errors/swig_pythoncode_bad3.stderr
new file mode 100644
index 00000000000..2de4e7d05ff
--- /dev/null
+++ b/Examples/test-suite/errors/swig_pythoncode_bad3.stderr
@@ -0,0 +1 @@
+swig_pythoncode_bad3.i:7: Warning 740: Whitespace indentation is inconsistent compared to earlier lines (line 3 of %pythoncode or %insert("python") block)
diff --git a/Examples/test-suite/exception_classname.i b/Examples/test-suite/exception_classname.i
new file mode 100644
index 00000000000..a5a76e24de2
--- /dev/null
+++ b/Examples/test-suite/exception_classname.i
@@ -0,0 +1,10 @@
+%module exception_classname
+
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME);
+
+%inline %{
+class Exception {
+public:
+ int testfunc() { return 42; }
+};
+%}
diff --git a/Examples/test-suite/extend.i b/Examples/test-suite/extend.i
index 2a2a472ea2f..29e258f5b94 100644
--- a/Examples/test-suite/extend.i
+++ b/Examples/test-suite/extend.i
@@ -23,6 +23,9 @@ struct Base {
virtual int method(int v) {
return v;
}
+#if !defined(SWIG)
+ virtual ~Base() {}
+#endif
};
struct Derived : Base {
double actualval;
diff --git a/Examples/test-suite/extern_c.i b/Examples/test-suite/extern_c.i
index 9c17d18fb77..e56d9f128c9 100644
--- a/Examples/test-suite/extern_c.i
+++ b/Examples/test-suite/extern_c.i
@@ -14,3 +14,18 @@ typedef int Integer2;
void RealFunction(int value) {}
%}
+
+%inline %{
+extern "C" {
+ typedef void (*Hook1_t)(int, const char *);
+}
+extern "C" typedef void (*Hook2_t)(int, const char *);
+void funcy1(Hook1_t) {}
+void funcy2(Hook2_t) {}
+Hook1_t hook1;
+Hook2_t hook2;
+
+extern "C" typedef int Integer;
+Integer int1;
+%}
+
diff --git a/Examples/test-suite/friends_template.i b/Examples/test-suite/friends_template.i
new file mode 100644
index 00000000000..48623f2ca38
--- /dev/null
+++ b/Examples/test-suite/friends_template.i
@@ -0,0 +1,46 @@
+%module friends_template
+
+%{
+template class MyClass;
+
+template int operator<<(double un, const MyClass & x) { return 0; }
+template int funk_hidden(double is, MyClass & x) { return 2; }
+
+template T template_friend_hidden(T t) { return t + 1; }
+%}
+
+%inline %{
+template int operator>>(double is, MyClass & x) { return 1; }
+template int funk_seen(double is, MyClass & x) { return 2; }
+template T template_friend_seen(T t1, T t2) { return t1 + t2; }
+int friend_plain_seen(int i) { return i; }
+
+template class MyClass
+{
+ friend int operator<< (double un, const MyClass & x);
+ friend int operator>> (double is, MyClass & x);
+ friend int funk_hidden (double is, MyClass & x);
+ friend int funk_seen (double is, MyClass & x);
+};
+
+struct MyTemplate {
+ template friend T template_friend_hidden(T);
+ template friend T template_friend_seen(T, T);
+ friend int friend_plain_seen(int i);
+};
+
+MyClass makeMyClassInt() { return MyClass(); }
+%}
+
+// Although the friends in MyClass are automatically instantiated via %template(MyClassDouble) MyClass,
+// the operator friends are not valid and hence %rename is needed.
+%rename(OperatorInputDouble) operator>> ;
+%rename(OperatorOutputDouble) operator<< ;
+%template(MyClassDouble) MyClass;
+
+%template(TemplateFriendHiddenInt) template_friend_hidden;
+%template(TemplateFriendSeenInt) template_friend_seen;
+
+// These have no %template(XX) MyClass to instantiate, but they can be instantiated separately...
+%template(OperatorInputInt) operator>> ;
+%template(OperatorFunkSeenInt) funk_seen ;
diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in
index 4480ecf1fcb..01989b0d378 100644
--- a/Examples/test-suite/go/Makefile.in
+++ b/Examples/test-suite/go/Makefile.in
@@ -5,31 +5,43 @@
LANGUAGE = go
GO = @GO@
GOGCC = @GOGCC@
+GCCGO = @GCCGO@
GO1 = @GO1@
GO12 = @GO12@
GO13 = @GO13@
+GO15 = @GO15@
GOC = @GOC@
+GOVERSIONOPTION = @GOVERSIONOPTION@
+host = @host@
SCRIPTSUFFIX = _runme.go
-GOCOMPILEARG = `if $(GOGCC) ; then echo -c -g; elif $(GO1) ; then echo tool $(GOC:c=g) ; fi`
-GOLD = $(GOC:c=l)
+GOCOMPILEARG = `if $(GO15); then echo tool compile; elif $(GO1); then echo tool $(GOC:c=g); fi`
+GOLD = `if $(GO15); then echo link; else echo $(GOC:c=l); fi`
GOTOOL = `if $(GO1) ; then echo go tool; fi`
GOPACK = `if $(GO1) ; then echo go tool pack; else echo gopack; fi`
-GOOBJEXT = $(GOC:c=)
+GOOBJEXT = `if $(GO15); then echo o; else echo $(GOC:c=); fi`
+
+OSXOLDGOLINKFLAGS = `if [ -n "\`$(GO) $(GOVERSIONOPTION) | grep -E 'go1($|.0|.1|.2|.3)'\`" ] && [ -n "\`echo $(host) | grep darwin\`" ]; then echo "-Wl,-U,__cgo_topofstack"; fi`
SO = @SO@
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
CPP_TEST_CASES = \
go_inout \
go_director_inout
+MULTI_CPP_TEST_CASES = \
+ go_subdir_import
+
include $(srcdir)/../common.mk
+INCLUDES = -I$(abs_top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)
+
.SUFFIXES: .cpptest .ctest .multicpptest
# Rules for the different types of tests
@@ -37,37 +49,85 @@ include $(srcdir)/../common.mk
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase_cpp)
+ if ! $(GO15); then \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
+ $(LANGUAGE)$(VARIANT)_cpp_nocgo && \
+ $(run_testcase_cpp); \
+ fi
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
+ if ! $(GO15); then \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CSRCS='$(CSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET='$(TARGETPREFIX)$*$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' INTERFACE='$*.i' \
+ $(LANGUAGE)$(VARIANT)_nocgo && \
+ $(run_testcase); \
+ fi
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_multi_testcase)
+li_windows.cpptest:
+ # Does not work because go build won't build li_windows.go,
+ # because file names with "windows" are only built on Windows.
+
multi_import.multicpptest:
$(setup)
for f in multi_import_b multi_import_a; do \
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \
- SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \
- INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \
- TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
$(LANGUAGE)$(VARIANT)_cpp; \
done
$(run_multi_testcase)
+go_subdir_import.multicpptest:
+ $(setup)
+ mkdir -p testdir/go_subdir_import/
+ mkdir -p gopath/src/testdir/go_subdir_import/
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ LIBS='$(LIBS)' INTERFACEPATH='$(SRCDIR)$(INTERFACEDIR)go_subdir_import_b.i' \
+ INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT) -outdir .' NOLINK=true \
+ TARGET='$(TARGETPREFIX)go_subdir_import_b$(TARGETSUFFIX)' INTERFACEDIR='$(INTERFACEDIR)' \
+ INTERFACE='testdir/go_subdir_import/go_subdir_import_b.i' \
+ $(LANGUAGE)$(VARIANT)_cpp;
+ for f in testdir/go_subdir_import/go_subdir_import_c go_subdir_import_a ; do \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ LIBS='$(LIBS)' INCLUDES='$(INCLUDES)' SWIGOPT='$(SWIGOPT)' NOLINK=true \
+ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR='$(INTERFACEDIR)' INTERFACE="$$f.i" \
+ $(LANGUAGE)$(VARIANT)_cpp; \
+ done
+ if $(GOGCC); then \
+ cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a gopath/src/testdir/go_subdir_import/go_subdir_import_b.gox; \
+ cp gopath/src/testdir/go_subdir_import/go_subdir_import_b/go_subdir_import_b.a .; \
+ cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a gopath/src/testdir/go_subdir_import/go_subdir_import_c.gox; \
+ cp gopath/src/testdir/go_subdir_import/go_subdir_import_c/go_subdir_import_c.a testdir/go_subdir_import/; \
+ fi
+ $(run_multi_testcase)
+
# Runs the testcase.
run_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
- $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@; \
- elif $(GO12) || $(GO13); then \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
+ $(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a; \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
@@ -75,12 +135,14 @@ run_testcase = \
run_testcase_cpp = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
- $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@ -lstdc++; \
- elif $(GO12) || $(GO13); then \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
+ $(COMPILETOOL) $(GCCGO) -c -g -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.a -lstdc++; \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
@@ -88,28 +150,38 @@ run_testcase_cpp = \
run_multi_testcase = \
if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \
- $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
if $(GOGCC) ; then \
+ $(COMPILETOOL) $(GCCGO) -c -g -I . -I gopath/src $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \
- $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.@OBJEXT@ $${f}_wrap.@OBJEXT@; done` -lstdc++; \
- elif $(GO12) || $(GO13); then \
- $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
+ $(COMPILETOOL) $(GCCGO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.a; done` -lstdc++; \
+ elif $(GO12) || $(GO13) || $(GO15); then \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
+ $(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS) $(OSXOLDGOLINKFLAGS)" -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
else \
+ $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \
$(COMPILETOOL) $(GOTOOL) $(GOLD) -L . -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $*_runme $(SCRIPTPREFIX)$*_runme.$(GOOBJEXT); \
fi && \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$*_runme; \
fi
%.clean:
- @rm -f $*.go $*_gc.c $*_wrap.* $*_runme
+ @rm -rf $*.go $*_gc.c $*_wrap.* $*_runme $*.gox $*.a
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" go_clean
- rm -f mod_a.go mod_b.go imports_a.go imports_b.go
- rm -f clientdata_prop_a.go clientdata_prop_b.go
- rm -f multi_import_a.go multi_import_b.go
- rm -f packageoption_a.go packageoption_b.go packageoption_c.go
- rm -f import_stl_a.go import_stl_b.go
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' go_clean
+ rm -f mod_a.go mod_a.gox mod_b.go mod_b.gox
+ rm -f imports_a.go imports_a.gox imports_b.go imports_b.gox
+ rm -f clientdata_prop_a.go clientdata_prop_a.gox
+ rm -f clientdata_prop_b.go clientdata_prop_b.gox
+ rm -f multi_import_a.go multi_import_a.gox
+ rm -f multi_import_b.go multi_import_b.gox
+ rm -rf go_subdir_import_a.go go_subdir_import_a.gox testdir
+ rm -f packageoption_a.go packageoption_a.gox
+ rm -f packageoption_b.go packageoption_b.gox
+ rm -f packageoption_c.go packageoption_c.gox
+ rm -f import_stl_a.go import_stl_a.gox
+ rm -f import_stl_b.go import_stl_b.gox
+ rm -rf gopath
cvsignore:
@echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib'
diff --git a/Examples/test-suite/go/contract_runme.go b/Examples/test-suite/go/contract_runme.go
index d86110be2c4..b20a1a64fdc 100644
--- a/Examples/test-suite/go/contract_runme.go
+++ b/Examples/test-suite/go/contract_runme.go
@@ -196,13 +196,13 @@ func main() {
}()
//Namespace
- my := contract.NewMyClass(1)
+ contract.NewMyClass(1)
func() {
defer func() {
if recover() == nil {
panic("Failed! constructor preassertion")
}
}()
- my = contract.NewMyClass(0)
+ contract.NewMyClass(0)
}()
}
diff --git a/Examples/test-suite/go/default_constructor_runme.go b/Examples/test-suite/go/default_constructor_runme.go
index e5e32547521..40a5a6e49ff 100644
--- a/Examples/test-suite/go/default_constructor_runme.go
+++ b/Examples/test-suite/go/default_constructor_runme.go
@@ -21,9 +21,6 @@ func main() {
f := dc.NewF()
f.Destroy()
- ff := dc.NewFFF()
- ff.Destroy()
-
g := dc.NewG()
dc.GDestroy(g)
diff --git a/Examples/test-suite/go/empty_c_runme.go b/Examples/test-suite/go/empty_c_runme.go
new file mode 100644
index 00000000000..831a56118c8
--- /dev/null
+++ b/Examples/test-suite/go/empty_c_runme.go
@@ -0,0 +1,6 @@
+package main
+
+import _ "./empty_c"
+
+func main() {
+}
diff --git a/Examples/test-suite/go/go_subdir_import_runme.go b/Examples/test-suite/go/go_subdir_import_runme.go
new file mode 100644
index 00000000000..f90a6eb5464
--- /dev/null
+++ b/Examples/test-suite/go/go_subdir_import_runme.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "go_subdir_import_a"
+ "testdir/go_subdir_import/go_subdir_import_b"
+ "testdir/go_subdir_import/go_subdir_import_c"
+)
+
+func main() {
+ b := go_subdir_import_b.NewObjB();
+ c := go_subdir_import_c.NewObjC();
+ v := go_subdir_import_a.AddFive(b, c)
+ if v != 50 {
+ panic(0)
+ }
+}
diff --git a/Examples/test-suite/go/inherit_member_runme.go b/Examples/test-suite/go/inherit_member_runme.go
new file mode 100644
index 00000000000..599a0eb5694
--- /dev/null
+++ b/Examples/test-suite/go/inherit_member_runme.go
@@ -0,0 +1,15 @@
+package main
+
+import wrap "./inherit_member"
+
+func main() {
+ s := wrap.NewChild()
+ s.SetPvar("p")
+ s.SetCvar("c")
+ if s.GetPvar() != "p" {
+ panic(s.GetPvar())
+ }
+ if s.GetCvar() != "c" {
+ panic(s.GetCvar())
+ }
+}
diff --git a/Examples/test-suite/go/keyword_rename_c_runme.go b/Examples/test-suite/go/keyword_rename_c_runme.go
new file mode 100644
index 00000000000..425e38a267d
--- /dev/null
+++ b/Examples/test-suite/go/keyword_rename_c_runme.go
@@ -0,0 +1,8 @@
+package main
+
+import "./keyword_rename_c"
+
+func main() {
+ keyword_rename_c.Xgo(1)
+ keyword_rename_c.Xchan(1)
+}
diff --git a/Examples/test-suite/go/li_carrays_cpp_runme.go b/Examples/test-suite/go/li_carrays_cpp_runme.go
new file mode 100644
index 00000000000..7ee0a410373
--- /dev/null
+++ b/Examples/test-suite/go/li_carrays_cpp_runme.go
@@ -0,0 +1,14 @@
+package main
+
+import . "./li_carrays_cpp"
+
+func main() {
+ d := NewDoubleArray(10)
+
+ d.Setitem(0, 7)
+ d.Setitem(5, d.Getitem(0)+3)
+
+ if d.Getitem(5)+d.Getitem(0) != 17 {
+ panic(0)
+ }
+}
diff --git a/Examples/test-suite/go/li_cdata_cpp_runme.go b/Examples/test-suite/go/li_cdata_cpp_runme.go
new file mode 100644
index 00000000000..42a0ebd0829
--- /dev/null
+++ b/Examples/test-suite/go/li_cdata_cpp_runme.go
@@ -0,0 +1,13 @@
+package main
+
+import . "./li_cdata_cpp"
+
+func main() {
+ s := "ABC abc"
+ m := Malloc(256)
+ Memmove(m, s, len(s))
+ ss := Cdata(m, 7)
+ if string(ss) != "ABC abc" {
+ panic("failed")
+ }
+}
diff --git a/Examples/test-suite/go/li_cpointer_cpp_runme.go b/Examples/test-suite/go/li_cpointer_cpp_runme.go
new file mode 100644
index 00000000000..e2f5a59d12a
--- /dev/null
+++ b/Examples/test-suite/go/li_cpointer_cpp_runme.go
@@ -0,0 +1,14 @@
+package main
+
+import . "./li_cpointer_cpp"
+
+func main() {
+ p := New_intp()
+ Intp_assign(p, 3)
+
+ if Intp_value(p) != 3 {
+ panic(0)
+ }
+
+ Delete_intp(p)
+}
diff --git a/Examples/test-suite/go/overload_extendc_runme.go b/Examples/test-suite/go/overload_extend2_runme.go
similarity index 86%
rename from Examples/test-suite/go/overload_extendc_runme.go
rename to Examples/test-suite/go/overload_extend2_runme.go
index 1bdba750938..121506734bc 100644
--- a/Examples/test-suite/go/overload_extendc_runme.go
+++ b/Examples/test-suite/go/overload_extend2_runme.go
@@ -1,9 +1,9 @@
package main
-import "./overload_extendc"
+import "./overload_extend2"
func main() {
- f := overload_extendc.NewFoo()
+ f := overload_extend2.NewFoo()
if f.Test(3) != 1 {
panic(0)
}
diff --git a/Examples/test-suite/go/overload_extend_c_runme.go b/Examples/test-suite/go/overload_extend_c_runme.go
new file mode 100644
index 00000000000..e00f0b94531
--- /dev/null
+++ b/Examples/test-suite/go/overload_extend_c_runme.go
@@ -0,0 +1,22 @@
+package main
+
+import "./overload_extend_c"
+
+func main() {
+ f := overload_extend_c.NewFoo()
+ if f.Test().(int) != 0 {
+ panic(0)
+ }
+ if f.Test(3).(int) != 1 {
+ panic(0)
+ }
+ if f.Test("hello").(int) != 2 {
+ panic(0)
+ }
+ if f.Test(float64(3), float64(2)).(float64) != 5 {
+ panic(0)
+ }
+ if f.Test(3.0).(float64) != 1003 {
+ panic(0)
+ }
+}
diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go
index 1720e1a4d57..46f837f49de 100644
--- a/Examples/test-suite/go/overload_polymorphic_runme.go
+++ b/Examples/test-suite/go/overload_polymorphic_runme.go
@@ -6,6 +6,10 @@ func main(){
t := overload_polymorphic.NewDerived()
if overload_polymorphic.Test(t) != 0 {
- panic("failed")
+ panic("failed 1")
+ }
+
+ if overload_polymorphic.Test2(t) != 1 {
+ panic("failed 2")
}
}
diff --git a/Examples/test-suite/go_director_inout.i b/Examples/test-suite/go_director_inout.i
index af59e313ca3..5a7fbdf89b6 100644
--- a/Examples/test-suite/go_director_inout.i
+++ b/Examples/test-suite/go_director_inout.i
@@ -44,14 +44,14 @@ type GoRetStruct struct {
$result.str.assign($input.p, $input.n);
%}
-%typemap(out) RetStruct
+%typemap(out,fragment="AllocateString") RetStruct
%{
- $result = _swig_makegostring($1.str.data(), $1.str.length());
+ $result = Swig_AllocateString($1.str.data(), $1.str.length());
%}
-%typemap(goout) RetStruct
+%typemap(goout,fragment="CopyString") RetStruct
%{
- $result = GoRetStruct{Str: $input}
+ $result = GoRetStruct{Str: swigCopyString($input)}
%}
%typemap(godirectorout) RetStruct
@@ -81,21 +81,26 @@ type GoRetStruct struct {
}
%}
-%typemap(directorin) MyStruct
+%typemap(directorin,fragment="AllocateString") MyStruct
%{
- $input = _swig_makegostring($1.str.data(), $1.str.length());
+ $input = Swig_AllocateString($1.str.data(), $1.str.length());
%}
-%typemap(out) MyStruct
+%typemap(godirectorin,fragment="CopyString") MyStruct
%{
- $result = _swig_makegostring($1.str.data(), $1.str.length());
+ if err := json.Unmarshal([]byte(swigCopyString($input)), &$result); err != nil {
+ panic(err)
+ }
%}
-%typemap(godirectorin) MyStruct
+%typemap(out,fragment="AllocateString") MyStruct
%{
- if err := json.Unmarshal([]byte($input), &$result); err != nil {
- panic(err)
- }
+ $result = Swig_AllocateString($1.str.data(), $1.str.length());
+%}
+
+%typemap(goout,fragment="CopyString") MyStruct
+%{
+ $result = swigCopyString($input)
%}
%typemap(in) MyStruct
diff --git a/Examples/test-suite/go_inout.i b/Examples/test-suite/go_inout.i
index 510ed68e0e6..57e7bf2fb6a 100644
--- a/Examples/test-suite/go_inout.i
+++ b/Examples/test-suite/go_inout.i
@@ -56,14 +56,14 @@ type In json.Marshaler
%typemap(imtype) RetStruct "string"
-%typemap(out) RetStruct
+%typemap(out,fragment="AllocateString") RetStruct
%{
- $result = _swig_makegostring($1.str.data(), $1.str.length());
+ $result = Swig_AllocateString($1.str.data(), $1.str.length());
%}
-%typemap(goout) RetStruct
+%typemap(goout,fragment="CopyString") RetStruct
%{
- if err := json.Unmarshal([]byte($1), &$result); err != nil {
+ if err := json.Unmarshal([]byte(swigCopyString($1)), &$result); err != nil {
panic(err)
}
%}
@@ -146,7 +146,7 @@ static void putuint64(std::string *s, size_t off, uint64_t v) {
%}
// Pack the vector into a string.
-%typemap(argout) MyArray*
+%typemap(argout,fragment="AllocateString") MyArray*
%{
{
size_t tot = 8;
@@ -164,15 +164,15 @@ static void putuint64(std::string *s, size_t off, uint64_t v) {
str.replace(off, p->size(), *p);
off += p->size();
}
- *$input = _swig_makegostring(str.data(), str.size());
+ *$input = Swig_AllocateString(str.data(), str.size());
}
%}
// Unpack the string into a []string.
-%typemap(goargout) MyArray*
+%typemap(goargout,fragment="CopyString") MyArray*
%{
{
- str := *$input
+ str := swigCopyString(*$input)
bin := binary.LittleEndian
size := bin.Uint64([]byte(str[:8]))
str = str[8:]
diff --git a/Examples/test-suite/go_subdir_import.list b/Examples/test-suite/go_subdir_import.list
new file mode 100644
index 00000000000..e117d32fa27
--- /dev/null
+++ b/Examples/test-suite/go_subdir_import.list
@@ -0,0 +1,3 @@
+testdir/go_subdir_import/go_subdir_import_c
+go_subdir_import_b
+go_subdir_import_a
diff --git a/Examples/test-suite/go_subdir_import_a.i b/Examples/test-suite/go_subdir_import_a.i
new file mode 100644
index 00000000000..3fc36e6f9bc
--- /dev/null
+++ b/Examples/test-suite/go_subdir_import_a.i
@@ -0,0 +1,37 @@
+/* File : go_subdir_import_a.i */
+
+/*
+ * This files helps check the case where the SWIG-generated .go file needs to
+ * import another, SWIG-generated, module that is in a relative subdirectory.
+ * This case might happen for two different reasons:
+ * 1) Importing a module for which the .i file is in a subdirectory relatively
+ * to this file (this is tested here with go_subdir_import_c).
+ * 2) Importing a module whos module name is a path (this is tested here with
+ * go_subdir_import_b).
+ *
+ * This file is the "root" file that imports the two modules which will be
+ * generated (by swig) in a relative subdirectory.
+ */
+%module go_subdir_import_a
+
+%import(module="testdir/go_subdir_import/go_subdir_import_c") "testdir/go_subdir_import/go_subdir_import_c.i"
+%import "go_subdir_import_b.i"
+
+%{
+class ObjC {
+ public:
+ virtual int getInt() const;
+};
+
+class ObjB {
+ public:
+ virtual int getInt() const;
+};
+%}
+
+%inline %{
+int AddFive(const ObjB& b, const ObjC& c) {
+ return b.getInt() + c.getInt() + 5;
+}
+%}
+
diff --git a/Examples/test-suite/go_subdir_import_b.i b/Examples/test-suite/go_subdir_import_b.i
new file mode 100644
index 00000000000..42544822e9e
--- /dev/null
+++ b/Examples/test-suite/go_subdir_import_b.i
@@ -0,0 +1,12 @@
+/* File : go_subdir_import_b.i */
+%module "testdir/go_subdir_import/go_subdir_import_b"
+
+%inline %{
+class ObjB {
+ public:
+ virtual int getInt() const {
+ return 27;
+ }
+};
+%}
+
diff --git a/Examples/test-suite/guile/Makefile.in b/Examples/test-suite/guile/Makefile.in
index 9050d76f57a..55885fc2979 100644
--- a/Examples/test-suite/guile/Makefile.in
+++ b/Examples/test-suite/guile/Makefile.in
@@ -62,4 +62,4 @@ run_testcase = \
@rm -f $*-guile
clean:
- $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" guile_clean
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' guile_clean
diff --git a/Examples/test-suite/guile/li_std_string_runme.scm b/Examples/test-suite/guile/li_std_string_runme.scm
index 83fc2b5e705..fcf2f58d2be 100644
--- a/Examples/test-suite/guile/li_std_string_runme.scm
+++ b/Examples/test-suite/guile/li_std_string_runme.scm
@@ -25,7 +25,7 @@
(if (not (try-set-locale "C.UTF-8")) ; Linux
(if (not (try-set-locale "en_US.utf8")) ; Linux
-(if (not (try-set-locale "en_US.UTF-8")) ; Mac OSX
+(if (not (try-set-locale "en_US.UTF-8")) ; Mac OS X
(error "Failed to set any UTF-8 locale")
)))
diff --git a/Examples/test-suite/guile/overload_extend_c_runme.scm b/Examples/test-suite/guile/overload_extend_c_runme.scm
new file mode 100644
index 00000000000..a26b8a95cba
--- /dev/null
+++ b/Examples/test-suite/guile/overload_extend_c_runme.scm
@@ -0,0 +1,2 @@
+(dynamic-call "scm_init_overload_extend_c_module" (dynamic-link "./liboverload_extend_c"))
+(load "../schemerunme/overload_extend_c.scm")
diff --git a/Examples/test-suite/inherit_member.i b/Examples/test-suite/inherit_member.i
new file mode 100644
index 00000000000..c26da6151a0
--- /dev/null
+++ b/Examples/test-suite/inherit_member.i
@@ -0,0 +1,17 @@
+// Based on https://github.com/swig/swig/issues/339 .
+
+%module inherit_member
+
+%include
+
+%inline %{
+
+struct parent_class {
+ std::string pvar;
+};
+
+ struct child : public parent_class {
+ std::string cvar;
+};
+
+%}
diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in
index 310f1a77369..3dc6555eff0 100644
--- a/Examples/test-suite/java/Makefile.in
+++ b/Examples/test-suite/java/Makefile.in
@@ -27,6 +27,7 @@ CPP_TEST_CASES = \
java_director_assumeoverride \
java_director_exception_feature \
java_director_exception_feature_nspace \
+ java_director_ptrclass \
java_enums \
java_jnitypes \
java_lib_arrays_dimensionless \
diff --git a/Examples/test-suite/java/char_binary_runme.java b/Examples/test-suite/java/char_binary_runme.java
index 9227f86173a..bc811ef5d08 100644
--- a/Examples/test-suite/java/char_binary_runme.java
+++ b/Examples/test-suite/java/char_binary_runme.java
@@ -20,5 +20,11 @@ public static void main(String argv[]) {
if (t.strlen(hil0) != 4)
throw new RuntimeException("bad multi-arg typemap");
+
+ if (t.ustrlen(hile) != 4)
+ throw new RuntimeException("bad multi-arg typemap");
+
+ if (t.ustrlen(hil0) != 4)
+ throw new RuntimeException("bad multi-arg typemap");
}
}
diff --git a/Examples/test-suite/java/cpp11_constexpr_runme.java b/Examples/test-suite/java/cpp11_constexpr_runme.java
index c774e82f857..de1ae8cc32b 100644
--- a/Examples/test-suite/java/cpp11_constexpr_runme.java
+++ b/Examples/test-suite/java/cpp11_constexpr_runme.java
@@ -23,7 +23,7 @@ public static void main(String argv[])
check(cpp11_constexpr.CCC(), 30);
check(cpp11_constexpr.DDD(), 40);
- ConstExpressions ce = new ConstExpressions();
+ ConstExpressions ce = new ConstExpressions(0);
check(ce.JJJ, 100);
check(ce.KKK, 200);
check(ce.LLL, 300);
diff --git a/Examples/test-suite/java/cpp11_type_aliasing_runme.java b/Examples/test-suite/java/cpp11_type_aliasing_runme.java
new file mode 100644
index 00000000000..0db1df372d3
--- /dev/null
+++ b/Examples/test-suite/java/cpp11_type_aliasing_runme.java
@@ -0,0 +1,20 @@
+import cpp11_type_aliasing.*;
+
+public class cpp11_type_aliasing_runme {
+
+ static {
+ try {
+ System.loadLibrary("cpp11_type_aliasing");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Halide_Target ht = new GeneratorBase().getTarget();
+ Target x = ht.getValue();
+ if (x.getBits() != 32)
+ throw new RuntimeException("Incorrect bits");
+ }
+}
diff --git a/Examples/test-suite/java/default_constructor_runme.java b/Examples/test-suite/java/default_constructor_runme.java
index 6473c4099b9..eb6a2df535b 100644
--- a/Examples/test-suite/java/default_constructor_runme.java
+++ b/Examples/test-suite/java/default_constructor_runme.java
@@ -20,13 +20,5 @@ public static void main(String argv[])
throw new RuntimeException("Protected destructor exception should have been thrown");
} catch (UnsupportedOperationException e) {
}
-
- // calling private destructor test
- try {
- FFF f = new FFF();
- f.delete();
- throw new RuntimeException("Private destructor exception should have been thrown");
- } catch (UnsupportedOperationException e) {
- }
}
}
diff --git a/Examples/test-suite/java/director_binary_string_runme.java b/Examples/test-suite/java/director_binary_string_runme.java
index 96207336702..14982efc2d7 100644
--- a/Examples/test-suite/java/director_binary_string_runme.java
+++ b/Examples/test-suite/java/director_binary_string_runme.java
@@ -17,11 +17,15 @@ public static void main(String argv[]) {
Callback callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
int sum = caller.call();
+ int sumData = caller.callWriteData();
caller.delCallback();
if (sum != 9*2*8 + 13*3*5)
throw new RuntimeException("Unexpected sum: " + sum);
+ if (sumData != 9*2*8)
+ throw new RuntimeException("Unexpected sum: " + sum);
+
new Callback().run(null, null);
callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
@@ -45,5 +49,13 @@ public void run(byte[] dataBufferAA, byte[] dataBufferBB)
for (int i = 0; i < dataBufferBB.length; i++)
dataBufferBB[i] = (byte)(dataBufferBB[i] * 3);
}
+
+ @Override
+ public void writeData(byte[] dataBufferAA)
+ {
+ if (dataBufferAA != null)
+ for (int i = 0; i < dataBufferAA.length; i++)
+ dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
+ }
}
diff --git a/Examples/test-suite/java/director_ref_runme.java b/Examples/test-suite/java/director_ref_runme.java
new file mode 100644
index 00000000000..1f85a669800
--- /dev/null
+++ b/Examples/test-suite/java/director_ref_runme.java
@@ -0,0 +1,71 @@
+
+import director_ref.*;
+
+public class director_ref_runme {
+
+ static {
+ try {
+ System.loadLibrary("director_ref");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ director_ref_MyFoo a = new director_ref_MyFoo();
+ if (a.GetRefCount() != 1) {
+ throw new RuntimeException ( "Refcount test 1 failed." );
+ }
+
+ // Make sure director logic still works.
+ if (!a.GetMsg().equals("director_ref_MyFoo-default")) {
+ throw new RuntimeException ( "Test 1 failed" );
+ }
+ if (!a.GetMsg("boo").equals("director_ref_MyFoo-boo")) {
+ throw new RuntimeException ( "Test 2 failed" );
+ }
+
+ a.delete(); // should delete the object.
+ if (a.cppDeleted != true) {
+ throw new RuntimeException ( "Unref test 1 failed." );
+ }
+
+ a = new director_ref_MyFoo();
+ FooPtr p = new FooPtr(a);
+ if (a.GetRefCount() != 2) {
+ throw new RuntimeException ( "Refcount test 2 failed." );
+ }
+ a.delete(); // Shouldn't actually delete the underlying object
+ if (a.cppDeleted) {
+ throw new RuntimeException ( "Unref test 2 failed." );
+ }
+ if (p.GetOwnedRefCount() != 1) {
+ throw new RuntimeException ( "Unref test 3 failed." );
+ }
+ p.Reset(); // Now it should be deleted on the cpp side.
+ // We can't check cppDeleted because the director will stop
+ // working after a delete() call.
+ if (p.GetOwnedRefCount() != 0) {
+ throw new RuntimeException ( "Unref test 4 failed." );
+ }
+ }
+}
+
+class director_ref_MyFoo extends Foo {
+ public director_ref_MyFoo() {
+ super();
+ }
+ public director_ref_MyFoo(int i) {
+ super(i);
+ }
+ public String Msg(String msg) {
+ return "director_ref_MyFoo-" + msg;
+ }
+ public void OnDelete() {
+ cppDeleted = true;
+ }
+
+ public boolean cppDeleted = false;
+}
+
diff --git a/Examples/test-suite/java/director_smartptr_runme.java b/Examples/test-suite/java/director_smartptr_runme.java
index 8c4ddc5d3af..710ece7107b 100644
--- a/Examples/test-suite/java/director_smartptr_runme.java
+++ b/Examples/test-suite/java/director_smartptr_runme.java
@@ -12,18 +12,35 @@ public class director_smartptr_runme {
}
}
- public static void main(String argv[]) {
- director_smartptr_MyBarFoo myBarFoo =
- new director_smartptr_MyBarFoo();
+ private static void check(String got, String expected) {
+ if (!got.equals(expected))
+ throw new RuntimeException("Failed, got: " + got + " expected: " + expected);
}
+ public static void main(String argv[]) {
+ director_smartptr.FooBar fooBar = new director_smartptr.FooBar();
+
+ director_smartptr.Foo myBarFoo = new director_smartptr_MyBarFoo();
+ check(myBarFoo.ping(), "director_smartptr_MyBarFoo.ping()");
+ check(director_smartptr.Foo.callPong(myBarFoo), "director_smartptr_MyBarFoo.pong();director_smartptr_MyBarFoo.ping()");
+ check(director_smartptr.Foo.callUpcall(myBarFoo, fooBar), "override;Bar::Foo2::Foo2Bar()");
+
+ director_smartptr.Foo myFoo = myBarFoo.makeFoo();
+ check(myFoo.pong(), "Foo::pong();Foo::ping()");
+ check(director_smartptr.Foo.callPong(myFoo), "Foo::pong();Foo::ping()");
+ check(myFoo.upcall(fooBar), "Bar::Foo2::Foo2Bar()");
+
+ director_smartptr.Foo myFoo2 = new director_smartptr.Foo().makeFoo();
+ check(myFoo2.pong(), "Foo::pong();Foo::ping()");
+ check(director_smartptr.Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
+ }
}
class director_smartptr_MyBarFoo extends director_smartptr.Foo {
@Override
public String ping() {
- return "director_smartptr_MyBarFoo.ping();";
+ return "director_smartptr_MyBarFoo.ping()";
}
@Override
@@ -32,17 +49,12 @@ public String pong() {
}
@Override
- public String fooBar(director_smartptr.FooBar fooBar) {
- return fooBar.FooBarDo();
+ public String upcall(director_smartptr.FooBar fooBarPtr) {
+ return "override;" + fooBarPtr.FooBarDo();
}
@Override
public director_smartptr.Foo makeFoo() {
return new director_smartptr.Foo();
}
-
- @Override
- public director_smartptr.FooBar makeFooBar() {
- return new director_smartptr.FooBar();
- }
-}
\ No newline at end of file
+}
diff --git a/Examples/test-suite/java/friends_template_runme.java b/Examples/test-suite/java/friends_template_runme.java
new file mode 100644
index 00000000000..eb66cd5cbea
--- /dev/null
+++ b/Examples/test-suite/java/friends_template_runme.java
@@ -0,0 +1,28 @@
+
+import friends_template.*;
+
+public class friends_template_runme {
+
+ static {
+ try {
+ System.loadLibrary("friends_template");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ friends_template.OperatorOutputDouble(1.1, new MyClassDouble());
+ friends_template.OperatorInputDouble(1.1, new MyClassDouble());
+ friends_template.funk_hidden(1.1, new MyClassDouble());
+ friends_template.funk_seen(1.1, new MyClassDouble());
+
+ friends_template.TemplateFriendHiddenInt(0);
+ friends_template.TemplateFriendSeenInt(0, 0);
+
+ SWIGTYPE_p_MyClassT_int_t myClassInt = friends_template.makeMyClassInt();
+ friends_template.OperatorInputInt(1, myClassInt);
+ friends_template.OperatorFunkSeenInt(1.1, myClassInt);
+ }
+}
diff --git a/Examples/test-suite/java/java_director_ptrclass_runme.java b/Examples/test-suite/java/java_director_ptrclass_runme.java
new file mode 100644
index 00000000000..2d78a8f2e68
--- /dev/null
+++ b/Examples/test-suite/java/java_director_ptrclass_runme.java
@@ -0,0 +1,47 @@
+
+import java_director_ptrclass.*;
+
+public class java_director_ptrclass_runme {
+
+ static {
+ try {
+ System.loadLibrary("java_director_ptrclass");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) {
+ Foo f = new Foo();
+ Foo ft = new TouchingFoo();
+ Baz b = new Baz();
+ if (b.GetTouched()) {
+ throw new RuntimeException ( "Baz should not have been touched yet." );
+ }
+
+ Baz b2 = f.FinalMaybeTouch(b);
+
+ if (b2.GetTouched() || b.GetTouched()) {
+ throw new RuntimeException ( "Baz should not have been touched by Foo." );
+ }
+
+ Baz b3 = ft.FinalMaybeTouch(b);
+
+ if (!b.GetTouched() || !b3.GetTouched() || !b2.GetTouched()) {
+ throw new RuntimeException ( "Baz was not touched by TouchingFoo. This" +
+ " might mean the directorin typemap is not" +
+ " parsing the typemap(jstype, Bar) in its" +
+ " 'descriptor' kwarg correctly." );
+ }
+ }
+}
+
+class TouchingFoo extends Foo {
+ @Override
+ public Baz MaybeTouch(Baz baz_ptr) {
+ baz_ptr.SetTouched();
+ return baz_ptr;
+ }
+}
+
diff --git a/Examples/test-suite/java/li_boost_shared_ptr_bits_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_bits_runme.java
index d1489edf4d3..aefa81182a2 100644
--- a/Examples/test-suite/java/li_boost_shared_ptr_bits_runme.java
+++ b/Examples/test-suite/java/li_boost_shared_ptr_bits_runme.java
@@ -23,5 +23,12 @@ public static void main(String argv[])
HiddenDestructor hidden = HiddenDestructor.create();
hidden.delete();
+
+ HiddenPrivateDestructor hiddenPrivate = HiddenPrivateDestructor.create();
+ if (HiddenPrivateDestructor.getDeleteCount() != 0)
+ throw new RuntimeException("Count should be zero");
+ hiddenPrivate.delete();
+ if (HiddenPrivateDestructor.getDeleteCount() != 1)
+ throw new RuntimeException("Count should be one");
}
}
diff --git a/Examples/test-suite/java/li_carrays_cpp_runme.java b/Examples/test-suite/java/li_carrays_cpp_runme.java
new file mode 100644
index 00000000000..c339a6f561a
--- /dev/null
+++ b/Examples/test-suite/java/li_carrays_cpp_runme.java
@@ -0,0 +1,88 @@
+import li_carrays_cpp.*;
+
+public class li_carrays_cpp_runme {
+
+ static {
+ try {
+ System.loadLibrary("li_carrays_cpp");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String argv[]) throws Throwable
+ {
+ // array_class
+ {
+ int length = 5;
+ XYArray xyArray = new XYArray(length);
+ for (int i=0; i
+class Ptr {
+public:
+ Ptr(T* b) : b_(b) {}
+ T* Get() const { return b_; }
+private:
+ T* b_;
+};
+
+class Foo {
+public:
+ // Calling FinalMaybeTouch from Java unambiguously goes through C++ to
+ // reach MaybeTouch.
+ Ptr< bar::Baz > FinalMaybeTouch(Baz* b) {
+ return MaybeTouch(Ptr< bar::Baz >(b));
+ }
+ virtual Ptr< bar::Baz > MaybeTouch(Ptr< bar::Baz > f) {
+ return f; /* Don't touch */
+ }
+ virtual ~Foo() {}
+};
+}
+%}
+
+%feature("director") Foo;
+
+%typemap(jni) bar::Ptr< bar::Baz > "jlong"
+%typemap(jtype) bar::Ptr< bar::Baz > "long"
+%typemap(jstype) bar::Ptr< bar::Baz > "Baz"
+%typemap(in) bar::Ptr< bar::Baz > {
+ $1 = bar::Ptr< bar::Baz >(*( bar::Baz**)&$input);
+}
+%typemap(out) bar::Ptr< bar::Baz > {
+ const bar::Ptr< bar::Baz >& ptr = $1;
+ if (ptr.Get()) {
+ $result = ($typemap(jni, bar::Baz))ptr.Get();
+ } else {
+ $result = 0;
+ }
+}
+%typemap(javain) bar::Ptr< bar::Baz > "$typemap(jstype, bar::Baz).getCPtr($javainput)"
+%typemap(javaout) bar::Ptr< bar::Baz > {
+ long cPtr = $jnicall;
+ return (cPtr == 0) ? null : new $typemap(jstype, bar::Baz)(cPtr, false);
+}
+%typemap(directorin, descriptor="L$packagepath/$typemap(jstype, bar::Baz);") bar::Ptr< bar::Baz >
+%{ *((bar::Baz**)&$input) = ((bar::Ptr< bar::Baz >&)$1).Get(); %}
+%typemap(directorout) bar::Ptr< bar::Baz > {
+ $result = bar::Ptr< bar::Baz >(*( bar::Baz**)&$input);
+}
+%typemap(javadirectorin) bar::Ptr< bar::Baz > %{
+ ((long)$jniinput == 0) ? null : new $typemap(jstype, bar::Baz)($jniinput, false)
+%}
+%typemap(javadirectorout) bar::Ptr< bar::Baz > "$typemap(jstype, bar::Baz).getCPtr($javacall)"
+
+namespace bar {
+class Baz {
+public:
+ Baz() : touched(false) {}
+ void SetTouched() { touched = true; }
+ bool GetTouched() { return touched; }
+private:
+ bool touched;
+};
+
+template
+class Ptr {
+public:
+ Ptr(T* b) : b_(b) {}
+ T* Get() { return b_; }
+private:
+ T* b_;
+};
+
+class Foo {
+public:
+ // Calling FinalMaybeTouch from Java unambiguously goes through C++ to
+ // reach MaybeTouch.
+ Ptr< bar::Baz > FinalMaybeTouch(Baz* b) {
+ return MaybeTouch(Ptr< bar::Baz >(b));
+ }
+ virtual Ptr< bar::Baz > MaybeTouch(Ptr< bar::Baz > f) {
+ return f; /* Don't touch */
+ }
+ virtual ~Foo() {}
+};
+}
+
diff --git a/Examples/test-suite/java_typemaps_proxy.i b/Examples/test-suite/java_typemaps_proxy.i
index e315a36b504..3e9b1833578 100644
--- a/Examples/test-suite/java_typemaps_proxy.i
+++ b/Examples/test-suite/java_typemaps_proxy.i
@@ -31,8 +31,8 @@ import java.lang.*; // for Exception
// Create a new getCPtr() function which takes Java null and is public
%typemap(javabody) NS::Greeting %{
- private long swigCPtr;
- protected boolean swigCMemOwn;
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
protected $javaclassname(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
@@ -46,8 +46,8 @@ import java.lang.*; // for Exception
// Make the pointer constructor public
%typemap(javabody) NS::Farewell %{
- private long swigCPtr;
- protected boolean swigCMemOwn;
+ private transient long swigCPtr;
+ protected transient boolean swigCMemOwn;
public $javaclassname(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
diff --git a/Examples/test-suite/java_typemaps_typewrapper.i b/Examples/test-suite/java_typemaps_typewrapper.i
index a99ca7b6581..b7bf847ef51 100644
--- a/Examples/test-suite/java_typemaps_typewrapper.i
+++ b/Examples/test-suite/java_typemaps_typewrapper.i
@@ -39,7 +39,7 @@ import java.lang.*; // for Exception
// Create a new getCPtr() function which takes Java null and is public
// Make the pointer constructor public
%typemap(javabody) Farewell * %{
- private long swigCPtr;
+ private transient long swigCPtr;
public $javaclassname(long cPtr, boolean bFutureUse) {
swigCPtr = cPtr;
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index 83b15f82282..c68dd22b25a 100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -13,7 +13,8 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SWIG = $(top_builddir)/preinst_swig
+SWIGEXE = $(top_builddir)/swig
+SWIG_LIB_DIR = $(top_srcdir)/Lib
ifneq (, $(ENGINE))
JSENGINE=$(ENGINE)
@@ -53,21 +54,25 @@ ifeq (node,$(JSENGINE))
enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
setup_node = \
- test -d $* || mkdir $*; \
+ test -d $* || mkdir $* && \
sed -e 's|$$testcase|$*|g; s|$$cflags|$(GYP_CFLAGS)|g; s|$$srcdir|$(srcdir)|g' \
- $(srcdir)/node_template/binding.gyp.in > $*/binding.gyp; \
+ $(srcdir)/node_template/binding.gyp.in > $*/binding.gyp && \
sed -e 's|$$testcase|$*|g;' \
$(srcdir)/node_template/index.js.in > $*/index.js
# Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension)
swig_and_compile_c = \
- $(setup_node); \
- $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i; \
+ $(setup_node) && \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i' swiginvoke && \
$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
swig_and_compile_cpp = \
- $(setup_node); \
- $(SWIG) -c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i; \
+ $(setup_node) && \
+ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
+ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
+ SWIGOPT='-c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i' swiginvoke && \
$(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
run_testcase = \
diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js
index b2aac920caa..01b72ebe14d 100644
--- a/Examples/test-suite/javascript/char_binary_runme.js
+++ b/Examples/test-suite/javascript/char_binary_runme.js
@@ -5,10 +5,17 @@ if (t.strlen('hile') != 4) {
print(t.strlen('hile'));
throw("bad multi-arg typemap 1");
}
+if (t.ustrlen('hile') != 4) {
+ print(t.ustrlen('hile'));
+ throw("bad multi-arg typemap 1");
+}
if (t.strlen('hil\0') != 4) {
throw("bad multi-arg typemap 2");
}
+if (t.ustrlen('hil\0') != 4) {
+ throw("bad multi-arg typemap 2");
+}
/*
* creating a raw char*
@@ -24,6 +31,9 @@ char_binary.pchar_setitem(pc, 4, 0);
if (t.strlen(pc) != 4) {
throw("bad multi-arg typemap (3)");
}
+if (t.ustrlen(pc) != 4) {
+ throw("bad multi-arg typemap (3)");
+}
char_binary.var_pchar = pc;
if (char_binary.var_pchar != "hola") {
diff --git a/Examples/test-suite/javascript/empty_c_runme.js b/Examples/test-suite/javascript/empty_c_runme.js
new file mode 100644
index 00000000000..1cc22e4ce76
--- /dev/null
+++ b/Examples/test-suite/javascript/empty_c_runme.js
@@ -0,0 +1 @@
+var empty_c = require("empty_c");
diff --git a/Examples/test-suite/keyword_rename_c.i b/Examples/test-suite/keyword_rename_c.i
new file mode 100644
index 00000000000..9c32942712a
--- /dev/null
+++ b/Examples/test-suite/keyword_rename_c.i
@@ -0,0 +1,7 @@
+/*
+ * Test reserved keyword renaming
+ */
+
+%module keyword_rename_c
+
+%include "keyword_rename.i"
diff --git a/Examples/test-suite/li_attribute_template.i b/Examples/test-suite/li_attribute_template.i
index 3d4c108efcc..28551c2cfc0 100644
--- a/Examples/test-suite/li_attribute_template.i
+++ b/Examples/test-suite/li_attribute_template.i
@@ -27,38 +27,38 @@
struct C
{
C(int a, int b, int c) :
- _a(a), _b(b), _c(c), _d(a), _e(b),
+ a(a), b(b), c(c), d(a), _e(b),
_f(a,b), _g(b,c)
{
/*
- _f.first = _a;
- _f.second = _b;
+ _f.first = a;
+ _f.second = b;
- _g.first = _b;
- _g.second = _c;
+ _g.first = b;
+ _g.second = c;
*/
}
int get_value() const
{
- return _a;
+ return a;
}
void set_value(int aa)
{
- _a = aa;
+ a = aa;
}
/* only one ref method */
int& get_ref()
{
- return _b;
+ return b;
}
- Foo get_class_value() const { return _d; }
- void set_class_value( Foo foo) { _d = foo; }
+ Foo get_class_value() const { return d; }
+ void set_class_value( Foo foo) { d = foo; }
const Foo& get_class_ref() const { return _e; }
void set_class_ref( const Foo& foo ) { _e = foo; }
@@ -73,10 +73,10 @@
void set_string(std::string other) { str = other; }
private:
- int _a;
- int _b;
- int _c;
- Foo _d;
+ int a;
+ int b;
+ int c;
+ Foo d;
Foo _e;
pair _f;
pair _g;
diff --git a/Examples/test-suite/li_boost_array.i b/Examples/test-suite/li_boost_array.i
new file mode 100644
index 00000000000..be51d15e081
--- /dev/null
+++ b/Examples/test-suite/li_boost_array.i
@@ -0,0 +1,85 @@
+%module li_boost_array
+
+#if defined(SWIGPYTHON) || defined(SWIGRUBY)
+
+// Hack to use the std::array support for boost::array.
+// Is limited as it currently exposes some 'using' bugs in SWIG though.
+// For example, the type system fails to see that pointers to std::array
+// and pointers to boost::array are the same.
+
+%{
+#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1900)
+// Use C++11 array as this is unfortunately sometimes included by
+#include
+namespace boost {
+ using std::array;
+}
+#else
+#include
+namespace std {
+ using boost::array;
+}
+#endif
+%}
+namespace boost {
+ using std::array;
+}
+
+%include
+
+%template(ArrayInt6) std::array;
+
+%inline %{
+boost::array arrayOutVal() {
+ const signed char carray[] = { -2, -1, 0, 0, 1, 2 };
+ boost::array myarray;
+ for (size_t i=0; i<6; ++i) {
+ myarray[i] = carray[i];
+ }
+ return myarray;
+}
+
+boost::array & arrayOutRef() {
+ static boost::array a = { -2, -1, 0, 0, 1, 2 };
+ return a;
+}
+
+const boost::array & arrayOutConstRef() {
+ static boost::array a = { -2, -1, 0, 0, 1, 2 };
+ return a;
+}
+
+boost::array * arrayOutPtr() {
+ static boost::array a = { -2, -1, 0, 0, 1, 2 };
+ return &a;
+}
+
+boost::array arrayInVal(boost::array myarray) {
+ for (boost::array::iterator it = myarray.begin(); it!=myarray.end(); ++it) {
+ *it *= 10;
+ }
+ return myarray;
+}
+
+const boost::array & arrayInConstRef(const boost::array & myarray) {
+ static boost::array a = myarray;
+ for (boost::array::iterator it = a.begin(); it!=a.end(); ++it) {
+ *it *= 10;
+ }
+ return a;
+}
+
+void arrayInRef(boost::array & myarray) {
+ for (boost::array::iterator it = myarray.begin(); it!=myarray.end(); ++it) {
+ *it *= 10;
+ }
+}
+
+void arrayInPtr(boost::array * myarray) {
+ for (boost::array::iterator it = myarray->begin(); it!=myarray->end(); ++it) {
+ *it *= 10;
+ }
+}
+%}
+
+#endif
diff --git a/Examples/test-suite/li_boost_shared_ptr.i b/Examples/test-suite/li_boost_shared_ptr.i
index 3d474ec0034..b64197be1ab 100644
--- a/Examples/test-suite/li_boost_shared_ptr.i
+++ b/Examples/test-suite/li_boost_shared_ptr.i
@@ -1,7 +1,7 @@
// This tests shared_ptr is working okay. It also checks that there are no memory leaks in the
// class that shared_ptr is pointing via a counting mechanism in the constructors and destructor of Klass.
// In order to test that there are no leaks of the shared_ptr class itself (as it is created on the heap)
-// the runtime tests can be run for a long time to monitor memory leaks using memory monitor tools
+// the runtime tests can be run for a long time to monitor memory leaks using memory monitor tools
// like 'top'. There is a wrapper for shared_ptr in shared_ptr_wrapper.h which enables one to
// count the instances of shared_ptr. Uncomment the SHARED_PTR_WRAPPER macro to turn this on.
//
@@ -11,6 +11,16 @@
%warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK);
+#if defined(SWIGSCILAB)
+%rename(MbrVar) MemberVariables;
+%rename(MbrVal) MemberVariables::MemberValue;
+%rename(MbrPtr) MemberVariables::MemberPointer;
+%rename(MbrRef) MemberVariables::MemberReference;
+%rename(SmartMbrVal) MemberVariables::SmartMemberValue;
+%rename(SmartMbrPtr) MemberVariables::SmartMemberPointer;
+%rename(SmartMbrRef) MemberVariables::SmartMemberReference;
+#endif
+
%inline %{
#include "boost/shared_ptr.hpp"
#include "swig_examples_lock.h"
@@ -34,7 +44,7 @@
# define SWIG_SHARED_PTR_NAMESPACE SwigBoost
#endif
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
@@ -93,7 +103,7 @@ struct Klass {
static int getTotal_count() { return total_count; }
private:
- // lock increment and decrement as a destructor could be called at the same time as a
+ // lock increment and decrement as a destructor could be called at the same time as a
// new object is being created - C# / Java, at least, have finalizers run in a separate thread
static SwigExamples::CriticalSection critical_section;
static void increment() { SwigExamples::Lock lock(critical_section); total_count++; if (debug_shared) cout << " ++xxxxx Klass::increment tot: " << total_count << endl;}
@@ -104,15 +114,15 @@ private:
};
SwigExamples::CriticalSection Space::Klass::critical_section;
-struct IgnoredMultipleInheritBase {
+struct IgnoredMultipleInheritBase {
IgnoredMultipleInheritBase() : d(0.0), e(0.0) {}
- virtual ~IgnoredMultipleInheritBase() {}
- double d;
+ virtual ~IgnoredMultipleInheritBase() {}
+ double d;
double e;
- virtual void AVirtualMethod() {}
+ virtual void AVirtualMethod() {}
};
-// For most compilers, this use of multiple inheritance results in different derived and base class
+// For most compilers, this use of multiple inheritance results in different derived and base class
// pointer values ... for some more challenging tests :)
struct KlassDerived : IgnoredMultipleInheritBase, Klass {
KlassDerived() : Klass() {}
@@ -254,7 +264,7 @@ long use_count(const SwigBoost::shared_ptr& sptr) {
long use_count(const SwigBoost::shared_ptr& sptr) {
return sptr.use_count();
}
-const SwigBoost::shared_ptr& ref_1() {
+const SwigBoost::shared_ptr& ref_1() {
static SwigBoost::shared_ptr sptr;
return sptr;
}
@@ -331,10 +341,15 @@ template struct Base {
T2 baseVal2;
Base(T1 t1, T2 t2) : baseVal1(t1*2), baseVal2(t2*2) {}
virtual std::string getValue() const { return "Base<>"; };
+ virtual ~Base() {}
};
%}
+#if !defined(SWIGSCILAB)
%template(BaseIntDouble) Base;
+#else
+%template(BaseIDbl) Base;
+#endif
%inline %{
template struct Pair : Base {
@@ -356,9 +371,9 @@ SwigBoost::shared_ptr< Pair > pair_id1(SwigBoost::shared_ptr< Pair<
%inline %{
namespace SwigBoost {
const int NOT_COUNTING = -123456;
- int shared_ptr_wrapper_count() {
+ int shared_ptr_wrapper_count() {
#ifdef SHARED_PTR_WRAPPER
- return SwigBoost::SharedPtrWrapper::getTotalCount();
+ return SwigBoost::SharedPtrWrapper::getTotalCount();
#else
return NOT_COUNTING;
#endif
diff --git a/Examples/test-suite/li_boost_shared_ptr_attribute.i b/Examples/test-suite/li_boost_shared_ptr_attribute.i
index c4d3dca360e..f15baa69373 100644
--- a/Examples/test-suite/li_boost_shared_ptr_attribute.i
+++ b/Examples/test-suite/li_boost_shared_ptr_attribute.i
@@ -1,6 +1,6 @@
%module li_boost_shared_ptr_attribute
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
diff --git a/Examples/test-suite/li_boost_shared_ptr_bits.i b/Examples/test-suite/li_boost_shared_ptr_bits.i
index 2232b6cf6e3..b61fd2aa60f 100644
--- a/Examples/test-suite/li_boost_shared_ptr_bits.i
+++ b/Examples/test-suite/li_boost_shared_ptr_bits.i
@@ -1,6 +1,6 @@
%module li_boost_shared_ptr_bits
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
@@ -128,5 +128,91 @@ HiddenDestructor::~HiddenDestructor()
delete impl_;
}
%}
+
+////////////////////////////
+// As above but private instead of protected destructor
////////////////////////////
+#if defined(SHARED_PTR_WRAPPERS_IMPLEMENTED)
+
+%shared_ptr(HiddenPrivateDestructor)
+
+#endif
+
+
+%inline %{
+class HiddenPrivateDestructor {
+private:
+ HiddenPrivateDestructor() {}
+ virtual ~HiddenPrivateDestructor() {
+ DeleteCount++;
+ }
+
+ class Deleter {
+ public:
+ void operator()(HiddenPrivateDestructor *hidden) {
+ delete hidden;
+ }
+ };
+
+public:
+ static boost::shared_ptr create() {
+ boost::shared_ptr hidden( new HiddenPrivateDestructor(), HiddenPrivateDestructor::Deleter() );
+ return hidden;
+ }
+ static int DeleteCount;
+};
+
+int HiddenPrivateDestructor::DeleteCount = 0;
+%}
+
+/////////////////////////////////////////////////
+// Non-public inheritance and shared_ptr
+/////////////////////////////////////////////////
+
+#if defined(SHARED_PTR_WRAPPERS_IMPLEMENTED)
+%shared_ptr(Base)
+// No %shared_ptr(DerivedPrivate1) to check Warning 520 does not appear
+// No %shared_ptr(DerivedProtected1) to check Warning 520 does not appear
+%shared_ptr(DerivedPrivate2)
+%shared_ptr(DerivedProtected2)
+
+%ignore Base2;
+%shared_ptr(DerivedPublic)
+#endif
+
+%inline %{
+class Base {
+public:
+ virtual int b() = 0;
+ virtual ~Base() {}
+};
+
+class DerivedProtected1 : protected Base {
+public:
+ virtual int b() { return 20; }
+};
+class DerivedPrivate1 : private Base {
+public:
+ virtual int b() { return 20; }
+};
+
+class DerivedProtected2 : protected Base {
+public:
+ virtual int b() { return 20; }
+};
+class DerivedPrivate2 : private Base {
+public:
+ virtual int b() { return 20; }
+};
+
+class Base2 {
+public:
+ virtual int b2() = 0;
+ virtual ~Base2() {}
+};
+class DerivedPublic : public Base2 {
+public:
+ virtual int b2() { return 20; }
+};
+%}
diff --git a/Examples/test-suite/li_boost_shared_ptr_template.i b/Examples/test-suite/li_boost_shared_ptr_template.i
index c1cd32ec623..e3b735c2421 100644
--- a/Examples/test-suite/li_boost_shared_ptr_template.i
+++ b/Examples/test-suite/li_boost_shared_ptr_template.i
@@ -15,6 +15,7 @@
class Base {
public:
virtual T bar() {return 1;}
+ virtual ~Base() {}
};
template
@@ -29,7 +30,7 @@
%}
-#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD)
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGD) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#define SHARED_PTR_WRAPPERS_IMPLEMENTED
#endif
@@ -79,6 +80,7 @@ template
class BaseDefault {
public:
virtual T bar2() {return 3;}
+ virtual ~BaseDefault() {}
};
template
diff --git a/Examples/test-suite/li_carrays_cpp.i b/Examples/test-suite/li_carrays_cpp.i
new file mode 100644
index 00000000000..c4743420ef2
--- /dev/null
+++ b/Examples/test-suite/li_carrays_cpp.i
@@ -0,0 +1,28 @@
+%module li_carrays_cpp
+
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) doubleArray; /* Ruby, wrong class name */
+
+%include
+
+%array_functions(int,intArray);
+%array_class(double, doubleArray);
+
+%inline %{
+typedef struct {
+ int x;
+ int y;
+} XY;
+XY globalXYArray[3];
+
+typedef struct {
+ int a;
+ int b;
+} AB;
+
+AB globalABArray[3];
+%}
+
+// Note that struct XY { ... }; gives compiler error for C when using %array_class or %array_functions, but is okay in C++
+%array_class(XY, XYArray)
+%array_functions(AB, ABArray)
+
diff --git a/Examples/test-suite/li_cdata_carrays_cpp.i b/Examples/test-suite/li_cdata_carrays_cpp.i
new file mode 100644
index 00000000000..9a88b84807d
--- /dev/null
+++ b/Examples/test-suite/li_cdata_carrays_cpp.i
@@ -0,0 +1,8 @@
+%module li_cdata_carrays_cpp
+
+%include
+%array_class(int, intArray);
+
+%include
+
+%cdata(int);
diff --git a/Examples/test-suite/li_cdata_cpp.i b/Examples/test-suite/li_cdata_cpp.i
new file mode 100644
index 00000000000..2d7d300e421
--- /dev/null
+++ b/Examples/test-suite/li_cdata_cpp.i
@@ -0,0 +1,8 @@
+%module li_cdata_cpp
+
+%include
+
+%cdata(int);
+%cdata(double);
+
+void *malloc(size_t size);
diff --git a/Examples/test-suite/li_cpointer_cpp.i b/Examples/test-suite/li_cpointer_cpp.i
new file mode 100644
index 00000000000..869ce6e6969
--- /dev/null
+++ b/Examples/test-suite/li_cpointer_cpp.i
@@ -0,0 +1,10 @@
+%module li_cpointer_cpp
+
+%warnfilter(SWIGWARN_RUBY_WRONG_NAME) doublep; /* Ruby, wrong class name */
+
+%include "cpointer.i"
+
+%pointer_functions(int,intp);
+%pointer_class(double,doublep);
+%pointer_cast(int, unsigned int, int_to_uint);
+
diff --git a/Examples/test-suite/li_std_auto_ptr.i b/Examples/test-suite/li_std_auto_ptr.i
index 627572d5cb7..5fdc5fa3577 100644
--- a/Examples/test-suite/li_std_auto_ptr.i
+++ b/Examples/test-suite/li_std_auto_ptr.i
@@ -1,7 +1,7 @@
%module li_std_auto_ptr
%{
-#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // auto_ptr deprecation
#endif
%}
diff --git a/Examples/test-suite/li_std_combinations.i b/Examples/test-suite/li_std_combinations.i
index 57f945bcd1e..e28950835f0 100644
--- a/Examples/test-suite/li_std_combinations.i
+++ b/Examples/test-suite/li_std_combinations.i
@@ -9,15 +9,23 @@
%template(PairIntString) std::pair;
%template(VectorPairIntString) std::vector< std::pair >;
-%template(PairIntVectorString) std::pair< int, std::vector >;
-
%template(VectorVectorString) std::vector< std::vector >;
+
+#if !defined(SWIGSCILAB)
+%template(PairIntVectorString) std::pair< int, std::vector >;
%template(PairIntPairIntString) std::pair< int, std::pair >;
+#else
+%template(PairIntVecStr) std::pair< int, std::vector >;
+%template(PairIntPairIntStr) std::pair< int, std::pair >;
+#endif
+
#if defined(SWIGCSHARP) || defined(SWIGD)
// Checks macro containing a type with a comma
SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >)
#endif
+
%template(PairDoubleString) std::pair< double, std::string >;
%template(VectorPairDoubleString) std::vector< std::pair >;
+
diff --git a/Examples/test-suite/li_std_container_typemaps.i b/Examples/test-suite/li_std_container_typemaps.i
new file mode 100644
index 00000000000..9da32ef8d6e
--- /dev/null
+++ b/Examples/test-suite/li_std_container_typemaps.i
@@ -0,0 +1,132 @@
+%module li_std_container_typemaps
+
+%include stl.i
+%include std_list.i
+%include std_deque.i
+%include std_set.i
+%include std_multiset.i
+
+%{
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+using namespace std;
+%}
+
+%inline %{
+class ClassA
+{
+public:
+ ClassA() : a(0) {}
+ ClassA(int _a) : a(_a) {}
+ ClassA(const ClassA& c) : a(c.a) {}
+ int a;
+};
+
+typedef ClassA* ClassAPtr;
+
+enum _Color { RED=1, GREEN=10, YELLOW=11, BLUE=100, MAGENTA=101, CYAN=111 };
+typedef enum _Color Color;
+
+namespace std {
+ template T binaryOperation(T x, T y) {
+ return static_cast(x + y);
+ }
+
+ template<> bool binaryOperation(bool x, bool y) {
+ return x | y;
+ }
+
+ template<> ClassAPtr binaryOperation(ClassAPtr x, ClassAPtr y) {
+ if (x)
+ y->a += x->a;
+ return y;
+ }
+
+ template