summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2022-01-19 16:42:25 +1300
committerOlly Betts <olly@survex.com>2022-01-19 16:42:25 +1300
commit869a02228bdb292fbbaf0f3d949f159666ff658a (patch)
tree15ec70e440775e8790362e4911490c21e71d1299
parent27b1644b270c57a1b99bf71491f4bf0fbf265a95 (diff)
parent76d5a9ec270a763c892ae28070e391cf99e0b7cd (diff)
downloadswig-869a02228bdb292fbbaf0f3d949f159666ff658a.tar.gz
Merge branch 'master' into php-type-hints
-rw-r--r--.github/workflows/ci.yml8
-rw-r--r--.travis.yml499
-rw-r--r--CHANGES.current22
-rw-r--r--Doc/Manual/Octave.html26
-rw-r--r--Doc/Manual/Perl5.html24
-rw-r--r--Doc/Manual/Php.html7
-rw-r--r--Examples/python/import/runme.py8
-rw-r--r--Examples/python/import_template/runme.py8
-rw-r--r--Examples/test-suite/cpp11_std_array.i2
-rw-r--r--Examples/test-suite/go/cpp11_std_array_runme.go68
-rw-r--r--Examples/test-suite/kwargs_feature.i1
-rw-r--r--Examples/test-suite/nested_class.i2
-rw-r--r--Examples/test-suite/perl5/operator_overload_break_runme.pl11
-rw-r--r--Examples/test-suite/perl5/operator_overload_runme.pl29
-rw-r--r--Examples/test-suite/perl5/packageoption_runme.pl9
-rw-r--r--Examples/test-suite/php/director_ownership_runme.php28
-rw-r--r--Examples/test-suite/python/Makefile.in3
-rw-r--r--Examples/test-suite/python/autodoc_runme.py22
-rw-r--r--Examples/test-suite/python/callback_runme.py12
-rw-r--r--Examples/test-suite/python/contract_runme.py6
-rw-r--r--Examples/test-suite/python/default_args_runme.py2
-rw-r--r--Examples/test-suite/python/director_abstract_runme.py2
-rw-r--r--Examples/test-suite/python/director_basic_runme.py8
-rw-r--r--Examples/test-suite/python/director_nested_runme.py2
-rw-r--r--Examples/test-suite/python/kwargs_feature_runme.py11
-rw-r--r--Examples/test-suite/python/li_boost_shared_ptr_runme.py2
-rw-r--r--Examples/test-suite/python/li_factory_runme.py4
-rw-r--r--Examples/test-suite/python/li_std_auto_ptr_runme.py6
-rw-r--r--Examples/test-suite/python/operator_overload_runme.py2
-rw-r--r--Examples/test-suite/python/overload_simple_runme.py12
-rw-r--r--Examples/test-suite/python/overload_template_runme.py2
-rw-r--r--Examples/test-suite/python/python_flatstaticmethod_runme.py85
-rw-r--r--Examples/test-suite/python/python_overload_simple_cast_runme.py12
-rw-r--r--Examples/test-suite/python/refcount_runme.py6
-rw-r--r--Examples/test-suite/python/return_const_value_runme.py4
-rw-r--r--Examples/test-suite/python/template_static_runme.py2
-rw-r--r--Examples/test-suite/python/typemap_out_optimal_runme.py2
-rw-r--r--Examples/test-suite/python/virtual_poly_runme.py4
-rw-r--r--Examples/test-suite/python/voidtest_runme.py2
-rw-r--r--Examples/test-suite/python_flatstaticmethod.i36
-rw-r--r--Lib/go/std_array.i43
-rw-r--r--Lib/perl5/perlhead.swg28
-rw-r--r--Lib/perl5/perlinit.swg4
-rw-r--r--Lib/perl5/perlrun.swg60
-rw-r--r--Lib/python/pyinit.swg13
-rw-r--r--RELEASENOTES2
-rw-r--r--Source/Modules/lang.cxx23
-rw-r--r--Source/Modules/perl5.cxx7
-rw-r--r--Source/Modules/python.cxx25
-rw-r--r--Source/Swig/cwrap.c15
-rwxr-xr-xTools/brew-install25
-rw-r--r--Tools/javascript/Makefile.in8
-rwxr-xr-xTools/mkdist.py12
-rwxr-xr-xTools/mkwindows.sh3
-rwxr-xr-xTools/travis-linux-install.sh11
-rwxr-xr-xTools/travis-osx-install.sh41
-rw-r--r--appveyor.yml2
-rw-r--r--configure.ac2
58 files changed, 476 insertions, 849 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3ec049e26..067ae63bf 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -76,6 +76,10 @@ jobs:
with:
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }}
+# Uncomment to debug via ssh, see https://github.com/mxschmitt/action-tmate
+# - name: Setup tmate session
+# uses: mxschmitt/action-tmate@v3
+
- name: Install Dependencies
run: |
set -x
@@ -176,8 +180,8 @@ jobs:
esac
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
- cflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC) && echo $cflags
- cxxflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC) && echo $cxxflags
+ cflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC)
+ cxxflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC)
make check-$SWIGLANG-version
make check-$SWIGLANG-enabled
make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags"
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c11479fed..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,499 +0,0 @@
-language: cpp
-matrix:
- include:
- - compiler: clang
- os: linux
- env: SWIGLANG=
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG= BUILDSYSTEM=cmake
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=4.4
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=4.6
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=4.7
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=4.8
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=4.9
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=6
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=7
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=8
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=9
- dist: xenial
- - os: linux
- env: SWIGLANG= GCC=10
- dist: focal
- - compiler: gcc
- os: linux
- env: SWIGLANG=csharp
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=d VER=2.066.0
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=d VER=2.086.1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=go VER=1.3
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=go VER=1.8
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=go VER=1.12 CSTD=gnu99
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=go VER=1.16 CSTD=gnu99
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=guile
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=java
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=6 CPP11=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=8 CPP11=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=12 CPP11=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=14 CPP11=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=node VER=16 CPP14=1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=jsc
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=javascript ENGINE=v8
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=lua
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=lua VER=5.3
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=mzscheme
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ocaml
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2
- dist: xenial # Octave v4.0.0
- - compiler: gcc
- os: linux
- env: SWIGLANG=octave SWIGJOBS=-j2 CPP11=1
- dist: bionic # Octave v4.2.2
- - compiler: gcc
- os: linux
- env: SWIGLANG=perl5
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.4
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=8.0
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.0 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.1 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.2 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.3 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=7.4 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=php VER=8.0 CONFIGOPTS=--enable-cpp11-testing CPPSTD=c++11
- dist: bionic
- - compiler: gcc
- os: linux
- env: SWIGLANG=python # 2.7
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.2
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.3
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.4
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.5
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.6
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.7
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.8
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python PY3=3 VER=3.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES="-builtin -O"
- dist: xenial
- - os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.4
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.5
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.7
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.8
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.9 SWIGOPTPY3=
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-O
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=r
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=1.9
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.0
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.1
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.2
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.3
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.4
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.5
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.6
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=2.7
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ruby VER=3.0 CSTD=c99
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=scilab
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=tcl
- dist: xenial
- - os: linux
- env: SWIGLANG=csharp CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=go VER=1.6 CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=java CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=r CPP11=1 # Note: making 'R CMD SHLIB' use a different compiler is non-trivial
- dist: xenial
- - os: linux
- env: SWIGLANG=ruby CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=tcl CPP11=1
- dist: xenial
- - os: linux
- env: SWIGLANG=csharp GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=go VER=1.6 GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=java GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=ruby GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=tcl GCC=6 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=java GCC=7 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python GCC=7 CPP14=1
- dist: xenial
- - os: linux
- env: SWIGLANG=csharp GCC=8 CPP17=1
- dist: xenial
- - os: linux
- env: SWIGLANG=java GCC=8 CPP17=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.9
- dist: xenial
- - os: linux
- env: SWIGLANG=csharp GCC=9 CPP17=1
- dist: xenial
- - os: linux
- env: SWIGLANG=java GCC=9 CPP17=1
- dist: xenial
- - os: linux
- env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.9
- dist: xenial
- - os: linux
- arch: s390x
- env: SWIGLANG=ruby CPP11=1
- dist: xenial
- - compiler: gcc
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG= BUILDSYSTEM=cmake
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=csharp
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=go CSTD=gnu99
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=guile CSTD=c11
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=java
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=lua
-# octave-6.1 not working
-# - compiler: clang
-# os: osx
-# osx_image: xcode12.2
-# env: SWIGLANG=octave SWIGJOBS=-j2 CPP11=1
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=perl5
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=python
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=python PY3=3
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=ruby
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=tcl
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=java CPP17=1
- - compiler: clang
- os: osx
- osx_image: xcode12.2
- env: SWIGLANG=python PY3=3 CPP17=1
-
- allow_failures:
- # Newer version of D not yet working/supported
- - compiler: gcc
- os: linux
- env: SWIGLANG=d VER=2.086.1
- dist: xenial
- # Experimental languages
- - compiler: gcc
- os: linux
- env: SWIGLANG=mzscheme
- dist: xenial
- - compiler: gcc
- os: linux
- env: SWIGLANG=ocaml
- dist: xenial
-
-before_install:
- - date -u
- - uname -a
- - if test "$TRAVIS_OS_NAME" = "linux"; then lscpu; grep "model name" /proc/cpuinfo || echo 'Unknown CPU model'; grep "MemTotal" /proc/meminfo || echo 'Unknown system memory amount'; 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 "$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
- - ls -la $(which $CC) $(which $CXX) && $CC --version && $CXX --version
-script:
- - if test "$BUILDSYSTEM" = "cmake"; then cmake --version && mkdir -p build/build && cd build/build && CXXFLAGS="-Wall -Wextra -Werror" CFLAGS="-Wall -Wextra -Werror" cmake -DCMAKE_INSTALL_PREFIX=~/.local ../.. && make install && ctest --output-on-failure -V && exit 0; fi
- - echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
- - if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++11 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++11; fi
- - if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++14 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++14; fi
- - if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++17 $CXXFLAGS" "CFLAGS=-std=c17 $CFLAGS") && 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[@]}"
- - echo -en 'travis_fold:end:script.1\\r'
- - make -s $SWIGJOBS
- - ./swig -version && ./swig -pcreversion
- - if test -z "$SWIGLANG"; then make -s $SWIGJOBS check-ccache; fi
- - if test -z "$SWIGLANG"; then make -s $SWIGJOBS check-errors-test-suite; fi
- - 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 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'
- # Skip on osx as often fails with: rm: Resource temporarily unavailable
- - if test "$TRAVIS_OS_NAME" != "osx"; then make check-maintainer-clean && ../../configure $CONFIGOPTS; fi
- - echo -en 'travis_fold:end:script.3\\r'
diff --git a/CHANGES.current b/CHANGES.current
index fc56246c6..5aa435e15 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,11 +7,33 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress)
===========================
+2022-01-18: olly
+ [Perl] #1629 Perl 5.8.0 is now the oldest version we aim to support.
+
+2022-01-14: wsfulton
+ [Python] Fix %callback and specifying the callback function as a
+ static member function using Python staticmethod syntax, such as
+ Klass.memberfunction instead of Klass_memberfunction when using
+ -builtin and -fastproxy.
+
+2022-01-11: wsfulton
+ [Python] Accept keyword arguments accessing static member functions when
+ using -builtin and kwargs feature and Python class staticmethod syntax.
+ The missing keyword argument support was only when using the
+ class staticmethod syntax, such as Klass.memberfunction, and not when
+ using the flat static method syntax, such as Klass_memberfunction.
+
+2022-01-04: juierror
+ [Go] #2045 Add support for std::array in std_array.i.
+
2021-12-18: olly
[PHP] Add PHP keyword 'readonly' (added in 8.1) to the list SWIG
knows to automatically rename. This keyword is special in that PHP
allows it to be used as a function (or method) name.
+2021-12-07: vstinner
+ [Python] #2116 Python 3.11 support: use Py_SET_TYPE()
+
2021-12-05: rwf1
[Octave] #2020 #1893 Add support for Octave 6 up to and including 6.4.
Also add support for compiling with -Bsymbolic which is used by default
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index bdef5db7c..151957cff 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -570,13 +570,13 @@ __mul__ a * b
__div__ a / b
__pow__ a ^ b
__ldiv__ a \ b
-__lshift__ a << b
-__rshift__ a >> b
-__lt__ a < b
-__le__ a <= b
+__lshift__ a &lt;&lt; b
+__rshift__ a &gt;&gt; b
+__lt__ a &lt; b
+__le__ a &lt;= b
__eq__ a == b
-__ge__ a >= b
-__gt__ a > b
+__ge__ a &gt;= b
+__gt__ a &gt; b
__ne__ a != b
__el_mul__ a .* b
__el_div__ a ./ b
@@ -598,16 +598,16 @@ On the C++ side, the default mappings are as follows:
%rename(__mul__) *::operator*;
%rename(__div__) *::operator/;
%rename(__mod__) *::operator%;
-%rename(__lshift__) *::operator<<;
-%rename(__rshift__) *::operator>>;
+%rename(__lshift__) *::operator&lt;&lt;;
+%rename(__rshift__) *::operator&gt;&gt;;
%rename(__el_and__) *::operator&amp;&amp;;
%rename(__el_or__) *::operator||;
%rename(__xor__) *::operator^;
%rename(__invert__) *::operator~;
-%rename(__lt__) *::operator<;
-%rename(__le__) *::operator<=;
-%rename(__gt__) *::operator>;
-%rename(__ge__) *::operator>=;
+%rename(__lt__) *::operator&lt;;
+%rename(__le__) *::operator&lt;=;
+%rename(__gt__) *::operator&gt;;
+%rename(__ge__) *::operator&gt;=;
%rename(__eq__) *::operator==;
%rename(__ne__) *::operator!=;
%rename(__not__) *::operator!;
@@ -634,7 +634,7 @@ You can use it to define special behavior, like for example defining Octave oper
%extend A {
string __str__() {
stringstream sout;
- sout&lt;&lt;$self->value;
+ sout&lt;&lt;$self-&gt;value;
return sout.str();
}
}
diff --git a/Doc/Manual/Perl5.html b/Doc/Manual/Perl5.html
index 85c2545cf..03dcfe6bb 100644
--- a/Doc/Manual/Perl5.html
+++ b/Doc/Manual/Perl5.html
@@ -91,10 +91,10 @@
<p>
This chapter describes SWIG's support of Perl5. Although the Perl5
module is one of the earliest SWIG modules, it has continued to evolve
-and has been improved greatly with the help of SWIG users. For the
-best results, it is recommended that SWIG be used with Perl 5.8 or
-later. We're no longer testing regularly with older versions, but
-Perl 5.6 seems to mostly work, while older versions don't.
+and has been improved greatly with the help of SWIG users. As of SWIG
+4.1.0, the minimum version of Perl we aim to support is Perl 5.8.0.
+We can no longer easily test with older versions, and they no longer
+seem to be in active use.
</p>
<H2><a name="Perl5_nn2">31.1 Overview</a></H2>
@@ -680,7 +680,6 @@ files(s) field".
installation under "Additional include directories".
<li>Define the symbols WIN32 and MSWIN32 under preprocessor options.
-If using the ActiveWare port, also define the symbol PERL_OBJECT.
Note that all extensions to the ActiveWare port must be compiled with
the C++ compiler since Perl has been encapsulated in a C++ class.
@@ -2651,8 +2650,8 @@ constructors and destructors for the package and are always named
"new" and "DESTROY". The constructor always returns a tied hash
table. This hash table is used to access the member variables of a
structure in addition to being able to invoke member functions. The
-<tt>%OWNER</tt> and <tt>%BLESSEDMEMBERS</tt> hash tables are used
-internally and described shortly.
+<tt>%OWNER</tt> and <tt>%BLESSEDMEMBERS</tt> hash tables are
+implementation details used internally and described shortly.
</p>
<p>
@@ -2740,8 +2739,15 @@ to a C function that remembers the object, and then destroy the
corresponding Perl object (this situation turns out to come up
frequently when constructing objects like linked lists and trees).
When C takes possession of an object, you can change Perl's ownership
-by simply deleting the object from the <tt>%OWNER</tt> hash. This is
-done using the <tt>DISOWN</tt> method.
+by calling the <tt>DISOWN</tt> method (which will delete the object
+from the internal <tt>%OWNER</tt> hash).
+</p>
+
+<p>
+The <tt>%OWNER</tt> hash is an implementation detail, discussed here
+only to help clarify the operation of <tt>ACQUIRE</tt> and <tt>DISOWN</tt>.
+You should not access <tt>%OWNER</tt> directly - the details of how it
+works (and possibly even its existence) may chance in future SWIG versions.
</p>
<div class="targetlang"><pre>
diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html
index 77efb9f51..2df245ecb 100644
--- a/Doc/Manual/Php.html
+++ b/Doc/Manual/Php.html
@@ -819,7 +819,10 @@ class Ko {
};
</pre></div>
-would be executed in PHP as,
+<p>
+would be executed in PHP as
+</p>
+
<div class="code"><pre>
Ko::threats();
</pre></div>
@@ -1235,7 +1238,7 @@ should suffice in most cases:
</div>
<p>
-If you only need to support SWIG >= 4.1.0, you can just use the
+If you only need to support SWIG &gt;= 4.1.0, you can just use the
<tt>($error != NULL)</tt> condition.
</p>
diff --git a/Examples/python/import/runme.py b/Examples/python/import/runme.py
index afa21a2b3..7970dec26 100644
--- a/Examples/python/import/runme.py
+++ b/Examples/python/import/runme.py
@@ -84,14 +84,14 @@ x.B()
print("\nTesting some dynamic casts\n")
x = d.toBase()
-y = foo.Foo_fromBase(x)
+y = foo.Foo.fromBase(x)
print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
-y = bar.Bar_fromBase(x)
+y = bar.Bar.fromBase(x)
print(" Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
-y = spam.Spam_fromBase(x)
+y = spam.Spam.fromBase(x)
print(" Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
-y = spam.Spam_fromBase(b)
+y = spam.Spam.fromBase(b)
print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/python/import_template/runme.py b/Examples/python/import_template/runme.py
index b14f8d35e..74a918426 100644
--- a/Examples/python/import_template/runme.py
+++ b/Examples/python/import_template/runme.py
@@ -84,14 +84,14 @@ x.B()
print("\nTesting some dynamic casts\n")
x = d.toBase()
-y = foo.intFoo_fromBase(x)
+y = foo.intFoo.fromBase(x)
print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
-y = bar.intBar_fromBase(x)
+y = bar.intBar.fromBase(x)
print(" Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
-y = spam.intSpam_fromBase(x)
+y = spam.intSpam.fromBase(x)
print(" Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
-y = spam.intSpam_fromBase(b)
+y = spam.intSpam.fromBase(b)
print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/test-suite/cpp11_std_array.i b/Examples/test-suite/cpp11_std_array.i
index 3d4771551..9dc11ce9e 100644
--- a/Examples/test-suite/cpp11_std_array.i
+++ b/Examples/test-suite/cpp11_std_array.i
@@ -1,6 +1,6 @@
%module cpp11_std_array
-#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGJAVA) || defined(SWIGCSHARP)
+#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGGO)
%{
#include <array>
diff --git a/Examples/test-suite/go/cpp11_std_array_runme.go b/Examples/test-suite/go/cpp11_std_array_runme.go
new file mode 100644
index 000000000..97b5df2ec
--- /dev/null
+++ b/Examples/test-suite/go/cpp11_std_array_runme.go
@@ -0,0 +1,68 @@
+package main
+
+import (
+ "fmt"
+ "swigtests/cpp11_std_array"
+)
+
+func CompareContainers(actual cpp11_std_array.ArrayInt6, expected [6]int) error {
+ if int(actual.Size()) != len(expected) {
+ return fmt.Errorf("Sizes are different: %d %d", actual.Size(), len(expected))
+ }
+ for i := 0; i < int(actual.Size()); i++ {
+ actualValue := actual.Get(i)
+ expectedValue := expected[i]
+ if actualValue != expectedValue {
+ return fmt.Errorf("Value is wrong for element %d. Expected %d got: %d", i, expectedValue, actualValue)
+ }
+ }
+ if actual.IsEmpty() {
+ return fmt.Errorf("ai should not be empty")
+ }
+ return nil
+}
+
+func main() {
+ ai := cpp11_std_array.NewArrayInt6()
+ ps := [6]int{0, 0, 0, 0, 0, 0}
+ CompareContainers(ai, ps)
+
+ vals := [6]int{10, 20, 30, 40, 50, 60}
+ for i := 0; i < len(vals); i++ {
+ ai.Set(i, vals[i])
+ }
+ CompareContainers(ai, vals);
+
+ // Check return
+ vals = [6]int{-2, -1, 0, 0, 1, 2}
+ CompareContainers(cpp11_std_array.ArrayOutVal(), vals);
+ CompareContainers(cpp11_std_array.ArrayOutConstRef(), vals);
+ CompareContainers(cpp11_std_array.ArrayOutRef(), vals);
+ CompareContainers(cpp11_std_array.ArrayOutPtr(), vals);
+
+ // Check passing arguments
+ vals = [6]int{9, 8, 7, 6, 5, 4}
+ valsArrayInt6 := cpp11_std_array.NewArrayInt6()
+ for i := 0; i < len(vals); i++ {
+ valsArrayInt6.Set(i, vals[i])
+ }
+
+ ai = cpp11_std_array.ArrayInVal(valsArrayInt6);
+ CompareContainers(ai, vals);
+
+ ai = cpp11_std_array.ArrayInConstRef(valsArrayInt6);
+ CompareContainers(ai, vals);
+
+ ai = cpp11_std_array.NewArrayInt6(valsArrayInt6);
+ cpp11_std_array.ArrayInRef(ai);
+ CompareContainers(ai, vals);
+
+ ai = cpp11_std_array.NewArrayInt6(valsArrayInt6);
+ cpp11_std_array.ArrayInPtr(ai);
+ CompareContainers(ai, vals);
+
+ // Fill
+ ai.Fill(111)
+ vals = [6]int{111, 111, 111, 111, 111, 111}
+ CompareContainers(ai, vals);
+}
diff --git a/Examples/test-suite/kwargs_feature.i b/Examples/test-suite/kwargs_feature.i
index dd5b2638d..6db4d407b 100644
--- a/Examples/test-suite/kwargs_feature.i
+++ b/Examples/test-suite/kwargs_feature.i
@@ -27,6 +27,7 @@
virtual int foo(int a = 1, int b = 0) {return a + b; }
static int statfoo(int a = 1, int b = 0) {return a + b; }
+ static int statfoo_onearg(int x = 10) {return x + x; }
static Foo *create(int a = 1, int b = 0)
{
diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i
index b10c33949..c778a12cf 100644
--- a/Examples/test-suite/nested_class.i
+++ b/Examples/test-suite/nested_class.i
@@ -201,7 +201,7 @@ struct Outer {
Integer xx;
} MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
-#if defined(__GNUC__) || defined(_MSC_VER) || defined(SWIG)
+#if (defined(__GNUC__) && __GNUC__ < 12) || defined(_MSC_VER) || defined(SWIG)
/* some compilers do not accept these */
struct : public InnerMultiple {
Integer xx;
diff --git a/Examples/test-suite/perl5/operator_overload_break_runme.pl b/Examples/test-suite/perl5/operator_overload_break_runme.pl
index fd3fe3303..c692dfac7 100644
--- a/Examples/test-suite/perl5/operator_overload_break_runme.pl
+++ b/Examples/test-suite/perl5/operator_overload_break_runme.pl
@@ -4,15 +4,6 @@ use Test::More tests => 9;
use operator_overload_break;
-# Workaround for
-# ok( not (expression) , "test description" );
-# does not working in older versions of Perl, eg 5.004_04
-sub ok_not ($;$) {
- my($test, $name) = @_;
- $test = not $test;
- ok($test, $name);
-}
-
pass("loaded");
my $op = operator_overload_break::Op->new(5);
@@ -32,7 +23,7 @@ $op->{k} = 22;
ok((10 == (32 - $op)),
"reversed subtraction");
-ok_not((3 == $op),
+ok(not(3 == $op),
'not equal');
$op->{k} = 3;
diff --git a/Examples/test-suite/perl5/operator_overload_runme.pl b/Examples/test-suite/perl5/operator_overload_runme.pl
index ba3f33a64..43a77a961 100644
--- a/Examples/test-suite/perl5/operator_overload_runme.pl
+++ b/Examples/test-suite/perl5/operator_overload_runme.pl
@@ -4,15 +4,6 @@ use Test::More tests => 39;
use operator_overload;
-# Workaround for
-# ok( not (expression) , "test description" );
-# does not working in older versions of Perl, eg 5.004_04
-sub ok_not ($;$) {
- my($test, $name) = @_;
- $test = not $test;
- ok($test, $name);
-}
-
pass("loaded");
# first check all the operators are implemented correctly from pure C++ code
@@ -30,7 +21,7 @@ isa_ok($op2, "operator_overload::Op");
$op->{i} = 5;
$op2->{i} = 3;
-ok_not(($op == $op2), "operator equal: not equal");
+ok(not($op == $op2), "operator equal: not equal");
$op->{i} = 3;
ok(($op == $op2), "operator equal: equal");
@@ -42,7 +33,7 @@ $op2->{i} = 3;
ok(($op != $op2), "operator not equal: not equal");
$op->{i} = 3;
-ok_not(($op != $op2), "operator not equal: equal");
+ok(not($op != $op2), "operator not equal: equal");
# stringify operator
$op->{i} = 3;
@@ -99,16 +90,16 @@ is($op3->{i}, 2, "operator modulus");
$op->{i} = 8;
$op2->{i} = 3;
ok($op > $op2, "operator greater than");
-ok_not(($op2 > $op), "operator greater than");
+ok(not($op2 > $op), "operator greater than");
$op->{i} = 3;
-ok_not(($op2 > $op), "operator greater than");
-ok_not(($op > $op2), "operator greater than");
+ok(not($op2 > $op), "operator greater than");
+ok(not($op > $op2), "operator greater than");
# greater than or equal operator
$op->{i} = 8;
$op2->{i} = 3;
ok($op >= $op2, "operator greater than or equal");
-ok_not(($op2 >= $op), "operator greater than or equal");
+ok(not($op2 >= $op), "operator greater than or equal");
$op->{i} = 3;
ok(($op2 >= $op), "operator greater than or equal");
ok(($op >= $op2), "operator greater than or equal");
@@ -117,16 +108,16 @@ ok(($op >= $op2), "operator greater than or equal");
$op2->{i} = 8;
$op->{i} = 3;
ok($op < $op2, "operator lesser than");
-ok_not(($op2 < $op), "operator lesser than");
+ok(not($op2 < $op), "operator lesser than");
$op2->{i} = 3;
-ok_not(($op2 < $op), "operator lesser than");
-ok_not(($op < $op2), "operator lesser than");
+ok(not($op2 < $op), "operator lesser than");
+ok(not($op < $op2), "operator lesser than");
# less than or equal operator
$op2->{i} = 8;
$op->{i} = 3;
ok($op <= $op2, "operator lesser than or equal");
-ok_not(($op2 <= $op), "operator lesser than or equal");
+ok(not($op2 <= $op), "operator lesser than or equal");
$op2->{i} = 3;
ok(($op2 <= $op), "operator less than or equal");
ok(($op <= $op2), "operator less than or equal");
diff --git a/Examples/test-suite/perl5/packageoption_runme.pl b/Examples/test-suite/perl5/packageoption_runme.pl
index d94a7a1fd..02e95f7a8 100644
--- a/Examples/test-suite/perl5/packageoption_runme.pl
+++ b/Examples/test-suite/perl5/packageoption_runme.pl
@@ -5,15 +5,6 @@ use Test::More tests => 4;
BEGIN { use_ok('packageoption_a'); }
BEGIN { use_ok('packageoption_b'); }
-# Workaround for
-# ok( not (expression) , "test description" );
-# does not working in older versions of Perl, eg 5.004_04
-sub ok_not ($;$) {
- my($test, $name) = @_;
- $test = not $test;
- ok($test, $name);
-}
-
my $a = CommonPackage::A->new();
isa_ok($a, 'CommonPackage::A');
diff --git a/Examples/test-suite/php/director_ownership_runme.php b/Examples/test-suite/php/director_ownership_runme.php
new file mode 100644
index 000000000..a78fb9c03
--- /dev/null
+++ b/Examples/test-suite/php/director_ownership_runme.php
@@ -0,0 +1,28 @@
+<?php
+require "tests.php";
+
+check::functions(array('make_content'));
+check::classes(array('ContentBase','ContentDerived','Container','director_ownership'));
+// No new vars
+check::globals(array());
+
+function set_content_and_release(Container $container, ContentBase $content) {
+ $content->thisown = false;
+ $container->set_content($content);
+}
+
+$container = new Container();
+
+// make a content in PHP (newobject is 1)
+$content_php = new ContentDerived();
+
+// make a content in C++ (newobject is 1)
+$content_cpp = make_content();
+
+set_content_and_release($container, $content_php);
+check::equal($container->get_content()->get_name(), "ContentDerived", "get_content() not ContentDerived");
+
+set_content_and_release($container, $content_cpp);
+check::equal($container->get_content()->get_name(), "ContentDerived", "get_content() not ContentDerived");
+
+check::done();
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index 0bdbad51e..a5f2670d8 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -54,6 +54,7 @@ CPP_TEST_CASES += \
python_director \
python_docstring \
python_extranative \
+ python_flatstaticmethod \
python_moduleimport \
python_overload_simple_cast \
python_pickle \
@@ -97,7 +98,7 @@ LIBS = -L.
VALGRIND_OPT += --suppressions=pythonswig.supp
# Custom tests - tests with additional commandline options
-# none!
+#python_flatstaticmethod.cpptest: SWIGOPT += -flatstaticmethod
# Rules for the different types of tests
%.cpptest:
diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py
index 7bc918644..960458584 100644
--- a/Examples/test-suite/python/autodoc_runme.py
+++ b/Examples/test-suite/python/autodoc_runme.py
@@ -65,14 +65,10 @@ check(inspect.getdoc(A.func0static),
"func0static(e, arg2, hello, f=2) -> int")
check(inspect.getdoc(_autodoc.A_func0static),
"A_func0static(e, arg2, hello, f=2) -> int")
-check(inspect.getdoc(A_func0static),
- "A_func0static(e, arg2, hello, f=2) -> int")
check(inspect.getdoc(A.func1static),
"func1static(A e, short arg2, Tuple hello, double f=2) -> int")
check(inspect.getdoc(_autodoc.A_func1static),
"A_func1static(A e, short arg2, Tuple hello, double f=2) -> int")
-check(inspect.getdoc(A_func1static),
- "A_func1static(A e, short arg2, Tuple hello, double f=2) -> int")
check(inspect.getdoc(A.func2static),
"func2static(e, arg2, hello, f=2) -> int\n"
"\n"
@@ -91,15 +87,6 @@ check(inspect.getdoc(_autodoc.A_func2static),
"arg2: short\n"
"hello: int tuple[2]\n"
"f: double")
-check(inspect.getdoc(A_func2static),
- "A_func2static(e, arg2, hello, f=2) -> int\n"
- "\n"
- "Parameters\n"
- "----------\n"
- "e: A *\n"
- "arg2: short\n"
- "hello: int tuple[2]\n"
- "f: double")
check(inspect.getdoc(A.func3static),
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
@@ -118,15 +105,6 @@ check(inspect.getdoc(_autodoc.A_func3static),
"arg2: short\n"
"hello: int tuple[2]\n"
"f: double")
-check(inspect.getdoc(A_func3static),
- "A_func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
- "\n"
- "Parameters\n"
- "----------\n"
- "e: A *\n"
- "arg2: short\n"
- "hello: int tuple[2]\n"
- "f: double")
check(inspect.getdoc(A.variable_a),
"variable_a"
diff --git a/Examples/test-suite/python/callback_runme.py b/Examples/test-suite/python/callback_runme.py
index de8a372f6..dbf957cbb 100644
--- a/Examples/test-suite/python/callback_runme.py
+++ b/Examples/test-suite/python/callback_runme.py
@@ -1,10 +1,14 @@
import _callback
from callback import *
+# callbacks are implemented by modifying docstrings, useful for debugging:
+# print("A_bar doc: {}".format(A_bar.__doc__))
+# print("A.bar doc: {}".format(A.bar.__doc__))
+
if foo(2) != 2:
raise RuntimeError
-if A_bar(2) != 4:
+if A.bar(2) != 4:
raise RuntimeError
if foobar(3, _callback.foo) != foo(3):
@@ -13,11 +17,7 @@ if foobar(3, _callback.foo) != foo(3):
if foobar(3, foo) != foo(3):
raise RuntimeError
-# Needs some more work for -builtin
-# if foobar(3, A.bar) != A.bar(3):
-# raise RuntimeError
-
-if foobar(3, A_bar) != A_bar(3):
+if foobar(3, A.bar) != A.bar(3):
raise RuntimeError
if foobar(3, foof) != foof(3):
diff --git a/Examples/test-suite/python/contract_runme.py b/Examples/test-suite/python/contract_runme.py
index b6bab3a09..3194b6ac7 100644
--- a/Examples/test-suite/python/contract_runme.py
+++ b/Examples/test-suite/python/contract_runme.py
@@ -58,15 +58,15 @@ try:
except RuntimeError:
pass
-contract.Foo_stest_prepost(4, 0)
+contract.Foo.stest_prepost(4, 0)
try:
- contract.Foo_stest_prepost(-4, 2)
+ contract.Foo.stest_prepost(-4, 2)
raise Exception("Failed! Static method preassertion")
except RuntimeError:
pass
try:
- contract.Foo_stest_prepost(4, -10)
+ contract.Foo.stest_prepost(4, -10)
raise Exception("Failed! Static method posteassertion")
except RuntimeError:
pass
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 0ce47ab79..b8077cc28 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -12,7 +12,7 @@ def run(module_name):
de.accelerate()
de.accelerate(default_args.EnumClass.SLOW)
- if default_args.Statics_staticMethod() != 60:
+ if default_args.Statics.staticMethod() != 60:
raise RuntimeError
if default_args.cfunc1(1) != 2:
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index c8c4b36dc..fbc54808e 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -37,7 +37,7 @@ class MyExample3(director_abstract.Example3_i):
return b
me1 = MyExample1()
-if director_abstract.Example1_get_color(me1, 1, 2, 3) != 1:
+if director_abstract.Example1.get_color(me1, 1, 2, 3) != 1:
raise RuntimeError
me2 = MyExample2(1, 2)
diff --git a/Examples/test-suite/python/director_basic_runme.py b/Examples/test-suite/python/director_basic_runme.py
index 79cd0e2eb..2d07c3ad5 100644
--- a/Examples/test-suite/python/director_basic_runme.py
+++ b/Examples/test-suite/python/director_basic_runme.py
@@ -44,8 +44,8 @@ b = director_basic.Bar(3)
d = director_basic.MyClass()
c = PyClass()
-cc = director_basic.MyClass_get_self(c)
-dd = director_basic.MyClass_get_self(d)
+cc = director_basic.MyClass.get_self(c)
+dd = director_basic.MyClass.get_self(d)
bc = cc.cmethod(b)
bd = dd.cmethod(b)
@@ -86,8 +86,8 @@ for i in range(0, 100):
pymult = PyMulti()
-p1 = director_basic.Foo_get_self(pymult)
-p2 = director_basic.MyClass_get_self(pymult)
+p1 = director_basic.Foo.get_self(pymult)
+p2 = director_basic.MyClass.get_self(pymult)
p1.ping()
p2.vmethod(bc)
diff --git a/Examples/test-suite/python/director_nested_runme.py b/Examples/test-suite/python/director_nested_runme.py
index b2c4b0d40..24216f9dd 100644
--- a/Examples/test-suite/python/director_nested_runme.py
+++ b/Examples/test-suite/python/director_nested_runme.py
@@ -54,7 +54,7 @@ class C(FooBar_int):
pass
cc = C()
-c = FooBar_int_get_self(cc)
+c = FooBar_int.get_self(cc)
c.advance()
if c.get_name() != "FooBar::get_name hello":
diff --git a/Examples/test-suite/python/kwargs_feature_runme.py b/Examples/test-suite/python/kwargs_feature_runme.py
index 387658ec3..677c9ebd8 100644
--- a/Examples/test-suite/python/kwargs_feature_runme.py
+++ b/Examples/test-suite/python/kwargs_feature_runme.py
@@ -15,13 +15,16 @@ f = Foo(b=2, a=1)
if f.foo(b=1, a=2) != 3:
raise RuntimeError
-if Foo_statfoo(b=2) != 3:
+if Foo.statfoo(b=2) != 3:
+ raise RuntimeError
+
+if Foo.statfoo_onearg(x=4) != 8:
raise RuntimeError
if f.efoo(b=2) != 3:
raise RuntimeError
-if Foo_sfoo(b=2) != 3:
+if Foo.sfoo(b=2) != 3:
raise RuntimeError
@@ -31,13 +34,13 @@ b = BarInt(b=2, a=1)
if b.bar(b=1, a=2) != 3:
raise RuntimeError
-if BarInt_statbar(b=2) != 3:
+if BarInt.statbar(b=2) != 3:
raise RuntimeError
if b.ebar(b=2) != 3:
raise RuntimeError
-if BarInt_sbar(b=2) != 3:
+if BarInt.sbar(b=2) != 3:
raise RuntimeError
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
index ecda7fdb1..2e241d590 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
@@ -20,7 +20,7 @@ class li_boost_shared_ptr_runme:
self.runtest()
# Expect 1 instance - the one global variable (GlobalValue)
- if (li_boost_shared_ptr.Klass_getTotal_count() != 1):
+ if (li_boost_shared_ptr.Klass.getTotal_count() != 1):
raise RuntimeError("Klass.total_count=%s" %
li_boost_shared_ptr.Klass.getTotal_count())
diff --git a/Examples/test-suite/python/li_factory_runme.py b/Examples/test-suite/python/li_factory_runme.py
index fb2c81e45..ce0e3caef 100644
--- a/Examples/test-suite/python/li_factory_runme.py
+++ b/Examples/test-suite/python/li_factory_runme.py
@@ -1,11 +1,11 @@
from li_factory import *
-circle = Geometry_create(Geometry.CIRCLE)
+circle = Geometry.create(Geometry.CIRCLE)
r = circle.radius()
if (r != 1.5):
raise RuntimeError
-point = Geometry_create(Geometry.POINT)
+point = Geometry.create(Geometry.POINT)
w = point.width()
if (w != 1.0):
raise RuntimeError
diff --git a/Examples/test-suite/python/li_std_auto_ptr_runme.py b/Examples/test-suite/python/li_std_auto_ptr_runme.py
index 6d2479f87..d62224ff6 100644
--- a/Examples/test-suite/python/li_std_auto_ptr_runme.py
+++ b/Examples/test-suite/python/li_std_auto_ptr_runme.py
@@ -2,16 +2,16 @@ from li_std_auto_ptr import *
k1 = makeKlassAutoPtr("first")
k2 = makeKlassAutoPtr("second")
-if Klass_getTotal_count() != 2:
+if Klass.getTotal_count() != 2:
raise "number of objects should be 2"
del k1
-if Klass_getTotal_count() != 1:
+if Klass.getTotal_count() != 1:
raise "number of objects should be 1"
if k2.getLabel() != "second":
raise "wrong object label"
del k2
-if Klass_getTotal_count() != 0:
+if Klass.getTotal_count() != 0:
raise "no objects should be left"
diff --git a/Examples/test-suite/python/operator_overload_runme.py b/Examples/test-suite/python/operator_overload_runme.py
index 31c49058e..cd565f619 100644
--- a/Examples/test-suite/python/operator_overload_runme.py
+++ b/Examples/test-suite/python/operator_overload_runme.py
@@ -1,7 +1,7 @@
from operator_overload import *
# first check all the operators are implemented correctly from pure C++ code
-Op_sanity_check()
+Op.sanity_check()
pop = Op(6)/Op(3)
diff --git a/Examples/test-suite/python/overload_simple_runme.py b/Examples/test-suite/python/overload_simple_runme.py
index 8ad813b86..56763828d 100644
--- a/Examples/test-suite/python/overload_simple_runme.py
+++ b/Examples/test-suite/python/overload_simple_runme.py
@@ -43,22 +43,22 @@ if s.foo(b) != "foo:Bar *":
if s.foo(v) != "foo:void *":
raise RuntimeError("Spam::foo(void *)")
-if Spam_bar(3) != "bar:int":
+if Spam.bar(3) != "bar:int":
raise RuntimeError("Spam::bar(int)")
-if Spam_bar(3.0) != "bar:double":
+if Spam.bar(3.0) != "bar:double":
raise RuntimeError("Spam::bar(double)")
-if Spam_bar("hello") != "bar:char *":
+if Spam.bar("hello") != "bar:char *":
raise RuntimeError("Spam::bar(char *)")
-if Spam_bar(f) != "bar:Foo *":
+if Spam.bar(f) != "bar:Foo *":
raise RuntimeError("Spam::bar(Foo *)")
-if Spam_bar(b) != "bar:Bar *":
+if Spam.bar(b) != "bar:Bar *":
raise RuntimeError("Spam::bar(Bar *)")
-if Spam_bar(v) != "bar:void *":
+if Spam.bar(v) != "bar:void *":
raise RuntimeError("Spam::bar(void *)")
# Test constructors
diff --git a/Examples/test-suite/python/overload_template_runme.py b/Examples/test-suite/python/overload_template_runme.py
index a484d8f0e..8bd105add 100644
--- a/Examples/test-suite/python/overload_template_runme.py
+++ b/Examples/test-suite/python/overload_template_runme.py
@@ -140,6 +140,6 @@ if (nsoverload() != 1050):
raise RuntimeError(("nsoverload(const char *)"))
-A_foo(1)
+A.foo(1)
b = B()
b.foo(1)
diff --git a/Examples/test-suite/python/python_flatstaticmethod_runme.py b/Examples/test-suite/python/python_flatstaticmethod_runme.py
new file mode 100644
index 000000000..f34670013
--- /dev/null
+++ b/Examples/test-suite/python/python_flatstaticmethod_runme.py
@@ -0,0 +1,85 @@
+from python_flatstaticmethod import *
+import inspect
+
+# This testcase tests C++ class static functions when using legacy "flattened"
+# staticmethod access, A_bar, as well as the normal staticmethod access, A.bar.
+
+
+def check(got, expected):
+ if got != expected:
+ raise RuntimeError("\ngot :{}\nwant:{}\n".format(got, expected))
+
+if A_bar(2) != 4:
+ raise RuntimeError
+
+if A.bar(2) != 4:
+ raise RuntimeError
+
+# %callback
+if foobar(3, A_bar) != A_bar(3):
+ raise RuntimeError
+
+if foobar(3, A.bar) != A_bar(3):
+ raise RuntimeError
+
+# kwargs
+if A_pub() != 1:
+ raise RuntimeError
+
+if A_pub(b=2) != 3:
+ raise RuntimeError
+
+if A_pub(b=10,a=20) != 30:
+ raise RuntimeError
+
+if A.pub() != 1:
+ raise RuntimeError
+
+if A.pub(b=2) != 3:
+ raise RuntimeError
+
+if A.pub(b=10,a=20) != 30:
+ raise RuntimeError
+
+check(inspect.getdoc(A_func0static),
+ "A_func0static(e, arg2, hello, f=2) -> int")
+check(inspect.getdoc(A_func1static),
+ "A_func1static(A e, short arg2, Tuple hello, double f=2) -> int")
+
+# overloaded static functions
+if A_over(3) != "over:int":
+ raise RuntimeError("A::over(int)")
+
+if A_over(3.0) != "over:double":
+ raise RuntimeError("A::over(double)")
+
+if A_over("hello") != "over:char *":
+ raise RuntimeError("A::over(char *)")
+
+if A.over(3) != "over:int":
+ raise RuntimeError("A::over(int)")
+
+if A.over(3.0) != "over:double":
+ raise RuntimeError("A::over(double)")
+
+if A.over("hello") != "over:char *":
+ raise RuntimeError("A::over(char *)")
+
+# default args
+if A_defargs() != 30:
+ raise RuntimeError
+
+if A_defargs(1) != 21:
+ raise RuntimeError
+
+if A_defargs(1, 2) != 3:
+ raise RuntimeError
+
+if A.defargs() != 30:
+ raise RuntimeError
+
+if A.defargs(1) != 21:
+ raise RuntimeError
+
+if A.defargs(1, 2) != 3:
+ raise RuntimeError
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
index 7a0174af8..2aee5bb53 100644
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -115,22 +115,22 @@ if s.foo(b) != "foo:Bar *":
if s.foo(v) != "foo:void *":
raise RuntimeError("Spam::foo(void *)")
-if Spam_bar(3) != "bar:int":
+if Spam.bar(3) != "bar:int":
raise RuntimeError("Spam::bar(int)")
-if Spam_bar(3.0) != "bar:double":
+if Spam.bar(3.0) != "bar:double":
raise RuntimeError("Spam::bar(double)")
-if Spam_bar("hello") != "bar:char *":
+if Spam.bar("hello") != "bar:char *":
raise RuntimeError("Spam::bar(char *)")
-if Spam_bar(f) != "bar:Foo *":
+if Spam.bar(f) != "bar:Foo *":
raise RuntimeError("Spam::bar(Foo *)")
-if Spam_bar(b) != "bar:Bar *":
+if Spam.bar(b) != "bar:Bar *":
raise RuntimeError("Spam::bar(Bar *)")
-if Spam_bar(v) != "bar:void *":
+if Spam.bar(v) != "bar:void *":
raise RuntimeError("Spam::bar(void *)")
# Test constructors
diff --git a/Examples/test-suite/python/refcount_runme.py b/Examples/test-suite/python/refcount_runme.py
index 2cab6a77e..5bea25fa1 100644
--- a/Examples/test-suite/python/refcount_runme.py
+++ b/Examples/test-suite/python/refcount_runme.py
@@ -5,7 +5,7 @@ from refcount import *
a = A3()
b1 = B(a)
-b2 = B_create(a)
+b2 = B.create(a)
if a.ref_count() != 3:
@@ -13,7 +13,7 @@ if a.ref_count() != 3:
rca = b2.get_rca()
-b3 = B_create(rca)
+b3 = B.create(rca)
if a.ref_count() != 5:
raise RuntimeError("Count = %d" % a.ref_count())
@@ -38,7 +38,7 @@ b5 = global_create(a)
if b5.ref_count() != 1:
raise RuntimeError
-b6 = Factory_create(a)
+b6 = Factory.create(a)
if b6.ref_count() != 1:
raise RuntimeError
diff --git a/Examples/test-suite/python/return_const_value_runme.py b/Examples/test-suite/python/return_const_value_runme.py
index 809eed97a..8cbac125c 100644
--- a/Examples/test-suite/python/return_const_value_runme.py
+++ b/Examples/test-suite/python/return_const_value_runme.py
@@ -1,10 +1,10 @@
import return_const_value
import sys
-p = return_const_value.Foo_ptr_getPtr()
+p = return_const_value.Foo_ptr.getPtr()
if (p.getVal() != 17):
raise RuntimeError("Runtime test1 failed. p.getVal()={}".format(p.getVal()))
-p = return_const_value.Foo_ptr_getConstPtr()
+p = return_const_value.Foo_ptr.getConstPtr()
if (p.getVal() != 17):
raise RuntimeError("Runtime test2 failed. p.getVal()={}".format(p.getVal()))
diff --git a/Examples/test-suite/python/template_static_runme.py b/Examples/test-suite/python/template_static_runme.py
index c87a52439..84da28438 100644
--- a/Examples/test-suite/python/template_static_runme.py
+++ b/Examples/test-suite/python/template_static_runme.py
@@ -1,3 +1,3 @@
from template_static import *
-Foo_bar_double(1)
+Foo.bar_double(1)
diff --git a/Examples/test-suite/python/typemap_out_optimal_runme.py b/Examples/test-suite/python/typemap_out_optimal_runme.py
index c7a34308e..c325ece55 100644
--- a/Examples/test-suite/python/typemap_out_optimal_runme.py
+++ b/Examples/test-suite/python/typemap_out_optimal_runme.py
@@ -1,4 +1,4 @@
from typemap_out_optimal import *
cvar.XX_debug = False
-x = XX_create()
+x = XX.create()
diff --git a/Examples/test-suite/python/virtual_poly_runme.py b/Examples/test-suite/python/virtual_poly_runme.py
index 0df6271ef..6708b6f99 100644
--- a/Examples/test-suite/python/virtual_poly_runme.py
+++ b/Examples/test-suite/python/virtual_poly_runme.py
@@ -29,10 +29,10 @@ if d.get() != dr.get():
#
# 'narrowing' also works
#
-ddc = virtual_poly.NDouble_narrow(d.nnumber())
+ddc = virtual_poly.NDouble.narrow(d.nnumber())
if d.get() != ddc.get():
raise RuntimeError
-dic = virtual_poly.NInt_narrow(i.nnumber())
+dic = virtual_poly.NInt.narrow(i.nnumber())
if i.get() != dic.get():
raise RuntimeError
diff --git a/Examples/test-suite/python/voidtest_runme.py b/Examples/test-suite/python/voidtest_runme.py
index b16cacf00..dd25b4c25 100644
--- a/Examples/test-suite/python/voidtest_runme.py
+++ b/Examples/test-suite/python/voidtest_runme.py
@@ -4,7 +4,7 @@ voidtest.globalfunc()
f = voidtest.Foo()
f.memberfunc()
-voidtest.Foo_staticmemberfunc()
+voidtest.Foo.staticmemberfunc()
def fvoid():
diff --git a/Examples/test-suite/python_flatstaticmethod.i b/Examples/test-suite/python_flatstaticmethod.i
new file mode 100644
index 000000000..c0de7d298
--- /dev/null
+++ b/Examples/test-suite/python_flatstaticmethod.i
@@ -0,0 +1,36 @@
+%module python_flatstaticmethod
+
+// This testcase tests C++ class static functions when using legacy "flattened"
+// staticmethod access, A_bar, as well as the normal staticmethod access, A.bar.
+
+%callback(1) A::bar;
+%feature("kwargs") A::pub;
+%feature("autodoc","0") A::func0static; // names
+%feature("autodoc","1") A::func1static; // names + types
+// special typemap and its docs
+%typemap(in) (int c, int d) "$1 = 0; $2 = 0;";
+%typemap(doc,name="hello",type="Tuple") (int c, int d) "hello: int tuple[2]";
+
+%inline %{
+ struct A {
+ static int bar(int a) {
+ return 2*a;
+ }
+ static int pub(int a = 1, int b = 0) {
+ return a + b;
+ }
+ static int func0static(A *e, short, int c, int d, double f = 2) { return 0; }
+ static int func1static(A *e, short, int c, int d, double f = 2) { return 0; }
+
+ static const char *over(int) { return "over:int"; }
+ static const char *over(double) { return "over:double"; }
+ static const char *over(char *) { return "over:char *"; }
+
+ static int defargs(int xx = 10, int yy = 20) { return xx + yy; }
+ };
+
+ extern "C" int foobar(int a, int (*pf)(int a)) {
+ return pf(a);
+ }
+%}
+
diff --git a/Lib/go/std_array.i b/Lib/go/std_array.i
new file mode 100644
index 000000000..36c790e3c
--- /dev/null
+++ b/Lib/go/std_array.i
@@ -0,0 +1,43 @@
+/* -----------------------------------------------------------------------------
+ * std_array.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+namespace std {
+
+ template<class T, size_t N> class array {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ array();
+ array(const array& other);
+
+ size_type size() const;
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void fill(const T& u);
+ %extend {
+ const_reference get(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("array index out of range");
+ }
+ void set(int i, const value_type& val) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = val;
+ else
+ throw std::out_of_range("array index out of range");
+ }
+ }
+ };
+}
diff --git a/Lib/perl5/perlhead.swg b/Lib/perl5/perlhead.swg
index 5437af5a5..bb7c1741d 100644
--- a/Lib/perl5/perlhead.swg
+++ b/Lib/perl5/perlhead.swg
@@ -8,22 +8,9 @@ extern "C" {
#include "perl.h"
#include "XSUB.h"
-/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
-
-/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
-#ifndef PERL_REVISION
-# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
-# define PERL_PATCHLEVEL_H_IMPLICIT
-# include <patchlevel.h>
-# endif
-# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
-# include <could_not_find_Perl_patchlevel.h>
-# endif
-# ifndef PERL_REVISION
-# define PERL_REVISION (5)
-# define PERL_VERSION PATCHLEVEL
-# define PERL_SUBVERSION SUBVERSION
-# endif
+/* PERL_REVISION was added in Perl 5.6. */
+#if !defined PERL_REVISION || (PERL_REVISION-0 == 5 && PERL_VERSION-0 < 8)
+# error SWIG requires Perl >= 5.8.0
#endif
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
@@ -38,15 +25,6 @@ extern "C" {
# define SvUOK(sv) SvIOK_UV(sv)
#endif
-#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
-# define PL_sv_undef sv_undef
-# define PL_na na
-# define PL_errgv errgv
-# define PL_sv_no sv_no
-# define PL_sv_yes sv_yes
-# define PL_markstack_ptr markstack_ptr
-#endif
-
#ifndef IVSIZE
# ifdef LONGSIZE
# define IVSIZE LONGSIZE
diff --git a/Lib/perl5/perlinit.swg b/Lib/perl5/perlinit.swg
index b49040d26..c26b93fad 100644
--- a/Lib/perl5/perlinit.swg
+++ b/Lib/perl5/perlinit.swg
@@ -4,15 +4,11 @@
#ifdef __cplusplus
extern "C"
#endif
-#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
SWIGEXPORT void SWIG_init (CV* cv);
#else
SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
#endif
-#else
-SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
-#endif
%}
/* Module initialization function */
diff --git a/Lib/perl5/perlrun.swg b/Lib/perl5/perlrun.swg
index b04002f5d..28703d1a6 100644
--- a/Lib/perl5/perlrun.swg
+++ b/Lib/perl5/perlrun.swg
@@ -6,13 +6,8 @@
* type checking.
* ----------------------------------------------------------------------------- */
-#ifdef PERL_OBJECT
-#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
-#define SWIG_PERL_OBJECT_CALL pPerl,
-#else
#define SWIG_PERL_OBJECT_DECL
#define SWIG_PERL_OBJECT_CALL
-#endif
/* Common SWIG API */
@@ -88,32 +83,12 @@ extern "C" {
#endif
/* Macro to call an XS function */
-#ifdef PERL_OBJECT
-# define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-# ifndef MULTIPLICITY
-# define SWIG_CALLXS(_name) _name(cv)
-# else
-# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-# endif
-#endif
-
-#ifdef PERL_OBJECT
-#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
-#ifdef __cplusplus
-}
+#ifndef MULTIPLICITY
+# define SWIG_CALLXS(_name) _name(cv)
+#else
+# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
#endif
-#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
-
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
@@ -141,24 +116,14 @@ typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#endif
#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
-# ifdef PERL_OBJECT
-# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-static void SWIGUNUSED SWIG_Perl_croak_null(CPerlObj *pPerl)
-# else
static void SWIGUNUSED SWIG_croak_null()
-# endif
{
SV *err = get_sv("@", GV_ADD);
-# if (PERL_VERSION < 6)
- croak("%_", err);
-# else
if (sv_isobject(err))
croak(0);
else
croak("%s", SvPV_nolen(err));
-# endif
}
@@ -462,20 +427,15 @@ typedef struct {
} swig_variable_info;
/* Magic variable code */
-#ifndef PERL_OBJECT
-# ifdef __cplusplus
+#ifdef __cplusplus
# define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
-# else
+#else
# define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
-# endif
-# ifndef MULTIPLICITY
-SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
-# else
-SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
-# endif
+#endif
+#ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
#else
-# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *))
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
#endif
{
MAGIC *mg;
diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg
index dfd3940ec..b530fba15 100644
--- a/Lib/python/pyinit.swg
+++ b/Lib/python/pyinit.swg
@@ -58,15 +58,12 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
}
}
-/* -----------------------------------------------------------------------------*/
-/* Fix SwigMethods to carry the callback ptrs when needed */
-/* -----------------------------------------------------------------------------*/
+/* -----------------------------------------------------------------------------
+ * Patch %callback methods' docstrings to hold the callback ptrs
+ * -----------------------------------------------------------------------------*/
SWIGINTERN void
-SWIG_Python_FixMethods(PyMethodDef *methods,
- swig_const_info *const_table,
- swig_type_info **types,
- swig_type_info **types_initial) {
+SWIG_Python_FixMethods(PyMethodDef *methods, const swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) {
size_t i;
for (i = 0; methods[i].ml_name; ++i) {
const char *c = methods[i].ml_doc;
@@ -74,7 +71,7 @@ SWIG_Python_FixMethods(PyMethodDef *methods,
c = strstr(c, "swig_ptr: ");
if (c) {
int j;
- swig_const_info *ci = 0;
+ const swig_const_info *ci = 0;
const char *name = c + 10;
for (j = 0; const_table[j].type; ++j) {
if (strncmp(const_table[j].name, name,
diff --git a/RELEASENOTES b/RELEASENOTES
index da60d543f..3a596dd46 100644
--- a/RELEASENOTES
+++ b/RELEASENOTES
@@ -10,6 +10,8 @@ published on the SWIG web site at http://swig.org/release.html.
SWIG-4.1.0 summary:
- Add PHP 8 support.
- PHP wrapping is now done entirely via PHP's C API - no more .php wrapper.
+- Perl 5.8.0 is now the oldest version SWIG supports.
+- GitHub Actions is now used instead of Travis CI for continuous integration.
SWIG-4.0.2 summary:
- A few fixes around doxygen comment handling.
diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx
index 66aebdea1..196ff47a9 100644
--- a/Source/Modules/lang.cxx
+++ b/Source/Modules/lang.cxx
@@ -1320,16 +1320,21 @@ int Language::staticmemberfunctionHandler(Node *n) {
Delete(mrename);
mrename = mangled;
- if (Getattr(n, "sym:overloaded") && code) {
- Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
- }
+ if (code) {
+ // See Swig_MethodToFunction() for the explanation of this code.
+ if (Getattr(n, "sym:overloaded")) {
+ Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
+ } else {
+ Append(cname, "__SWIG");
+ }
- if (!defaultargs && code) {
- /* Hmmm. An added static member. We have to create a little wrapper for this */
- String *mangled_cname = Swig_name_mangle(cname);
- Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
- Setattr(n, "extendname", mangled_cname);
- Delete(mangled_cname);
+ if (!defaultargs) {
+ /* Hmmm. An added static member. We have to create a little wrapper for this */
+ String *mangled_cname = Swig_name_mangle(cname);
+ Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
+ Setattr(n, "extendname", mangled_cname);
+ Delete(mangled_cname);
+ }
}
}
diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx
index e87f9f310..459d403bf 100644
--- a/Source/Modules/perl5.cxx
+++ b/Source/Modules/perl5.cxx
@@ -445,13 +445,7 @@ public:
Printv(magic,
"#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n",
- "#ifdef PERL_OBJECT\n",
- "#define MAGIC_CLASS _wrap_", underscore_module, "_var::\n",
- "class _wrap_", underscore_module, "_var : public CPerlObj {\n",
- "public:\n",
- "#else\n",
"#define MAGIC_CLASS\n",
- "#endif\n",
"SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {\n",
tab4, "MAGIC_PPERL\n", tab4, "croak(\"Value is read-only.\");\n", tab4, "return 0;\n", "}\n", NIL);
@@ -470,7 +464,6 @@ public:
/* Dump out variable wrappers */
- Printv(magic, "\n\n#ifdef PERL_OBJECT\n", "};\n", "#endif\n", NIL);
Printv(magic, "\n#ifdef __cplusplus\n}\n#endif\n", NIL);
Printf(f_header, "%s\n", magic);
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index 8682e6917..119a32364 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -73,8 +73,10 @@ static int py3 = 0;
/* C++ Support + Shadow Classes */
-static int have_constructor;
-static int have_repr;
+static int have_constructor = 0;
+static int have_repr = 0;
+static bool have_builtin_static_member_method_callback = false;
+static bool have_fast_proxy_static_member_method_callback = false;
static String *real_classname;
/* Thread Support */
@@ -815,6 +817,10 @@ public:
Append(const_code, "{0, 0, 0, 0.0, 0, 0}};\n");
Printf(f_wrappers, "%s\n", const_code);
+
+ if (have_fast_proxy_static_member_method_callback)
+ Printf(f_init, " SWIG_Python_FixMethods(SwigMethods_proxydocs, swig_const_table, swig_types, swig_type_initial);\n\n");
+
initialize_threads(f_init);
Printf(f_init, "#if PY_VERSION_HEX >= 0x03000000\n");
@@ -2478,6 +2484,7 @@ public:
Printf(methods, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
if (fastproxy) {
Printf(methods_proxydocs, "\"swig_ptr: %s\"", Getattr(n, "feature:callback:name"));
+ have_fast_proxy_static_member_method_callback = true;
}
} else {
Append(methods, "NULL");
@@ -3935,6 +3942,10 @@ public:
int funpack = fastunpack;
static String *tp_new = NewString("PyType_GenericNew");
+ if (have_builtin_static_member_method_callback) {
+ Printf(f_init, " SWIG_Python_FixMethods(SwigPyBuiltin_%s_methods, swig_const_table, swig_types, swig_type_initial);\n", mname);
+ }
+
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
// We can’t statically initialize a structure member with a function defined in another C module
@@ -4365,6 +4376,7 @@ public:
/* Create new strings for building up a wrapper function */
have_constructor = 0;
have_repr = 0;
+ have_builtin_static_member_method_callback = false;
class_name = Getattr(n, "sym:name");
real_classname = Getattr(n, "name");
@@ -4727,6 +4739,7 @@ public:
Swig_restore(n);
}
+ int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
if (builtin && in_class) {
if ((GetFlagAttr(n, "feature:extend") || checkAttribute(n, "access", "public"))
&& !Getattr(class_members, symname)) {
@@ -4741,7 +4754,7 @@ public:
else if (funpack && argcount == 1)
Append(pyflags, "METH_O");
else
- Append(pyflags, "METH_VARARGS");
+ Append(pyflags, kw ? "METH_VARARGS|METH_KEYWORDS" : "METH_VARARGS");
// Cast via void(*)(void) to suppress GCC -Wcast-function-type warning.
// Python should always call the function correctly, but the Python C
// API requires us to store it in function pointer of a different type.
@@ -4749,6 +4762,11 @@ public:
String *ds = cdocstring(n, AUTODOC_STATICFUNC);
Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
Delete(ds);
+ } else if (Getattr(n, "feature:callback")) {
+ String *ds = NewStringf("swig_ptr: %s", Getattr(n, "feature:callback:name"));
+ Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
+ Delete(ds);
+ have_builtin_static_member_method_callback = true;
} else {
Printf(builtin_methods, " { \"%s\", (PyCFunction)(void(*)(void))%s, %s, \"\" },\n", symname, wname, pyflags);
}
@@ -4767,7 +4785,6 @@ public:
String *staticfunc_name = NewString(fastproxy ? "_swig_new_static_method" : "staticmethod");
bool fast = (fastproxy && !have_addtofunc(n)) || Getattr(n, "feature:callback");
if (!fast || olddefs) {
- int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
String *parms = make_pyParmList(n, false, false, kw);
String *callParms = make_pyParmList(n, false, true, kw);
Printv(f_shadow, "\n", tab4, "@staticmethod", NIL);
diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c
index 7bf6641c8..ebe9fa702 100644
--- a/Source/Swig/cwrap.c
+++ b/Source/Swig/cwrap.c
@@ -1076,9 +1076,18 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
/* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix
to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined
- in C. */
- if (Getattr(n, "sym:overloaded") && code) {
- Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
+ in C.
+
+ But when not using the suffix used for overloaded functions, we still need to ensure that the
+ wrapper name doesn't conflict with any wrapper functions, so make it sufficiently unique by
+ appending a suffix similar to the one used for overloaded functions to it.
+ */
+ if (code) {
+ if (Getattr(n, "sym:overloaded")) {
+ Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
+ } else {
+ Append(mangled, "__SWIG");
+ }
}
/* See if there is any code that we need to emit */
diff --git a/Tools/brew-install b/Tools/brew-install
deleted file mode 100755
index 39fe22bc2..000000000
--- a/Tools/brew-install
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# Wrapper around 'brew install' emitting a message every minute if the command is still running.
-# This is used on Travis to ensure the install isn't killed when there is no output over a long period (10 minutes).
-# Usage: brew-install package, where package is the name of the package for brew to install.
-
-seconds=0
-minutes=0
-brew install "$@" &
-while true; do
- ps -p$! 2>& 1>/dev/null
- if [ $? = 0 ]; then
- if [ $seconds = 60 ]; then
- let seconds=0
- let minutes=minutes+1
- echo "brew install $1 still running ($minutes min)"
- fi
- sleep 1
- let seconds=seconds+1
- else
- break
- fi
-done
-wait $!
-exit $?
diff --git a/Tools/javascript/Makefile.in b/Tools/javascript/Makefile.in
index 5eeec0785..6335d0a65 100644
--- a/Tools/javascript/Makefile.in
+++ b/Tools/javascript/Makefile.in
@@ -32,12 +32,6 @@ JSCENABLED = @JSCENABLED@
srcdir = @srcdir@
-ifneq (, $(V8_VERSION))
- JSV8_VERSION=$(V8_VERSION)
-else
- JSV8_VERSION=0x031110
-endif
-
# Regenerate Makefile if Makefile.in or config.status have changed.
Makefile: $(srcdir)/Makefile.in ../../config.status
cd ../.. && $(SHELL) ./config.status Tools/javascript/Makefile
@@ -45,7 +39,7 @@ Makefile: $(srcdir)/Makefile.in ../../config.status
# These settings are provided by 'configure' (see '/configure.in')
ifeq (1, $(JSV8ENABLED))
JS_INTERPRETER_SRC_V8 = v8_shell.cxx
-JS_INTERPRETER_ENABLE_V8 = -DENABLE_V8 -DSWIG_V8_VERSION=$(JSV8_VERSION) -DV8_DEPRECATION_WARNINGS
+JS_INTERPRETER_ENABLE_V8 = -DENABLE_V8 -DV8_DEPRECATION_WARNINGS
endif
ifeq (1, $(JSCENABLED))
diff --git a/Tools/mkdist.py b/Tools/mkdist.py
index 4fba4701d..3d631607a 100755
--- a/Tools/mkdist.py
+++ b/Tools/mkdist.py
@@ -42,18 +42,18 @@ if dirname.lower() != dirname:
sys.exit(3)
# If directory and tarball exist, remove it
-print("Removing " + dirname)
if check_dir_exists(dirpath):
+ print("Removing " + dirpath)
run_command("rm", "-rf", dirpath)
-print("Removing " + dirname + ".tar if exists")
filename = dirpath + ".tar"
if check_file_exists(filename):
+ print("Removing " + filename)
run_command("rm", "-rf", filename)
-print("Removing " + dirname + ".tar.gz if exists")
filename += ".gz"
if check_file_exists(filename):
+ print("Removing " + filename)
run_command("rm", "-rf", filename)
# Grab the code from git
@@ -89,10 +89,10 @@ if not skip_checks:
print("Tagging release")
tag = "v" + version
-force = "-f " if force_tag else ""
+force = "-f" if force_tag else ""
command = ["git", "tag", "-a", "-m", "'Release version " + version + "'"]
-force and command.extend(force, tag)
-not force and command.append(tag)
+force and command.append(force)
+command.append(tag)
run_command(*command) == 0 or failed()
outdir = dirname + "/"
diff --git a/Tools/mkwindows.sh b/Tools/mkwindows.sh
index e6ae84350..5e4d2f0fd 100755
--- a/Tools/mkwindows.sh
+++ b/Tools/mkwindows.sh
@@ -115,8 +115,9 @@ if test -f "$tarball"; then
./configure $extraconfigureoptions --without-alllang
echo "Compiling (quietly)..."
make > build.log
- echo "Simple check to see if swig.exe runs..."
+ echo "Simple check to see if swig.exe runs and show versions..."
env LD_LIBRARY_PATH= PATH= $wine ./swig.exe -version || exit 1
+ env LD_LIBRARY_PATH= PATH= $wine ./swig.exe -pcreversion || exit 1
echo "Simple check to see if ccache-swig.exe runs..."
env LD_LIBRARY_PATH= PATH= $wine ./CCache/ccache-swig.exe -V || exit 1
echo "Creating $swigwinbasename.zip..."
diff --git a/Tools/travis-linux-install.sh b/Tools/travis-linux-install.sh
deleted file mode 100755
index cb64d57d2..000000000
--- a/Tools/travis-linux-install.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# Install Linux packages where the version has been overridden in .travis.yml
-
-lsb_release -a
-# find location of current script (only works in bash)
-script_dir="$( dirname "${BASH_SOURCE[0]}")"
-
-# run generic script
-RETRY=travis-retry
-source "$script_dir"/CI-linux-install.sh
diff --git a/Tools/travis-osx-install.sh b/Tools/travis-osx-install.sh
deleted file mode 100755
index fc69c6654..000000000
--- a/Tools/travis-osx-install.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-
-# Install MacOS packages where the version has been overridden in .travis.yml
-
-set -e # exit on failure (same as -o errexit)
-
-# Disable 'brew cleanup', just wastes Travis job run time
-export HOMEBREW_NO_INSTALL_CLEANUP=1
-
-sw_vers
-travis_retry brew update
-echo "Installed packages..."
-travis_retry brew list --versions
-# travis_retry brew install pcre # Travis Xcode-7.3 has pcre
-# travis_retry brew install boost
-
-WITHLANG=$SWIGLANG
-
-case "$SWIGLANG" in
- "csharp")
- travis_retry brew install mono
- ;;
- "lua")
- travis_retry brew install lua
- ;;
- "octave")
- travis_retry Tools/brew-install octave
- ;;
- "perl5")
- travis_retry Tools/brew-install perl
- ;;
- "python")
- WITHLANG=$SWIGLANG$PY3
- ;;
- "tcl")
- travis_retry Tools/brew-install --cask tcl
- ;;
-esac
-
-# Workaround for https://github.com/travis-ci/travis-ci/issues/6522
-set +e # turn off exit on failure (same as +o errexit)
diff --git a/appveyor.yml b/appveyor.yml
index 07c4fac28..5eaa77b2f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -131,7 +131,7 @@ install:
- if "%OSVARIANT%"=="" bash -c "which csc.exe"
- if "%OSVARIANT%"=="" bash -c "csc.exe /? | head -n 1"
- if "%OSVARIANT%"=="cygwin" %CYGWINSETUP% --quiet-mode --packages python2-devel,libpcre-devel,libboost-devel > cygwin-install.txt || bash -c "cat cygwin-install.txt"
-- if "%OSVARIANT%"=="mingw" bash -c "pacman --noconfirm --sync mingw%MBITS%/mingw-w64-%MARCH%-pcre mingw%MBITS%/mingw-w64-%MARCH%-boost"
+- if "%OSVARIANT%"=="mingw" bash -c "pacman --noconfirm --sync mingw%MBITS%/mingw-w64-%MARCH%-autotools mingw%MBITS%/mingw-w64-%MARCH%-pcre mingw%MBITS%/mingw-w64-%MARCH%-boost"
- if not "%WITHLANG%"=="" set SWIGWITHLANG==%WITHLANG%
- if not "%WITHLANG%"=="" where %WITHLANG%
- bash -c "which $CC"
diff --git a/configure.ac b/configure.ac
index 8073bfdb3..ed836205f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -983,7 +983,7 @@ else
# First figure out what the name of Perl5 is
if test "x$PERLBIN" = xyes; then
-AC_CHECK_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
+AC_CHECK_PROGS(PERL, perl perl5)
else
PERL="$PERLBIN"
fi