diff --git a/.gitignore b/.gitignore
index e94087e29..1f1561475 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,6 +66,7 @@ CCache/ccache_swig_config.h
CCache/config.h
CCache/config.log
CCache/config.status
+CCache/config_win32.h
Examples/Makefile
Examples/d/example.mk
Examples/guile/Makefile
@@ -85,6 +86,8 @@ swig.spec
# Build Artifacts
.dirstamp
CCache/ccache-swig
+CCache/ccache-swig.1
+CCache/web/ccache-swig-man.html
Lib/swigwarn.swg
Source/CParse/parser.c
Source/CParse/parser.h
@@ -149,11 +152,24 @@ Examples/guile/*/my-guile
Examples/test-suite/java/*/
Examples/java/*/*.java
!Examples/java/*/runme.java
+Examples/java/doxygen/javadocs
# Javascript
Examples/test-suite/javascript/*/
*.gyp
+# OCaml
+Examples/test-suite/ocaml/*.ml*
+Examples/test-suite/ocaml/*.cm*
+Examples/test-suite/ocaml/*_runme
+!Examples/test-suite/ocaml/*runme.ml
+Examples/ocaml/**/example.ml*
+Examples/ocaml/**/runme
+Examples/ocaml/**/runme_top
+Examples/ocaml/**/*.cm*
+Examples/ocaml/**/swig.ml*
+Examples/ocaml/**/swigp4.ml
+
# Octave
swigexample*.oct
Examples/test-suite/octave/*.oct
@@ -177,11 +193,16 @@ Examples/php/*/example.php
/__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/**/example.py
Examples/python/**/foo.py
+Examples/python/**/robin.py
+Examples/python/**/runme3.py
Examples/python/**/spam.py
+Examples/python/import_packages/module_is_init/pkg1/__init__.py
+Examples/python/import_packages/namespace_pkg/path4.zip
+Examples/python/doxygen/example.html
# R
Examples/test-suite/r/*.R
diff --git a/.travis.yml b/.travis.yml
index ac97dc6b5..c9cbd7862 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,155 +4,404 @@ matrix:
- compiler: clang
os: linux
env: SWIGLANG=
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=
- - os: linux
- env: SWIGLANG= SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG= SWIG_CC=gcc-6 SWIG_CXX=g++-6
+ env: SWIGLANG= GCC=4.4
sudo: required
- dist: trusty
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.6
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.8
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=4.9
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=6
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=8
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG= GCC=9
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=csharp
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=d
- - compiler: gcc
- os: linux
- env: SWIGLANG=go
- - compiler: gcc
- os: linux
- env: SWIGLANG=go VER=1.5
sudo: required
- dist: trusty
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=go VER=1.3
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=go VER=1.8
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=go VER=1.12
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=guile
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=java
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=javascript ENGINE=node
+ env: SWIGLANG=javascript ENGINE=node VER=0.10
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=4 CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=6 CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=8 CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=jsc
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=javascript ENGINE=v8
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=lua VER=5.3
sudo: required
- dist: trusty
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 # 3.2
+ env: SWIGLANG=mzscheme
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 VER=3.8
+ env: SWIGLANG=ocaml
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.0
+ env: SWIGLANG=octave SWIGJOBS=-j2
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=perl5
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=php
+ env: SWIGLANG=php VER=7.0
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python VER=2.4
+ env: SWIGLANG=php VER=7.1
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python VER=2.5
+ env: SWIGLANG=php VER=7.2
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python VER=2.6
+ env: SWIGLANG=php VER=7.3
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python # 2.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python PY3=3 # 3.2
+ env: SWIGLANG=python PY3=3 VER=3.2
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.3
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.4
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python PY3=3 VER=3.5
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin VER=2.6
+ env: SWIGLANG=python PY3=3 VER=3.6
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3
+ env: SWIGLANG=python SWIG_FEATURES="-builtin -O"
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.4
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5 SWIGOPTPY3=
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7 SWIGOPTPY3=
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=python SWIG_FEATURES=-O
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=python SWIG_FEATURES=-classic
+ env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=r
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=ruby
+ env: SWIGLANG=ruby VER=1.9
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
- env: SWIGLANG=ruby VER=2.3.0
+ env: SWIGLANG=ruby VER=2.0
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.2
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.3
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.4
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.5
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=ruby VER=2.6
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=scilab
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=tcl
+ sudo: required
+ dist: xenial
- os: linux
- env: SWIGLANG=csharp SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=csharp CPP11=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=go VER=1.6 CPP11=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java CPP11=1
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=octave SWIGJOBS=-j2 VER=4.4 CPP11=1
sudo: required
dist: trusty
- os: linux
- env: SWIGLANG=java SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=python CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=python SWIG_CC=gcc-5 SWIG_CXX=g++-5 CPP11=1
+ env: SWIGLANG=r CPP11=1 # Note: making 'R CMD SHLIB' use a different compiler is non-trivial
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=csharp SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=ruby CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=java SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=tcl CPP11=1
sudo: required
- dist: trusty
+ dist: xenial
- os: linux
- env: SWIGLANG=python SWIG_CC=gcc-6 SWIG_CXX=g++-6 CPP14=1
+ env: SWIGLANG=csharp GCC=6 CPP14=1
sudo: required
- dist: trusty
- - os: osx
- env: SWIGLANG= SWIG_CC=gcc-4.2 SWIG_CXX=g++-4.2
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=go VER=1.6 GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=ruby GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=tcl GCC=6 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=7 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=7 CPP14=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=csharp GCC=8 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=8 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=csharp GCC=9 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=java GCC=9 CPP17=1
+ sudo: required
+ dist: xenial
+ - os: linux
+ env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.7
+ sudo: required
+ dist: xenial
+ - compiler: gcc
+ os: osx
+ env: SWIGLANG=
- compiler: clang
os: osx
env: SWIGLANG=
@@ -173,10 +422,10 @@ matrix:
env: SWIGLANG=lua
- compiler: clang
os: osx
- env: SWIGLANG=perl5
+ env: SWIGLANG=octave SWIGJOBS=-j2
- compiler: clang
os: osx
- env: SWIGLANG=php
+ env: SWIGLANG=perl5
- compiler: clang
os: osx
env: SWIGLANG=python
@@ -189,35 +438,54 @@ matrix:
- compiler: clang
os: osx
env: SWIGLANG=tcl
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=java CPP17=1
+ osx_image: xcode10.2
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=python PY3=3 CPP17=1
+ osx_image: xcode10.2
allow_failures:
- # Lots of failing tests currently
+ # seg fault in director_basic testcase
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=php VER=7.2
+ sudo: required
+ dist: xenial
+ # Sometimes hits the Travis 50 minute time limit
+ - compiler: clang
+ os: osx
+ env: SWIGLANG=octave SWIGJOBS=-j2
+ # Experimental languages
+ - compiler: gcc
+ os: linux
+ env: SWIGLANG=mzscheme
+ sudo: required
+ dist: xenial
- compiler: gcc
os: linux
env: SWIGLANG=ocaml
- # Not quite working yet
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-O
+ sudo: required
+ dist: xenial
+
before_install:
- date -u
- uname -a
- 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
+ # Travis overrides CC environment with compiler predefined values
+ - if test -n "$GCC"; then export CC="gcc-$GCC" && export CXX="g++-$GCC"; 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
+ - ls -la $(which $CC) $(which $CXX) && $CC --version && $CXX --version
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
+ - 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
+ - if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing --without-maximum-compile-warnings "CXXFLAGS=-std=c++17 -Wall -Wextra" "CFLAGS=-std=c17 -Wall -Wextra") && export CSTD=c17 && export CPPSTD=c++17; fi
- if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
- echo "${CONFIGOPTS[@]}"
- ./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
@@ -239,6 +507,3 @@ script:
- echo 'Cleaning...' && echo -en 'travis_fold:start:script.3\\r'
- make check-maintainer-clean && ../../configure $CONFIGOPTS
- echo -en 'travis_fold:end:script.3\\r'
-branches:
- only:
- - master
diff --git a/ANNOUNCE b/ANNOUNCE
index 53c5bbc59..b83921cc4 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,8 +1,8 @@
-*** ANNOUNCE: SWIG 3.0.11 (in progress) ***
+*** ANNOUNCE: SWIG 4.0.1 (in progress) ***
http://www.swig.org
-We're pleased to announce SWIG-3.0.11, the latest SWIG release.
+We're pleased to announce SWIG-4.0.1, the latest SWIG release.
What is SWIG?
=============
@@ -10,13 +10,11 @@ What is SWIG?
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, 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.
+PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme), D,
+Ocaml, Octave, R, Scilab. SWIG can also export its parse tree in
+the form of XML. 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
=============
@@ -27,11 +25,11 @@ Availability
============
The release is available for download on Sourceforge at
- http://prdownloads.sourceforge.net/swig/swig-3.0.11.tar.gz
+ http://prdownloads.sourceforge.net/swig/swig-4.0.1.tar.gz
A Windows version is also available at
- http://prdownloads.sourceforge.net/swig/swigwin-3.0.11.zip
+ http://prdownloads.sourceforge.net/swig/swigwin-4.0.1.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 67fd3f363..d1bb8c526 100644
--- a/CCache/Makefile.in
+++ b/CCache/Makefile.in
@@ -8,6 +8,7 @@ bindir=@bindir@
mandir=@mandir@
INSTALLCMD=@INSTALL@
PACKAGE_NAME=@PACKAGE_NAME@
+PROGRAM_NAME=@PROGRAM_NAME@
# Soft link test can be skipped on systems that don't support soft linking
NOSOFTLINKSTEST=
@@ -17,13 +18,10 @@ SWIG=swig
SWIG_LIB=../$(srcdir)/../Lib
EXEEXT=@EXEEXT@
-# Use standard autoconf approach to transform executable name using --program-prefix and --program-suffix
-transform = @program_transform_name@
-
LIBS= @LIBS@
OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \
cleanup.o snprintf.o unify.o
-HEADERS = ccache.h mdfour.h
+HEADERS = ccache.h mdfour.h config.h config_win32.h
all: $(PACKAGE_NAME)$(EXEEXT)
@@ -32,7 +30,7 @@ Makefile: $(srcdir)/Makefile.in ./config.status
$(SHELL) ./config.status
# Note that HTML documentation is actually generated and used from the main SWIG documentation Makefile
-docs: $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/ccache-man.html
+docs: $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
$(PACKAGE_NAME)$(EXEEXT): $(OBJS) $(HEADERS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
@@ -40,40 +38,43 @@ $(PACKAGE_NAME)$(EXEEXT): $(OBJS) $(HEADERS)
$(srcdir)/$(PACKAGE_NAME).1: $(srcdir)/ccache.yo
-yodl2man -o $(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
+$(srcdir)/web/$(PACKAGE_NAME)-man.html: $(srcdir)/ccache.yo
+ yodl2html -o $(srcdir)/web/$(PACKAGE_NAME)-man.html $(srcdir)/ccache.yo
install: $(PACKAGE_NAME)$(EXEEXT)
@echo "Installing $(PACKAGE_NAME)"
- @echo "Installing $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)"
+ @echo "Installing $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)"
${INSTALLCMD} -d $(DESTDIR)${bindir}
- ${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+ ${INSTALLCMD} -m 755 $(PACKAGE_NAME)$(EXEEXT) $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)
install-docs: $(srcdir)/$(PACKAGE_NAME).1
- @echo "Installing $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1"
+ @echo "Installing $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1"
${INSTALLCMD} -d $(DESTDIR)${mandir}/man1
- ${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
+ ${INSTALLCMD} -m 644 $(srcdir)/$(PACKAGE_NAME).1 $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1
uninstall: $(PACKAGE_NAME)$(EXEEXT)
- rm -f $(DESTDIR)${bindir}/`echo $(PACKAGE_NAME) | sed '$(transform)'`$(EXEEXT)
+ rm -f $(DESTDIR)${bindir}/$(PROGRAM_NAME)$(EXEEXT)
uninstall-docs: $(srcdir)/$(PACKAGE_NAME).1
- rm -f $(DESTDIR)${mandir}/man1/`echo $(PACKAGE_NAME) | sed '$(transform)'`.1
+ rm -f $(DESTDIR)${mandir}/man1/$(PROGRAM_NAME).1
-clean:
+clean: clean-docs
/bin/rm -f $(OBJS) *~ $(PACKAGE_NAME)$(EXEEXT)
+clean-docs:
+ rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
+
test: test.sh
- SWIG_LIB='$(SWIG_LIB)' PATH=../..:$$PATH SWIG='$(SWIG)' CC='$(CC)' NOSOFTLINKSTEST='$(NOSOFTLINKSTEST)' $(srcdir)/test.sh
+ SWIG_LIB='$(SWIG_LIB)' PATH=../..:$$PATH SWIG='$(SWIG)' CC='$(CC)' NOSOFTLINKSTEST='$(NOSOFTLINKSTEST)' CCACHE='../$(PACKAGE_NAME)' CCACHE_PROG=$(PROGRAM_NAME) $(srcdir)/test.sh
check: test
distclean: clean
- /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h
+ /bin/rm -f Makefile config.h config.sub config.log build-stamp config.status ccache_swig_config.h config_win32.h
/bin/rm -rf autom4te.cache
maintainer-clean: distclean
- /bin/rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/ccache-man.html
+ /bin/rm -f $(srcdir)/$(PACKAGE_NAME).1 $(srcdir)/web/$(PACKAGE_NAME)-man.html
# FIXME: To fix this, test.sh needs to be able to take ccache from the
diff --git a/CCache/ccache.h b/CCache/ccache.h
index a79d88322..25e786496 100644
--- a/CCache/ccache.h
+++ b/CCache/ccache.h
@@ -6,7 +6,7 @@
#include "config.h"
#else
#include This is a technical overview of the C++0x/C++11 support for the Swig.
-This area of Swig is a work in progress. Initial C++0x/C++11 support for
-Swig was written during the Google Summer of Code 2009 period by
-MatevĹľ Jekovec. branches/gsoc2009-matevz Wikipedia article: http://en.wikipedia.org/wiki/C%2B%2B0x
- The Rvalues are used in practice to speed up the move operations
-on different containers. In the following example, we want to swap the given elements:
-This can now be solved using the new function std::move():
-For the move function to take effect, user needs to reimplement the
-move constructor (taking ClassType&& as an argument) and
-operator=(ClassType&&):
-In practice, the Rvalues are used for temporaries (when passing the
-result of one function as an argument to another). Done: Added type&& to Swig parser. Added testcase
-cpp11_rvalue_reference.i. Operator && is treated the same as
-operator &. R11450 Article:
-http://www.artima.com/cppsource/rvalue.html In C++11 you can define functions as constant expressions.
-Functions need to return constant value in form "return expr",
-where expr is a constant expression.
- A keyword "constexpr" is introduced for this. eg.:
-constexpr int getNumber() { return 5; } const int MY_CONSTANT =
-getNumber();
- Constants are treated as normal variables in interpreted languages
-because they are not compiled into the executable. Java "final"
-constants are defined runtime as well. C++ constants need to be
-declared in the header file and defined in the implementation file,
-so swig doesn't need to know about the constant values when parsing
-the header file.
- Done: Added the “constexpr “ keyword to Swig. Added testcase
-cpp11_constexpr. R11322 Problem: No compilers were known to support constexpr yet, so the
-testcase was temporarily commented out in common.mk.
- Extern template forces the GCC compiler to not instantiate the
-template in the translation unit at that time. It's a feature
-specifically aimed at compilers to speed up the compilation process.
- Done: Added support for 'extern template class
-std::vector<MyClass>;'. Added testcase cpp11_template_explicit.
-R11385 , R11386 Initializer list is a new type in standard library:
-std::initializer_list<T>. New symbols {} are introduced for the
-initializer lists.
- One can now use:
-
-Languages like Java, C# and Python already support direct creation of
-lists natively. Problem: initializer_list cannot be treated as an ordinary list.
-The constructor containing initializer_list can only be accessed by
-assigning the value using the {} brackets. I also don't think there
-is a simple way to convert an ordinary list or a vector to the
-initializer_list. Done: Ignored the constructor having initializer_list as its
-argument. Show warning to the user. Added testcase
-cpp11_initializer_list. R11450 Article:
-http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1919.pdf The new C++11 standard will allow the following:
-The feature works exactly as it did now for POD types only (eg. int
-a[] = {1,2,3};). The following declarations are the same in the new
-C++11:
-The new way of using uniform initialization allows the following:
-The new syntax is specific to C++. Java, C# and scripting languages
-do not support this behaviour, but always need constructors. They
-support {} brackets for declaration of arrays as C does + they add
-support for creation of arrays on-the-fly (what C++11 introduced with
-this feature and more). Done: Added syntax for {} member initialization in class
-constructor. Added testcase cpp11_uniform_initialization. R11413 A new keyword 'auto' is introduced in C++11:
-The type of a1 and a2 is automatically determined according to the
-initialization value during the semantic phase of the compiler. Another macro 'decltype()' is introduced. The macro takes the
-concrete object as an argument and returns its type. User could use
-this as:
-Calling operators are allowed as well:
-Done: Added support for decltype() syntax. Test cases for normal
-decltype members and alternate function members work fine. Currently
-only syntax in form decltype(variable name) work. No support for
-custom expresions eg. decltype(i+j) yet. R11525 TODO: William proposed to support the hidden variables as well
-(ones not parsed by Swig and added to symbol table). This also allows
-Swig to parse custom expressions like decltype(i+j). The idea is to
-introduce a new SwigType for this. This feature is always present inside the implementation block
-only.
- C++11 introduces lambda functions defined as:
-If the lambda function contains a single return statement only or the
-function doesn't return any type, the return type '->' can be
-omitted. Lambda functions are function objects. The following example prints the number of items stored in a list:
-Parameters inside the [] are the visible parameters of the lambda
-functions. These can be & (references), = (copies), variable name
-(variable copy), &variable name (variable reference) or this
-(copy of the current object). Lambda functions can be stored using:
-Proposal: Lambda functions are most commonly used inside the function
-block to quickly define how the sort, find and similar functions
-should work (the other way would be overriding a class – the Java
-style). The latest GCC does not support lambda functions yet so it is
-difficult to test the feature once implemented. I would implement the
-syntax support for this feature, but produce no wrapper code. Lambda
-functions still work inside the function block though. Article:
-http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2550.pdf Done: Added syntax support for the lambda functions. Added
-testcase cpp11_lambda_functions.i. R11491, R11492 The problem with decltype() is that the parameters need to be
-defined before the decltype. The following syntax is not valid,
-because lhs and rhs hasn't been defined at the time of decltype:
-The solution C++11 offers is the combination of the 'auto' keyword
-before and '-> rettype' after the function declaration:
-The new syntax only makes the job for the C++ compilers easier when
-parsing such functions. The new syntax can be used for ordinary
-functions as well:
-Done: Added support for the 'auto' return type. Added support for the
-'-> type' after the funtion declaration. Added testcases
-cpp11_alternate_function_syntax.i and
-cpp11_alternate_function_syntax_runme.py. R11414 In C++ there is a common problem when you use a template in the
-class which doesn't support all the operations the functions in the
-class actually do on the type. Compiler errors are usually very long
-and unreadable. C++11 adds support for the "concepts". The
-idea is to define what operations and attributes should the template
-have. In contrast to class inheritance and polimorphism, all lookups
-are done in compile-time.
- Basic syntax (note LessThanComparable?
-instead of "class" or "typename"):
-
-Extended syntax (requires conditions are separated with &&,
-|| or !):
-
-Definition of the concepts:
-
-Concept maps allow usage of a specific type:
-
-Concept maps can act as mini-types, with function definitions and
-other constructs commonly associated with classes:
-
-Axioms are a facility pertaining to concepts supplied by C++11 to
-express the semantic properties of concepts. For example, the concept
-Semigroup can be defined with an axiom Associativity as:
-
-Axioms are more like hints to the compiler to speed-up the process of
-compilation.
- Ignored: Concepts and axioms were removed from the C++11 standard.
- This feature allows classes constructors to call other
-constructors with different arguments (similar to Java and C#
-behaviour).
- The syntax is as follows:
-
-Also when using the inheritance, the feature introduces inheritance
-of all superclass constructors without being defined separately in
-the inherited class:
-
-Swig already correctly parses and produces the correct wrapper for
-the “using” keyword. Done: Added testcase cpp11_constructors.i which covers both
-constructor delegation and constructor inheritance. R11532 Problem: Constructor delegation and constructor inheritance is not
-supported by any compiler yet, so it's impossible to try and test
-this feature. nullptr is part of the standard library.
- It's defined as typedef decltype(nullptr) nullptr_t;
- nullptr_t is defined in <cstddef>.
- As far as the C++ is compatible with 0 as the pointer value, swig
-values will work for the C++. And the other way around, nullptr
-behaves as the ordinary pointer (false, if empty, true, if not
-empty), so it's ok for swig to compare it. Done: Written a testcase cpp11_null_pointer_constant.i and
-cpp11_null_pointer_constant_runme.py to prove the nullptr
-functionality. R11484 C++11 introduces a new syntax for strongly typed enum declaration:
-
-Typing if (Val4 == 101) will result in compilation error.
- The enum itself can now be explicitely of type int, long, unsigned
-int etc.:
-
-And it can be forward declared as well:
-
-Done: Added syntax 'enum class Name' and forward declarators 'enum
-Name : inherited type' or 'enum class Name : inherited type' in
-R11449. TODO: Add semantic support for enum elements not clashing with
-enum elements in other enum classes. See cpp11_strongly_typed_enums.i
-warnings. Problem: Swig currently doesn't support nested classes. This
-feature should be implemented using a new nested class when using
-“enum class” with a single anonymous “enum {elements}”
-element inside. For example:
-should be mapped to Support for right angled brackets was implemented using the
-following article as a base:
-http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
- Done: Added support for angle brackets. Used the preferred
-"Approach 1". Added a testcase named
-cpp11_template_double_brackets. R11245 This is used when converting one type to another (eg. if
-(myObject) {}, where myObject is your custom class converted to
-bool).
- Requires both operator and function overloading which is not
-supported in any target language (eg. python, php).
- Done: Swig already supports the keyword "explicit" for
-function types as well. Added test case
-cpp11_explicit_conversion_operators. R11323 The new C++11 will allow creation of wrapper around the template.
-For example, if we want to do this:
-This is still illegal! But we can now use the new syntax for
-achieving the same effect:
-Here we created a new wrapper TypedefName taking one template
-argument <second> which creates a type SomeType<OtherType,
-second, 5>. OtherType and 5 are predefined here and hidden from
-the user – the user only uses TypedefName type. The same goes for the following example:
-Swig supports parsing typedefs for templates as well for example:
-Done: Expanded support for the new 'using' syntax and template
-aliasing. Added testcase cpp11_template_typedefs. R11533 TODO: Make Swig aware of the newly defined typedef. The TYPEDEF
-keyword is part of the storage_class rule and type+declarator (see
-c_decl rule) is the right part of the definition – for example void
-(*PFD)(double) cannot be transformed to void *(double) easily. To
-fully support the new 'using' form, we'll probably have to change the
-type, type_right rules and declarator, direct_declarator,
-notso_direct_declarator etc., which is PITA. C++ currently offers usage of unions for types with trivial
-constructors only. The new C++11 standard allows usage of types with
-non-trivial constructors as well:
-Swig already parses the given syntax. Done: Added testcase cpp11_unrestricted_unions. R11435, R11447 Problem: GCC doesn't support unrestricted unions yet so there is
-no way to actually test, if it works. The new C++11 offers the following syntax:
-This can be used for example:
-The ... is used in two cases. One is in the template header where it
-marks on the left the keywords 'typename' or 'class' and a type name
-on the right. The second case is usually in the function block to
-decompose typename on the left of the ... . For example:
-The tricky part is that variadic templates can unpack actually
-anywhere – including the class inheritance :(
-A new extension to sizeof is also introduced with this feature. The
-... after sizeof returns number of arguments:
-Done: Added syntax support for 'typename' or 'class' + ... + id.
-Added testcase cpp11_variadic_templates. R11458 Done: Added syntax support for BaseClass + ..., type + ... + id in
-parameters and baseclass + ... for intializers after constructor.
-Extended Swig syntax to support sizeof...(Args). R11467 Done: Fixed %template to support variadic number of templates. TODO: Only (if present) first variadically defined argument is
-currently used in %template directive. The next ones are ignored. Beside the implementation, the new C++11 Unicode and custom
-delimeter constants can occur in templates in the header file.
- Done: Added symbols 'u', 'u8' and 'U' to mark the beginning of the
-UTF string. Also added test case cpp11_raw_string_literals. R11327 Done: Added R"DELIMITER[, ]DELIMITER" for a custom
-delimiter for the beginning/end of the string. R11328 TODO: Fix the Swig's C++ preprocessor bug when parsing an odd
-number of “ inside the string brackets. See
-Source/Preprocessor/cpp.c. C++ has different suffix literals. eg. 12.5f marks the number 12.5
-as float.
- C++11 allows user to define his own suffix for the strings always
-starting with the underscore (_). eg. int a = "hello"_mySuffix;
- The syntax is similar to other operator overloading functions:
-
-The null terminated const char* is the string between the "".
-The _mySuffix is the name of the suffix operator. And the OutputType
-is the outputType the operator returns.
- Other forms are:
-
-Another possibility is to use variadic templates:
-
-This instantiates the literal processing function as
-operator""_Suffix<'1', '2', '3', '4'>. In this form,
-there is no terminating null character to the string. The main
-purpose to doing this is to use C++11's constexpr keyword and the
-compiler to allow the literal to be transformed entirely at compile
-time, assuming OutputType is a constexpr-constructable and copyable
-type, and the literal processing function is a constexpr function. Article:
-http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf Done: Added syntax support for userdefined literals. Added
-testcase cpp11_userdefined_literals.i. R11494 TODO: %rename doesn't parse operator”” yet. New C++11 introduces keyword "thread_local" which marks
-the following variable dynamically located depending on the current
-thread when using the address-of (&) operator.
- Syntax:
-
-Done: Add "thread_local" keyword to Swig. Added testcase
-cpp11_thread_local. R11393 C++ automatically creates default constructor with empty
-parameters, copy constructor, operator= and destructor for any class.
-Sometimes user wants to explicitly remove one of them or enable them
-(eg. default constructor with empty parameters doesn't work any more,
-if any other constructor is defined).
- Words "default" and "delete" are introduced.
-The syntax is similar to declaration of pure virtual function:
-
-User has the ability by using keyword delete to disallow calling of
-the standard functions brought by C++ itself.
-
-Ignored: Swig already parses the keywords "= delete" and "=
-default". These keywords are used for built-in functions (copy
-constructor, operator= etc.), which are ignored by Swig anyway. Done: Added testcase cpp11_default_delete. R11535 Type long long int is an integer type that has at least 64 useful
-bits. C99 added it to its standard, but the C++ didn't adopt it until
-C++11. Most C++ compilers supported it though.
- Done: Swig already parses the C code including the long long type.
- static_assert() can be used at class scope as well eg.:
-
-Done: Added syntax support for "static_assert()". Added
-test case cpp11_static_assert. R11369 C++11 allows calls of sizeof to concrete objects as well:
-
-This kind of syntax is already supported by Swig. Done: Added testcase cpp11_sizeof_objects. R11538
- C++11 will add the following classes to the standard library:
-
-Ignored: No changes to the language itself is made.
- Tuple is array of various types. C++11 introduced this feature
-using variadic templates. Tuple is defined as:
-Constructor is automatically generated filling the tuple elements.
-get<X> function is introduced to get the Xth element in the
-tuple.
-Tuples can be copied to each other, if all the elements are copiable:
-TODO: Implement wrappers for the tuplet<> class. C++11 introduces the "unordered" version of existing
-types, which in practice work faster than the linear types:
-
-Swig should use the "unordered" types exactly the same as
-the original linear types. Problem: Unordered types do not contain exactly same members as
-ordered ones (eg. _Hashtable_iterator does not offer operator--() and
-constructor with compare function which is required). So simply
-aliasing unordered classes to ordered ones doesn't work. TODO: Implement wrappers for unordered_ types. Initial work is
-already done in Lib/std/unordered_*.i files. Two new classes are introduced in C++11: basic_regex and
-match_results. Both are defined in regex header file.
- Ignored: The new feature extends the standardy library only. No
-changes to Swig needed.
- This feature deprecates auto_ptr and adds shared_ptr, weak_ptr and
-unique_ptr to the standard library.
- This feature only adds the smart pointers to the standard library
-and doesn't effect the C++ syntax. Done: Added test case which uses all three smart pointers in the
-class. R11394 Problem: GCC standard library doesn't contain the new smart
-pointers yet.
- This feature standardize the pseudo random number algorithm
-(currently, the random number generator was dependent on the
-platform/compiler). It adds functions linear_congruential,
-subtract_with_carry and mersenne_twister and symbols
-uniform_int_distribution, bernoulli_distribution,
-geometric_distribution, poisson_distribution, binomial_distribution,
-uniform_real_distribution, exponential_distribution,
-normal_distribution and gamma_distribution to the standard library.
- Ignored: The new feature extends the standardy library only. No
-changes to Swig needed.
- This feature adds ref and cref classes to the standard library
-(#include <utility>) usually used in tempalte functions.
- Ignored: The new feature extends the standardy library only. No
-changes to Swig needed.
- Two features are introduced:
- The function template wrapper:
- and the function object:
-
-Swig already supports the two. Done: Added a runtime testcase for function objects
-cpp11_function_objects. R11419. C++11 adds a new header file <type_traits> which includes
-helper functions to determine the template type while initializing
-the object at compile time.
- Swig already supports the following code:
-
-Functions is_convertible, is_integral, is_integral_const etc. are
-part of the new header:
-
-Swig correctly parses the syntax for template<bool>,
-template<class T> and template<>.
- Ignored: Swig requires explicitly defined template class
-(%template directive) to export it to the target language. The template function is introduced: std::result_of() which
-depends on decltype:
-
-Swig correctly parses the result_of class. TODO: The return type (the result_of::type member) is not
-calculated by Swig. This needs a much more complex semantic parser. Done: Added testcase cpp11_result_of. R11534
@@ -155,7 +155,7 @@ SWIG directives. SWIG can be furnished with a header file, but an
interface can also be generated without library headers by supplying a
simple text file--called the interface file, which is typically named
with a .i extension--containing any foreign declarations of
-identifiers you wish to use. The most common approach is to use a an
+identifiers you wish to use. The most common approach is to use an
interface file with directives to parse the needed headers. A straight
parse of library headers will result in usable code, but SWIG
directives provides much freedom in how a user might tailor the
@@ -280,39 +280,39 @@ actual function.
@@ -396,7 +396,7 @@ See Section 17.5 Identifier converter
functions for more details.
@@ -436,7 +436,7 @@ Note that the block %{ ... %} is effectively a shortcut for
@@ -446,7 +446,7 @@ New users to SWIG are encouraged to read
interested in generating an interface to C++.
@@ -499,7 +499,7 @@ interested in generating an interface to C++.
@@ -512,7 +512,7 @@ interested in generating an interface to C++.
typemap.
@@ -526,8 +526,8 @@ interested in generating an interface to C++.
@@ -606,11 +606,11 @@ char *xxx();
this function can be manipulated via the lout typemap.
- In the case of overloaded functions, mulitple layers are
+ In the case of overloaded functions, multiple layers are
generated. First, all the overloads for a given name are separated
out into groups based on arity, and are wrapped in
defmethods. Each method calls a distinct wrapper function, but are
@@ -622,7 +622,7 @@ char *xxx();
can be manipulated via the lout typemap.
@@ -635,7 +635,7 @@ char *xxx();
into the foreign module.
@@ -657,7 +657,7 @@ char *xxx();
foreign function interface.
@@ -665,7 +665,7 @@ char *xxx();
translated into lisp.
@@ -688,10 +688,10 @@ char *xxx();
%include "foo.h"
namespace car {
- ...
- namespace tires {
- int do_something(int n);
- }
+ ...
+ namespace tires {
+ int do_something(int n);
+ }
}
C++0x/C++11 support for SWIG
-Summary
-SVN branch
-New C++11 features status
-Rvalue reference and move semantics [done]
-template <class T> swap(T& a, T& b) {
- T tmp(a); // now we have two copies of a
- a = b; // now we have two copies of b
- b = tmp; // now we have two copies of tmp (aka a)
-}template <class T> swap(T& a, T& b) {
- T tmp(std::move(a));
- a = std::move(b);
- b = std::move(tmp);
-}class MyClass {
- MyClass(MyClass&& p) : ptr(p.ptr) {p.ptr = 0;}
- MyClass& operator=(MyClass&& p) {
- std::swap(ptr, p.ptr);
- return *this;
- }
-};Generalized constant expressions [done]
-Extern template [done]
-Initializer lists [done]
- class A {
- public:
- A( std::initializer_list<int> );
- };
- A a1 = {1,2,3,4};Uniform initialization [done]
-struct IdString {
- std::string name;
- int identifier;
-};
-
-IdString GetString() {
- return {"SomeName", 4}; //Note the lack of explicit type.
-}IdString str1 = {„SomeName“, 4};
-IdString str2{„SomeName“, 4};struct BasicStruct {
- int x;
- double y;
-};
-
-struct AltStruct {
- AltStruct(int x, double y) : x_{x}, y_{y} {}
-
-private:
- int x_;
- double y_;
-};
-
-BasicStruct var1{5, 3.2}; // only fills the struct components
-AltStruct var2{2, 4.3}; // calls the constructorType inference [partially done]
-auto a1 = 100;
-auto a2 = myFunc();
int i = 100;
-decltype(i) j = 200; // decltype(i) = int
decltype(i+j) k = 300;
Range-based for-loop [ignored]
-Lambda functions and expressions [done]
-[](int x, int y) -> int { return x + y; }std::vector<int> someList;
-int total = 0;
-std::for_each( someList.begin(), someList.end(), [&total](int x) {total += x} );
-std::cout << total;auto myLambdaFunc = [this]() { this->SomePrivateMemberFunction() };Alternate function syntax [done]
-template< typename LHS, typename RHS>
- decltype(lhs+rhs) AddingFunc(const LHS &lhs, const RHS &rhs) {return lhs + rhs;} //Not legal C++11template< typename LHS, typename RHS>
- auto AddingFunc(const LHS &lhs, const RHS &rhs) -> decltype(lhs+rhs) {return lhs + rhs;}struct SomeStruct {
- auto FuncName(int x, int y) -> int;
-};
-
-auto SomeStruct::FuncName(int x, int y) -> int {
- return x + y;
-}Concepts, Axioms [ignored]
- template<LessThanComparable? T>
- const T& min(const T &x, const T &y) {
- return y < x ? y : x;
- }
template< typename T> requires LessThanComparable?<T>
- const T& min(const T &x, const T &y) {
- return y < x ? y : x;
- }
concept LessThanComparable?< typename T > {
- bool operator<(T,T);
- requires GreaterThanComparable?<T>;
- typename value_type;
- typename reference;
- };
template< typename T>
- concept_map InputIterator?<T*> {
- typedef T value_type ;
- typedef T& reference ;
- typedef T* pointer ;
- typedef std::ptrdiff_t difference_type ;
- };
concept Stack< typename X> {
- typename value_type;
- void push(X&, const value_type&);
- void pop(X&);
- value_type top(const X&);
- bool empty(const X&);
- };
- template< typename T>
- concept_map Stack<std::vector<T> > {
- typedef T value_type;
- void push(std::vector<T>& v, const T& x) { v.push_back(x); }
- void pop(std::vector<T>& v) { v.pop_back(); }
- T top(const std::vector<T>& v) { return v.back(); }
- bool empty(const std::vector<T>& v) { return v.empty(); }
- }; concept Semigroup< typename Op, typename T> : CopyConstructible?<T> {
- T operator()(Op, T, T);
- axiom Associativity(Op op, T x, T y, T z) {
- op(x, op(y, z)) == op(op(x, y), z);
- }
- };
Object construction improvement [done]
- class SomeType {
- int number;
- public:
- SomeType(int newNumber) : number(newNumber) {}
- SomeType() : SomeType(42) {}
- }; class BaseClass {
- public:
- BaseClass(int iValue);
- };
- class DerivedClass: public BaseClass {
- public:
- using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
- };Null pointer constant [done]
-Strongly typed enumerations [partially done]
- enum class Enumeration {
- Val1,
- Val2,
- Val3 = 100,
- Val4 /* = 101 */
- }; enum class Enum2 : unsigned int {Val1, Val2}; enum Enum1; //Illegal in C++ and C++11; no size is explicitly specified.
- enum Enum2 : unsigned int; //Legal in C++11.
- enum class Enum3; //Legal in C++11, because enum class declarations have a default type of "int".
- enum class Enum4: unsigned int; //Legal C++11.
- enum Enum2 : unsigned short; //Illegal in C++11, because Enum2 was previously declared with a different type.
class A { enum class EA { a,b,c,d }; };class A { class EA { enum {a,b,c,d}; }; };
-Angle bracket [done]
-Explicit conversion operators [done]
-Template typedefs [partially done]
-template< typename first, typename second, int third>
-class SomeType;
-
-template< typename second>
-typedef SomeType<OtherType, second, 5> TypedefName; //Illegal in C++
template< typename first, typename second, int third>
-class SomeType;
-
-template< typename second>
-using TypedefName = SomeType<OtherType, second, 5>;
typedef void (*PFD)(double); // Old style
-using PF = void (*)(double); // New introduced syntax
typedef List<int> intList;
Unrestricted unions [done]
- struct point {
- point() {}
- point(int x, int y): x_(x), y_(y) {}
- int x_, y_;
- };
- union P {
- int z;
- double w;
- point p; // Illegal in C++; point has a non-trivial constructor. However, this is legal in C++11.
- } p1;Variadic templates [partially done]
-template<typename... Values> class tuple;
class tuple<int, std::vector<int>, std::map<std::string, std::vector<int>>> someInstanceName;
void printf(const char *s) {
- while (*s) {
- if (*s == '%' && *(++s) != '%')
- throw std::runtime_error("invalid format string: missing arguments");
- std::cout << *s++;
- }
-}
-
-template<typename T, typename... Args>
-void printf(const char* s, T value, Args... args) { // recursive action – split previous args to value + args
- while (*s) {
- if (*s == '%' && *(++s) != '%') {
- std::cout << value;
- printf(*s ? ++s : s, args...); // call even when *s == 0 to detect extra arguments
- return;
- }
- std::cout << *s++;
- }
- throw std::logic_error("extra arguments provided to printf");
-}template <typename... BaseClasses> class ClassName : public BaseClasses... {
-public:
-
- ClassName (BaseClasses&&... baseClasses) : BaseClasses(baseClasses)... {}
-}template<typename ...Args> struct SomeStruct {
- static const int size = sizeof...(Args);
-}
-// SomeStruct<Type1, Type2>::size is 2 and SomeStruct<>::size is 0New string literals [partially done]
-User-defined literals [partially done]
- OutputType operator "" _mySuffix(const char * string_values);
OutputType operator "" _mySuffix(const char * string_values, size_t num_chars);
- OutputType operator "" _mySuffix(const wchar_t * string_values, size_t num_chars);
- OutputType operator "" _mySuffix(const char16_t * string_values, size_t num_chars);
- OutputType operator "" _mySuffix(const char32_t * string_values, size_t num_chars);
- OutputType operator "" _mySuffix(int value); /* cooked version - ie. atoi() of string */
template<char...> OutputType operator "" _mySuffix();
- OutputType someVariable = "1234"_mySuffix;
Thread-local storage [done]
-
- struct A {
- thread_local int val;
- };Defaulting/deleting of standard functions on C++ objects [done]
- struct NonCopyable {
- NonCopyable & operator=(const NonCopyable&) = delete; /* Removes operator= */
- NonCopyable(const NonCopyable&) = delete; /* Removed copy constructor */
- NonCopyable() = default; /* Explicitly allows the empty constructor */
- void *operator new(std::size_t) = delete; /* Removes new NonCopyable */
- }; struct A1 {
- void f(int i);
- void f(double i) = delete; /* Don't cast double to int. Compiler returns an error */
- };
- struct A2 {
- void f(int i);
- template<class T> void f(T) = delete; /* Only accept int */
- };Type long long int [done]
-Static assertions [done]
- template <typename T>
- struct Check {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };Allow sizeof to work on members of classes without an explicit
-object [done]
- struct A { int member; };
- sizeof(A::member); //Does not work with C++03. Okay with C++11Threading facilities [ignored]
- * std::thread
- * std::mutex, std::recursive_mutex
- * std::condition_variable, std::condition_variable_any
- * std::lock_guard, std::unique_lock
- * std::packaged_task
Tuple types [TODO]
-template <class ...Types> class tuple;
typedef tuple< int, double, long &, const char * > test_tuple ;
-long lengthy = 12 ;
-test_tuple proof( 18, 6.5, lengthy, "Ciao!" ) ;
-lengthy = get<0>(proof) ; // Assign to 'lengthy' the value 18.
-get<3>(proof) = " Beautiful!" ; // Modify the tuple’s fourth element.
typedef tuple< int , double, string > tuple_1 t1 ;
-typedef tuple< char, short , const char * > tuple_2 t2( 'X', 2, "Hola!" ) ;
-t1 = t2 ; // Ok, first two elements can be converted,
- // the third one can be constructed from a 'const char *'.
Hash tables [TODO]
- - unordered set
- - unordered multiset
- - unordered map
- - unordered multimap
Regular expressions [ignored]
-General-purpose smart pointers [done]
-Extensible random number facility [ignored]
-Wrapper reference [ignored]
-Polymorphous wrappers for function objects [done]
-
-
- function<int ( int, int )> pF;
-
-
- struct Test {
- bool operator()( short x, short y );
- };Type traits for metaprogramming [ignored]
- template< int B, int N >
- struct Pow {
- // recursive call and recombination.
- enum{ value = B*Pow< B, N-1 >::value };
- };
- template< int B > struct Pow< B, 0 > // N == 0 condition of termination.
- {
- enum{ value = 1 };
- };
- int quartic_of_three = Pow< 3, 4 >::value ;// First way of operating.
-template< bool B > struct algorithm {
- template< class T1, class T2 > int do_it( T1 &, T2 & ) { /*...*/ }
-};
-// Second way of operating.
-template<> struct algorithm<true> {
- template< class T1, class T2 > int do_it( T1, T2 ) { /*...*/ }
-};
-// Instantiating 'elaborate' will automatically instantiate the correct way to operate.
-template< class T1, class T2 > int elaborate( T1 A, T2 B ) {
- // Use the second way only if 'T1' is an integer and if 'T2' is
- // in floating point, otherwise use the first way.
- return algorithm< is_integral<T1>::value && is_floating_point<T2>::value >::do_it( A, B );
-}Uniform method for computing return type of function objects
-[partially done]
-template< class Obj >
-class calculus_ver2 {
- public:
- template< class Arg >
- typename std::result_of<Obj(Arg)>::type operator()( Arg& a ) const {
- return member(a);
- }
- private:
- Obj member;
-}; in JD, ignored in PD
+ \callgraph - ignored, not supported by JD and PD
+ \callergraph - ignored, not supported by JD and PD
+ \category - ignored, used only in Objective C
+ \cite - translated to in JD, single quotes in PD
+ \class - ignored (structural command)
+ \code - translated to {@code ...} in JD, ignored in PD
+ \cond - translated to 'Conditional comment: in JD only when target=HTML, translated to
+ 'Image: filename(Title)'
+ \implements - not supported
+ \include - not supported
+ \includelineno - not supported
+ \ingroup - not supported. Later swig may print group names as plain text
+ in comments like 'Code group: something' in both JD and PD
+ \internal - ignored
+ \invariant - ignored
+ \interface - ignored (structural command)
+ \latexonly - ignored
+ \li - trabslated to in JD, ignored in PD
+ \line - not supported
+ \link - translated to {@link ...} in JD, ignored in PD
+ \mainpage - ignored
+ \manonly - ignored
+ \memberof - not supported
+ \msc - not supported. Later SWIG may call dot and produce the graph image
+ to include in JD and PD
+ \mscfile - see note for \msc
+ \n - prints the new line
+ \name - ignored
+ \namespace - included in package-info.java if nspace feature is enabled,
+ otherwise ignored, ignored in PD
+ \nosubgrouping - ignored
+ \note - translated to 'Note:' in both JD and PD
+ \overload - prints 'This is an overloaded member function, provided for
+ convenience. It differs from the above function only in what
+ argument(s) it accepts.' to the output in both JD and PD
+ \p - equivalent to \c
+ \package - is kept same in JD (it is already a JD tag), ignored in PD
+ \page - ignored
+ \par - translated to in JD, 'Title: ...' in PD
+ \paragraph - ignored
+ \param - translated to @param in JD, special formatting in PD
+ \post - ignored
+ \pre - ignored
+ \private - ignored
+ \privatesection - ignored
+ \property - ignored
+ \protected - ignored
+ \protectedsection - ignored
+ \protocol - ignored (Objective-C tag)
+ \public - ignored
+ \publicsection - ignored
+ \ref - ignored, not supported by JD and PD
+ \related - ignored
+ \relates - ignored
+ \relatedalso - ignored
+ \relatesalso - ignored
+ \remark - translated to 'Remarks:' in both JD and PD
+ \remarks - equivalent to remark
+ \result - translated to @return in JD, 'Return:' in PD
+ \return - equivalent to result
+ \returns - equivalent to result
+ \retval - ignored
+ \rtfonly - ignored
+ \sa - translated to @see in JD, 'See also:' in PD
+ \section - not supported
+ \see - equivalent to \sa
+ \short - equivalent to \brief
+ \showinitializer - not supported
+ \since - translated to @since in JD, 'Since:' in PD
+ \skip - not supported
+ \skipline - not supported
+ \snippet - not supported
+ \struct - ignored (structural command)
+ \subpage - not supported
+ \subsection - not supported
+ \subsubsection - not supported
+ \tableofcontents - not supported
+ \test - ignored
+ \throw - translated to @throws in JD, 'Throws:' in PD
+ \throws - equivalent to \throw
+ \todo - translated to 'TODO:' in both JD and PD
+ \tparam - similar to \arg
+ \typedef - ignored (structural command)
+ \union - ignored (structural command)
+ \until - not supported
+ \var - ignored (structural command)
+ \verbatim - translated to {@literal ...} in JD, ignored in PD
+ \verbinclude - ignored
+ \version - translated to @version in JD, 'Version:' in PD
+ \warning - translated to 'Warning:' in both JD and PD
+ \weakgroup - not supported
+ \xmlonly - ignored
+ \xrefitem - ignored
+ \$ - this and all the others below: these commands insert single char,
+ it is escaped as HTML char in JD, kept as-is in PD
+ \@
+ \\
+ \&
+ \~
+ \<
+ \>
+ \#
+ \%
+ \"
+ \.
+ \::
+
+Optional functionality
+======================
+
+That section describes some complex cases where the current code
+does not behave really well. Like a short to-do list of special cases.
+
+-OK- When translating functions with default parameters in swig to
+java, it creates overloaded functions with all the parameters
+except the default ones. We need to copy the doxygen comment to
+such functions and correct the list of @param tags.
+
+-OK- In doxygen there is a special tags (and even a special option)
+to create links to some code members from the current comment.
+Sometimes it needs a type of parameters specified because of the
+overloaded functions. And the same linking tags are supported in JD,
+but it has a completely different typesystem, so we need to translate
+the types of function parameters in comments also. For example:
+{@link MyClass#doSomething(const std::string &)}
+does not make sense in Java, so the type should be converted.
+{@link MyClass#doSomething(String)}
+
+
+Tests
+=====
+
+The following test cases will be implemented:
+
+-OK- Class comments.
+
+-OK- Struct comments.
+-OK- Enum comments.
+-OK- Function comments.
+-OK- Var comments.
+
+-OK- Class attributes, comment before and after declaration.
+-OK- Class methods, comment of parameters in function
+ comment.
+-OK- Class methods, comment of parameters
+ after parameter declaration.
+
+-OK- Struct attributes, comment before and after declaration.
+-OK- Struct methods, comment of parameters in function
+ comment.
+-OK- Struct methods, comment of parameters
+ after parameter declaration.
+
+-OK- Enum items JD and Qt style, comment before items
+-OK- Enum items JD and Qt style, comment after items
+
+-OK- Class comment, with all supported tags.
+-OK- Class comment, with all doxygen tags, including
+ ignored ones.
+
+The list of all tests, in form of shell commands to make it simple
+to test project by copying the text below into terminal program.
+make doxygen_parsing.cpptest -s
+make doxygen_translate.cpptest -s
+make doxygen_translate_all_tags.cpptest -s
+make doxygen_basic_translate.cpptest -s
+make doxygen_basic_notranslate.cpptest -s
+make doxygen_translate_links.cpptest -s
+make doxygen_tricky_constructs.cpptest -s
+
+
+Refactoring
+===========
+
+All the code in directory _Doxygen_ should be refactored:
+-OK- all methods should be class members
+-OK- most static methods should be normal members
+-OK- replace C arrays of strings and sequential searches with STL data
+ structures and algorithms.
+-OK- use singletons instead of class instantiaion for each comment found.
+
+
+Documentation
+=============
+
+SWIG documentation will contain:
+-OK- command line options
+-OK- list of implemented features (types and placements of comments)
+-OK- list of unimplemented features (types and placements of comments)
+-OK- list of tags and their translations (all Doxygen tags).
+-OK- some amount of debugging and development information
+
diff --git a/Doc/Devel/runtime.txt b/Doc/Devel/runtime.txt
index f88edf767..ae9c83275 100644
--- a/Doc/Devel/runtime.txt
+++ b/Doc/Devel/runtime.txt
@@ -57,7 +57,7 @@ Alternatively, if the language supports modules, a module named
named "type_table" SWIG_TYPE_TABLE_NAME can be created inside it. The most
common approach is to store the mod pointer in some global variable in the
target language, but if the language provides an alternative place to store data
-(like the chicken module), then that is good too.
+then that is good too.
The way the code is set up, SetModule should only be called when GetModule
returns NULL, and if SetModule is called a second time, the behavior is
@@ -105,7 +105,7 @@ Standard Functions
These functions are not required and their API is not formalized, but almost all
language modules implement them for consistency across languages. Throughout
this discussion, I will use LangType to represent the underlying language type
-(C_word in chicken, Scheme_Object * in mzscheme, PyObject * in python, etc)
+(Scheme_Object * in mzscheme, PyObject * in python, etc)
diff --git a/Doc/Devel/tree.html b/Doc/Devel/tree.html
index 73a49ed55..5bb4b6a1e 100644
--- a/Doc/Devel/tree.html
+++ b/Doc/Devel/tree.html
@@ -236,7 +236,7 @@ The following functions can be used to help debug SWIG parse trees.
Prints the tag-structure of the parse tree to standard output. node is the top-level parse tree node. prefix is
-a string prefix thats added to the start of each line. Normally, you would specify the empty string or NIL for prefix.
+a string prefix that's added to the start of each line. Normally, you would specify the empty string or NIL for prefix.
This function is called by the -debug-tags option to SWIG.
diff --git a/Doc/Manual/Allegrocl.html b/Doc/Manual/Allegrocl.html
index 4b6bad421..4069ecd8b 100644
--- a/Doc/Manual/Allegrocl.html
+++ b/Doc/Manual/Allegrocl.html
@@ -8,7 +8,7 @@
-
18 SWIG and Allegro Common Lisp
+20 SWIG and Allegro Common Lisp
@@ -129,16 +129,16 @@ It is significant to note that, while this is a vendor-specific
module, we would like to acknowledge the current and ongoing
work by developers in the open source lisp community that are
working on similar interfaces to implementation-independent
-foreign function interfaces (UFFI or CFFI, for example). Such
+foreign function interfaces (CFFI, for example). Such
work can only benefit the lisp community, and we would not
be unhappy to see some enterprising folk use this work to add
to it.
-
18.1 Basics
+20.1 Basics
-18.1.1 Running SWIG
+20.1.1 Running SWIG
- ... lots of SWIG internals ...
+ ... lots of SWIG internals ...
EXPORT int ACL___fact__SWIG_0 (char *larg1) {
- int lresult = (int)0 ;
- char *arg1 = (char *) 0 ;
- int result;
-
- arg1 = larg1;
- try {
- result = (int)fact(arg1);
-
- lresult = result;
- return lresult;
- } catch (...) {
- return (int)0;
- }
+ int lresult = (int)0 ;
+ char *arg1 = (char *) 0 ;
+ int result;
+
+ arg1 = larg1;
+ try {
+ result = (int)fact(arg1);
+
+ lresult = result;
+ return lresult;
+ } catch (...) {
+ return (int)0;
+ }
}
EXPORT int ACL___fact__SWIG_1 (int larg1) {
- int lresult = (int)0 ;
- int arg1 ;
- int result;
-
- arg1 = larg1;
- try {
- result = (int)fact(arg1);
-
- lresult = result;
- return lresult;
- } catch (...) {
- return (int)0;
- }
+ int lresult = (int)0 ;
+ int arg1 ;
+ int result;
+
+ arg1 = larg1;
+ try {
+ result = (int)fact(arg1);
+
+ lresult = result;
+ return lresult;
+ } catch (...) {
+ return (int)0;
+ }
}
- ...
+ ...
(swig-in-package ())
@@ -360,7 +360,7 @@ need to link in the Allegro shared library. The library you create from
the C++ wrapper will be what you then load into Allegro CL.
-
18.1.2 Command Line Options
+20.1.2 Command Line Options
18.1.3 Inserting user code into generated files
+20.1.3 Inserting user code into generated files
18.2 Wrapping Overview
+20.2 Wrapping Overview
18.2.1 Function Wrapping
+20.2.1 Function Wrapping
18.2.2 Foreign Wrappers
+20.2.2 Foreign Wrappers
18.2.3 FFI Wrappers
+20.2.3 FFI Wrappers
%module ffargs
-%ffargs(strings_convert="nil",call_direct="t") foo;
-%ffargs(strings_convert="nil",release_heap=":never",optimize_for_space="t") bar;
+%ffargs(strings_convert="nil", call_direct="t") foo;
+%ffargs(strings_convert="nil", release_heap=":never", optimize_for_space="t") bar;
int foo(float f1, float f2);
int foo(float f1, char c2);
@@ -593,7 +593,7 @@ char *xxx();
ff:def-foreign-call's.
-
18.2.4 Non-overloaded Defuns
+20.2.4 Non-overloaded Defuns
18.2.5 Overloaded Defuns
+20.2.5 Overloaded Defuns
18.2.6 What about constant and variable access?
+20.2.6 What about constant and variable access?
18.2.7 Object Wrapping
+20.2.7 Object Wrapping
18.3 Wrapping Details
+20.3 Wrapping Details
18.3.1 Namespaces
+20.3.1 Namespaces
@@ -881,7 +881,7 @@ globalvar> (globalvar.nnn::glob_float) -
@@ -957,7 +957,7 @@ EXPORT const int ACL_ENUM___FOO3__SWIG_0 = FOO3; -
@@ -1105,10 +1105,10 @@ namespace BAR { -
@@ -1123,7 +1123,7 @@ namespace BAR { integer values.
-@@ -1136,7 +1136,7 @@ namespace BAR { parameter.
-@@ -1152,7 +1152,7 @@ namespace BAR { the interface does nothing for friend directives,
-@@ -1170,11 +1170,11 @@ namespace BAR { use the more robust wrapper functions.
-@@ -1187,7 +1187,7 @@ them. This is done via the directive.
-@@ -1197,7 +1197,7 @@ to include these templated classes in the foreign-type and CLOS class schema.
-@@ -1209,8 +1209,8 @@ class schema.
class A {
- int x;
- int y;
+ int x;
+ int y;
};
typedef A Foo;
@@ -1239,7 +1239,7 @@ int zzz(A *inst = 0); /* return inst->x + inst->y */
We resolve this issue, by noting synonym relationships between
types while generating the interface. A Primary type is selected
(more on this below) from the candidate list of synonyms. For
- all other synonyms, intead of generating a distinct CLOS class
+ all other synonyms, instead of generating a distinct CLOS class
definition, we generate a form that expands to:
@@ -1277,7 +1277,7 @@ synonym>
-18.3.8.1 Choosing a primary type
+20.3.8.1 Choosing a primary type
@@ -1298,7 +1298,7 @@ synonym>
-
18.3.9 Function overloading/Parameter defaulting
+20.3.9 Function overloading/Parameter defaulting
@@ -1336,70 +1336,70 @@ float xxx(A *inst, int x); /* return x + A->x + A->y */
overload_wrap.cxx
EXPORT void ACL___delete_A__SWIG_0 (A *larg1) {
- A *arg1 = (A *) 0 ;
-
- arg1 = larg1;
- try {
- delete arg1;
-
- } catch (...) {
-
- }
+ A *arg1 = (A *) 0 ;
+
+ arg1 = larg1;
+ try {
+ delete arg1;
+
+ } catch (...) {
+
+ }
}
EXPORT float ACL___xxx__SWIG_0 (int larg1, int larg2) {
- float lresult = (float)0 ;
- int arg1 ;
- int arg2 ;
- float result;
-
- arg1 = larg1;
- arg2 = larg2;
- try {
- result = (float)xxx(arg1,arg2);
-
- lresult = result;
- return lresult;
- } catch (...) {
- return (float)0;
- }
+ float lresult = (float)0 ;
+ int arg1 ;
+ int arg2 ;
+ float result;
+
+ arg1 = larg1;
+ arg2 = larg2;
+ try {
+ result = (float)xxx(arg1, arg2);
+
+ lresult = result;
+ return lresult;
+ } catch (...) {
+ return (float)0;
+ }
}
EXPORT float ACL___xxx__SWIG_1 (int larg1) {
- float lresult = (float)0 ;
- int arg1 ;
- float result;
-
- arg1 = larg1;
- try {
- result = (float)xxx(arg1);
-
- lresult = result;
- return lresult;
- } catch (...) {
- return (float)0;
- }
+ float lresult = (float)0 ;
+ int arg1 ;
+ float result;
+
+ arg1 = larg1;
+ try {
+ result = (float)xxx(arg1);
+
+ lresult = result;
+ return lresult;
+ } catch (...) {
+ return (float)0;
+ }
}
EXPORT float ACL___xxx__SWIG_2 (A *larg1, int larg2) {
- float lresult = (float)0 ;
- A *arg1 = (A *) 0 ;
- int arg2 ;
- float result;
-
- arg1 = larg1;
- arg2 = larg2;
- try {
- result = (float)xxx(arg1,arg2);
-
- lresult = result;
- return lresult;
- } catch (...) {
- return (float)0;
- }
+ float lresult = (float)0 ;
+ A *arg1 = (A *) 0 ;
+ int arg2 ;
+ float result;
+
+ arg1 = larg1;
+ arg2 = larg2;
+ try {
+ result = (float)xxx(arg1, arg2);
+
+ lresult = result;
+ return lresult;
+ } catch (...) {
+ return (float)0;
+ }
}
@@ -1461,7 +1461,7 @@ overload>
@@ -1607,7 +1607,7 @@ opoverload> -
@@ -1628,7 +1628,7 @@ opoverload> with other ways such functions can be wrapped.
-@@ -1640,7 +1640,7 @@ opoverload> implemented.
-@@ -1652,7 +1652,7 @@ opoverload> newly defined types.
-@@ -1663,7 +1663,7 @@ opoverload> on Typemaps for more information.
-
return-val wrapper-name(parm0, parm1, ..., parmN)
{
- return-val lresult; /* return value from wrapper */
- <local-declaration>
- ... results; /* return value from function call */
+ return-val lresult; /* return value from wrapper */
+ <local-declaration>
+ ... results; /* return value from function call */
- <binding locals to parameters>
+ <binding locals to parameters>
- try {
- result = function-name(local0, local1, ..., localN);
+ try {
+ result = function-name(local0, local1, ..., localN);
- <convert and bind result to lresult>
+ <convert and bind result to lresult>
- return lresult;
- catch (...) {
- return (int)0;
- }
+ return lresult;
+ catch (...) {
+ return (int)0;
+ }
-@@ -1728,7 +1728,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -1752,7 +1752,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -1784,7 +1784,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) these common typemaps here.
-@@ -1803,7 +1803,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) 16.3.1 Namespaces for details.
-@@ -1846,7 +1846,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -1889,7 +1889,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -1959,7 +1959,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -1983,7 +1983,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -2017,10 +2017,10 @@ return-val wrapper-name(parm0, parm1, ..., parmN) -
@@ -2041,11 +2041,11 @@ return-val wrapper-name(parm0, parm1, ..., parmN) of arguments.
-Two basic identifier routines have been defined. -
@@ -2054,7 +2054,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) strings, from which a symbol will be created.
-@@ -2063,7 +2063,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) same symbol transformations.
-@@ -2072,7 +2072,7 @@ return-val wrapper-name(parm0, parm1, ..., parmN) default naming conventions.
-@@ -2128,7 +2128,7 @@ indicating the number of arguments passed to the routine indicated by this identifier.
-diff --git a/Doc/Manual/Android.html b/Doc/Manual/Android.html index 8838e67a9..944a88d65 100644 --- a/Doc/Manual/Android.html +++ b/Doc/Manual/Android.html @@ -6,7 +6,7 @@
-@@ -41,14 +41,14 @@ Everything in the Java chapter applies to generatin This chapter contains a few Android specific notes and examples.
--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):
@@ -77,7 +77,7 @@ $ android list targets The following examples are shipped with SWIG under the Examples/android directory and include a Makefile to build and install each example. -@@ -326,7 +326,7 @@ include $(BUILD_SHARED_LIBRARY)
-See the Android NDK documentation for more on the NDK build system and getting started with the NDK. +See the Android NDK documentation for more on the NDK build system and getting started with the NDK. A simple invocation of ndk-build will compile the .c files and generate a shared object/system library. Output will be similar to:
@@ -354,7 +354,7 @@ Modify the nativeCall method in src/org/swig/simple/SwigSimple.java int x = 42; int y = 105; - int g = example.gcd(x,y); + int g = example.gcd(x, y); outputText.append("The greatest common divisor of " + x + " and " + y + " is " + g + "\n"); // Manipulate the Foo global variable @@ -399,7 +399,7 @@ Run the app again and this time you will see the output pictured below, showing
@@ -409,7 +409,7 @@ All the steps required to compile and use a simple hierarchy of classes for shap
First create an Android project called SwigClass in a subdirectory called class. -The steps below create and build a the JNI C++ app. +The steps below create and build the JNI C++ app. Adjust the --target id as mentioned earlier in the Examples introduction.
@@ -661,7 +661,7 @@ public class SwigClass extends Activity // ----- Call some methods ----- outputText.append( "\nHere are some properties of the shapes:\n" ); - Shape[] shapes = {c,s}; + Shape[] shapes = {c, s}; for (int i=0; i<shapes.length; i++) { outputText.append( " " + shapes[i].toString() + "\n" ); @@ -747,7 +747,7 @@ Run the app to see the result of calling the C++ code from Java:
@@ -759,7 +759,7 @@ Note that the 'extend' example is demonstrates the directors feature. 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.
-diff --git a/Doc/Manual/Arguments.html b/Doc/Manual/Arguments.html index 48ec5c629..2828bf4df 100644 --- a/Doc/Manual/Arguments.html +++ b/Doc/Manual/Arguments.html @@ -7,7 +7,7 @@
--In Chapter 3, SWIG's treatment of basic datatypes and pointers was +In Chapter 5, SWIG's treatment of basic datatypes and pointers was described. In particular, primitive types such as int and double are mapped to corresponding types in the target language. For everything else, pointers are used to refer to @@ -43,7 +43,7 @@ return multiple values through the arguments of a function. This chapter describes some of the techniques for doing this.
-@@ -51,7 +51,7 @@ This section describes the typemaps.i library file--commonly used to change certain properties of argument conversion.
-@@ -100,7 +100,7 @@ like this (shown for Python):
->>> a = add(3,4)
+>>> a = add(3, 4)
>>> print a
7
>>>
@@ -148,7 +148,7 @@ For example, consider this code:
%include "typemaps.i"
%apply int *OUTPUT { int *width, int *height };
-// Returns a pair (width,height)
+// Returns a pair (width, height)
void getwinsize(int winid, int *width, int *height);
->>> w,h = genwinsize(wid) +>>> w, h = genwinsize(wid) >>> print w 400 >>> print h @@ -195,7 +195,7 @@ else. To clear a typemap, the %clear directive should be used. For e
@@ -245,10 +245,10 @@ When the function is used in the scripting language interpreter, it will work li
-result = add(3,4) +result = add(3, 4)
@@ -315,7 +315,7 @@ iresult, dresult = foo(3.5, 2)
@@ -380,7 +380,7 @@ rather than directly overwriting the value of the original input object. SWIG. Backwards compatibility is preserved, but deprecated.
-@@ -414,7 +414,7 @@ Typemap declarations are lexically scoped so a typemap takes effect from the poi file or a matching %clear declaration.
-@@ -424,7 +424,7 @@ insure that a value is positive, or that a pointer is non-NULL. This can be accomplished including the constraints.i library file.
-@@ -450,7 +450,7 @@ the arguments violate the constraint condition, a scripting language exception will be raised. As a result, it is possible to catch bad values, prevent mysterious program crashes and so on.
-@@ -466,7 +466,7 @@ NONNULL Non-NULL pointer (pointers only). -
diff --git a/Doc/Manual/CCache.html b/Doc/Manual/CCache.html index d23b0cb2f..edd435fa1 100644 --- a/Doc/Manual/CCache.html +++ b/Doc/Manual/CCache.html @@ -7,7 +7,7 @@
--
@@ -43,7 +43,7 @@ ccache-swig - a fast compiler cache
-
@@ -53,7 +53,7 @@ ccache-swig <compiler> [COMPILER OPTIONS]
<compiler> [COMPILER OPTIONS]
-
@@ -62,7 +62,7 @@ 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.
-
@@ -82,7 +82,7 @@ Here is a summary of the options to ccache-swig.
-
@@ -124,7 +124,7 @@ rounded down to the nearest multiple of 16 kilobytes.
-
@@ -156,7 +156,7 @@ This will work as long as /usr/local/bin comes before the path to gcc Note! Do not use a hard link, use a symbolic link. A hardlink will cause "interesting" problems.
-
@@ -176,7 +176,7 @@ 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.
-
@@ -315,7 +315,7 @@ the use of '#pragma SWIG'.
-
@@ -328,7 +328,7 @@ 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.
-
@@ -339,7 +339,7 @@ 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.
-
@@ -364,7 +364,7 @@ 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.
-
@@ -378,7 +378,7 @@ 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'.
-
@@ -407,11 +407,11 @@ following conditions need to be met: versions of ccache that do not support compression.
-
-ccache was inspired by the compilercache shell script script written +ccache was inspired by the compilercache shell script written by Erik Thiele and I would like to thank him for an excellent piece of work. See http://www.erikyyy.de/compilercache/ @@ -423,7 +423,7 @@ 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.
-
@@ -441,7 +441,7 @@ are:
-
@@ -453,12 +453,12 @@ Thanks to the following people for their contributions to ccache
-
ccache was written by Andrew Tridgell -http://samba.org/~tridge/. +https://www.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 diff --git a/Doc/Manual/CPlusPlus11.html b/Doc/Manual/CPlusPlus11.html index c825d8426..11335a251 100644 --- a/Doc/Manual/CPlusPlus11.html +++ b/Doc/Manual/CPlusPlus11.html @@ -32,6 +32,7 @@
And then call this constructor from your target language, for example, in Python, the following will call the constructor taking the std::vector:
->>> c = Container( [1,2,3,4] ) +>>> c = Container( [1, 2, 3, 4] )
@@ -392,7 +394,7 @@ auto SomeStruct::FuncName(int x, int y) -> int {
>>> a = SomeStruct() ->>> a.FuncName(10,5) +>>> a.FuncName(10, 5) 15
class SomeClass {
public:
- SomeClass() {}
- explicit SomeClass(int new_value) : value(new_value) {}
+ SomeClass() {}
+ explicit SomeClass(int new_value) : value(new_value) {}
- int value = 5;
+ int value = 5;
};
-SWIG supports type aliasing. -
-The following is an example of an alias template:
-template< typename T1, typename T2, int >
+template< typename T1, typename T2, int N >
class SomeType {
public:
T1 a;
T2 b;
- int c;
};
template< typename T2 >
@@ -643,14 +640,19 @@ using TypedefName = SomeType<char*, T2, 5>;
-These are partially supported as SWIG will parse these and identify them, however, they are ignored as they are not added to the type system. A warning such as the following is issued: +SWIG supports both type aliasing and alias templates. +However, in order to use an alias template, two %template directives must be used:
--example.i:13: Warning 342: The 'using' keyword in template aliasing is not fully supported yet. --
+%template(SomeTypeBool) SomeType<char*, bool, 5>; +%template() TypedefName<bool>; +
Firstly, the actual template is instantiated with a name to be used by the target language, as per any template being wrapped. +Secondly, the empty template instantiation, %template(), is required for the alias template. +This second requirement is necessary to add the appropriate instantiated template type into the type system as SWIG does not automatically instantiate templates. +See the Templates section for more general information on wrapping templates.
template <typename... BaseClasses> class ClassName : public BaseClasses... {
public:
- ClassName (BaseClasses &&... baseClasses) : BaseClasses(baseClasses)... {}
+ ClassName (BaseClasses &&... baseClasses) : BaseClasses(baseClasses)... {}
}
+C++11 adds support for UCS-2 and UCS-4 character literals. +These character literals are preceded by either 'u' or 'U'. +
+ ++char16_t a = u'a'; +char32_t b = U'b'; +
+Compatibility note: SWIG-4.0.0 was the first version to support these Universal Coded Character Set (UCS) character literals. +
+ +SWIG supports wide string and Unicode string constants and raw string literals.
@@ -743,7 +762,7 @@ Note: There is a bug currently where SWIG's preprocessor incorrectly parses an o inside raw string literals. -@@ -810,7 +829,7 @@ OutputType var2 = 1234_suffix; OutputType var3 = 3.1416_suffix; -
SWIG correctly parses the thread_local keyword. For example, variables @@ -818,7 +837,7 @@ reachable by the current thread can be defined as:
struct A {
- static thread_local int val;
+ static thread_local int val;
};
thread_local int global_val;
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. @@ -858,8 +877,8 @@ For example, the C++ compiler will not compile any code which attempts to use an
struct NoInt {
- void f(double i);
- void f(int) = delete;
+ void f(double i);
+ void f(int) = delete;
};
SWIG correctly parses and uses the new long long type already introduced in C99 some time ago.
--SWIG correctly parses the new static_assert declarations. +SWIG correctly parses the new static_assert declarations (though 3.0.12 and earlier +had a bug which meant this wasn't accepted at file scope). This is a C++ compile time directive so there isn't anything useful that SWIG can do with it.
@@ -888,7 +908,7 @@ struct Check { }; -@@ -909,7 +929,7 @@ const int SIZE = sizeof(A::member); // does not work with C++03. Okay with C++11 8 -
@@ -925,7 +945,7 @@ int noex2(int) noexcept(true); int noex3(int, bool) noexcept(false); -
@@ -957,7 +977,7 @@ Use the preprocessor to work around this for now: -
@@ -970,6 +990,104 @@ int [[attr1]] i [[attr2, attr3]]; [[noreturn, nothrow]] void f [[noreturn]] (); + +
+C++11 non-static member functions can be declared with ref-qualifiers. +Member functions declared with a & lvalue ref-qualifiers are wrapped like any other function without ref-qualifiers. +Member functions declared with a && rvalue ref-qualifiers are ignored by default +as they are unlikely to be required from non-C++ languages where the concept of rvalue-ness +for the implied *this pointer does not apply. +The warning is hidden by default, but can be displayed as described in the section on Enabling extra warnings. +
+ ++Consider: +
+ +
+struct RQ {
+ void m1(int x) &;
+ void m2(int x) &&;
+};
++The only wrapped method will be the lvalue ref-qualified method m1 +and if SWIG is run with the -Wextra command-line option, the following warning will be issued indicating m2 is not wrapped: +
+ ++example.i:7: Warning 405: Method with rvalue ref-qualifier m2(int) && ignored. ++
+If you unignore the method as follows, wrappers for m2 will be generated: +
+ +
+%feature("ignore", "0") RQ::m2(int x) &&;
+struct RQ {
+ void m1(int x) &;
+ void m2(int x) &&;
+};
++Inspection of the generated C++ code, will show that std::move is used on the instance +of the RQ * class: +
+ ++ RQ *arg1 = (RQ *) 0 ; + int arg2 ; + + arg1 = ...marshalled from target language... + arg2 = ...marshalled from target language... + + std::move(*arg1).m2(arg2); +
+This will compile but when run, the move effects may not be what you want. +As stated earlier, rvalue ref-qualifiers aren't really applicable outside the world of C++. +However, if you really know what you are doing, full control over the call to the method is +possible via the low-level "action" feature. +This feature completely replaces the call to the underlying function, that is, the last line in the snippet of code above. +
+ +
+%feature("ignore", "0") RQ::m2(int x) &&;
+%feature("action") RQ::m2(int x) && %{
+ RQ().m2(arg2);
+%}
+struct RQ {
+ void m1(int x) &;
+ void m2(int x) &&;
+};
++resulting in: +
+ ++ RQ *arg1 = (RQ *) 0 ; + int arg2 ; + + arg1 = ...marshalled from target language... + arg2 = ...marshalled from target language... + + RQ().m2(arg2); +
+Compatibility note: SWIG-4.0.0 was the first version to support ref-qualifiers. +
The new hash tables in the STL are unordered_set, unordered_multiset, unordered_map, unordered_multimap. -These are not available in SWIG, but in principle should be easily implemented by adapting the current STL containers. +These are not available in all target languages. +Any missing support can in principle be easily implemented by adapting the current STL containers.
t = Test() -b = t(1,2) # invoke C++ function object +b = t(1, 2) # invoke C++ function object