Merge branch 'swig:master' into imfunc
This commit is contained in:
commit
e25911b846
308 changed files with 5008 additions and 4773 deletions
457
.github/workflows/ci.yml
vendored
Normal file
457
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,457 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- 'CHANGES*'
|
||||||
|
- 'Doc/**'
|
||||||
|
- 'appveyor.yml'
|
||||||
|
pull_request:
|
||||||
|
branches: master
|
||||||
|
paths-ignore:
|
||||||
|
- 'CHANGES*'
|
||||||
|
- 'Doc/**'
|
||||||
|
- 'appveyor.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
# When continue-on-error is true for an individual build, that build can fail (it'll show red),
|
||||||
|
# but it won't fail the overall build
|
||||||
|
continue-on-error: ${{ matrix.continue-on-error || false }}
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
|
||||||
|
|
||||||
|
# By default, the name of the build is the language used and SWIG options, but matrix entries
|
||||||
|
# can define the additional "desc" field with any additional information to include in the name.
|
||||||
|
name: ${{ matrix.SWIGLANG || 'none' }}${{ matrix.PY3 }} ${{ matrix.ENGINE}} ${{ matrix.VER }} ${{ matrix.SWIG_FEATURES }} ${{ (matrix.compiler || 'gcc') }}${{ matrix.GCC }} ${{ matrix.CPPSTD }} ${{ matrix.CSTD }} ${{ matrix.desc }} ${{ matrix.continue-on-error && '(can fail)' }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- SWIGLANG: ""
|
||||||
|
- SWIGLANG: ""
|
||||||
|
GCC: 7
|
||||||
|
- SWIGLANG: ""
|
||||||
|
GCC: 8
|
||||||
|
- SWIGLANG: ""
|
||||||
|
GCC: 9
|
||||||
|
- SWIGLANG: ""
|
||||||
|
GCC: 10
|
||||||
|
- SWIGLANG: ""
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: ""
|
||||||
|
compiler: clang
|
||||||
|
- SWIGLANG: csharp
|
||||||
|
# D support can't be enabled because dmd 2.066 fails to build anything
|
||||||
|
# under Ubuntu 18.04 due to its standard library (libphobos2.a) not
|
||||||
|
# being compiled with -FPIC, but system gcc using -fpie by default,
|
||||||
|
# resulting in linking errors for any output. And later versions, such
|
||||||
|
# as 2.086.1, are not supported and result in errors in SWIG test suite.
|
||||||
|
#
|
||||||
|
# - SWIGLANG: d
|
||||||
|
# VER: '2.066.0'
|
||||||
|
# os: ubuntu-18.04 # This dlang version doesn't work under 20.04.
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.6'
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.8'
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.12'
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.17'
|
||||||
|
- SWIGLANG: guile
|
||||||
|
- SWIGLANG: java
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '6'
|
||||||
|
CPPSTD: c++11
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '8'
|
||||||
|
CPPSTD: c++11
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '10'
|
||||||
|
CPPSTD: c++11
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '12'
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '17'
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: jsc
|
||||||
|
- SWIGLANG: lua
|
||||||
|
- SWIGLANG: lua
|
||||||
|
VER: '5.3'
|
||||||
|
- SWIGLANG: octave
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: octave
|
||||||
|
VER: '6.4'
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: perl5
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '7.0'
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '7.1'
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '7.2'
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '7.3'
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '7.4'
|
||||||
|
- SWIGLANG: php
|
||||||
|
- SWIGLANG: php
|
||||||
|
VER: '8.1'
|
||||||
|
- SWIGLANG: python
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.2'
|
||||||
|
os: ubuntu-18.04 # Python < 3.5 not available for 20.04.
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.3'
|
||||||
|
os: ubuntu-18.04 # Python < 3.5 not available for 20.04.
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.4'
|
||||||
|
os: ubuntu-18.04 # Python < 3.5 not available for 20.04.
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.5'
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.6'
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.7'
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.8'
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.9'
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
VER: '3.10'
|
||||||
|
- SWIGLANG: python
|
||||||
|
SWIG_FEATURES: -builtin
|
||||||
|
- SWIGLANG: python
|
||||||
|
SWIG_FEATURES: -builtin -O
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
SWIG_FEATURES: -builtin
|
||||||
|
- SWIGLANG: python
|
||||||
|
PY3: 3
|
||||||
|
SWIG_FEATURES: -builtin -O
|
||||||
|
- SWIGLANG: r
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '1.9'
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.0'
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.1'
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.2'
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.3'
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.4'
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.5'
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.6'
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '2.7'
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
VER: '3.0'
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: scilab
|
||||||
|
os: ubuntu-18.04 # scilab-6.1 in ubuntu-20.04 not yet working
|
||||||
|
- SWIGLANG: tcl
|
||||||
|
# c++11 testing
|
||||||
|
- SWIGLANG: csharp
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.17'
|
||||||
|
CPPSTD: c++11
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: guile
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: java
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '14'
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: lua
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: perl5
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: php
|
||||||
|
CPPSTD: c++11
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: python
|
||||||
|
CPPSTD: c++11
|
||||||
|
PY3: 3
|
||||||
|
- SWIGLANG: r
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
CPPSTD: c++11
|
||||||
|
- SWIGLANG: scilab
|
||||||
|
CPPSTD: c++11
|
||||||
|
os: ubuntu-18.04 # scilab-6.1 in ubuntu-20.04 not yet working
|
||||||
|
- SWIGLANG: tcl
|
||||||
|
CPPSTD: c++11
|
||||||
|
# c++14 testing
|
||||||
|
- SWIGLANG: csharp
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.17'
|
||||||
|
CPPSTD: c++14
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: guile
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: java
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '16'
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: lua
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: octave
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: perl5
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: php
|
||||||
|
CPPSTD: c++14
|
||||||
|
CSTD: gnu11
|
||||||
|
- SWIGLANG: python
|
||||||
|
CPPSTD: c++14
|
||||||
|
PY3: 3
|
||||||
|
- SWIGLANG: r
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
CPPSTD: c++14
|
||||||
|
- SWIGLANG: scilab
|
||||||
|
CPPSTD: c++14
|
||||||
|
os: ubuntu-18.04 # scilab-6.1 in ubuntu-20.04 not yet working
|
||||||
|
- SWIGLANG: tcl
|
||||||
|
CPPSTD: c++14
|
||||||
|
# c++17 testing (using gcc11)
|
||||||
|
- SWIGLANG: csharp
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: go
|
||||||
|
VER: '1.17'
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
CSTD: gnu17
|
||||||
|
- SWIGLANG: guile
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: java
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: javascript
|
||||||
|
ENGINE: node
|
||||||
|
VER: '17'
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: lua
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: octave
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: perl5
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: php
|
||||||
|
CPPSTD: c++17
|
||||||
|
CSTD: gnu17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: python
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
PY3: 3
|
||||||
|
- SWIGLANG: r
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: ruby
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
- SWIGLANG: scilab
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
os: ubuntu-18.04 # scilab-6.1 in ubuntu-20.04 not yet working
|
||||||
|
- SWIGLANG: tcl
|
||||||
|
CPPSTD: c++17
|
||||||
|
GCC: 11
|
||||||
|
# Experimental languages (these are allowed to fail)
|
||||||
|
- SWIGLANG: mzscheme
|
||||||
|
continue-on-error: true
|
||||||
|
- SWIGLANG: ocaml
|
||||||
|
continue-on-error: true
|
||||||
|
os: ubuntu-18.04 # ocaml-4.08 in ubuntu-20.04 not yet working
|
||||||
|
# Run all of them, as opposed to aborting when one fails
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
SWIGLANG: ${{ matrix.SWIGLANG }}
|
||||||
|
PY3: ${{ matrix.PY3 }}
|
||||||
|
VER: ${{ matrix.VER }}
|
||||||
|
ENGINE: ${{ matrix.ENGINE }}
|
||||||
|
SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }}
|
||||||
|
GCC: ${{ matrix.GCC }}
|
||||||
|
CSTD: ${{ matrix.CSTD }}
|
||||||
|
CPPSTD: ${{ matrix.CPPSTD }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Install CCache
|
||||||
|
uses: hendrikmuhs/ccache-action@v1
|
||||||
|
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
|
||||||
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||||
|
echo PATH="$PATH" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
source $GITHUB_WORKSPACE/Tools/GHA-linux-install.sh
|
||||||
|
echo WITHLANG="$WITHLANG" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
case $(uname) in
|
||||||
|
Linux)
|
||||||
|
cpu_count=$(nproc)
|
||||||
|
;;
|
||||||
|
|
||||||
|
Darwin)
|
||||||
|
cpu_count=$(sysctl -n hw.ncpu)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
cpu_count=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $cpu_count != 1 ]]; then
|
||||||
|
echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test '${{ matrix.compiler }}' = 'clang'; then
|
||||||
|
CC="clang"
|
||||||
|
CXX="clang++"
|
||||||
|
|
||||||
|
CFLAGS="$CFLAGS -fPIE"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fPIE"
|
||||||
|
elif test -n "$GCC"; then
|
||||||
|
CC="gcc-$GCC"
|
||||||
|
CXX="g++-$GCC"
|
||||||
|
else
|
||||||
|
CC="gcc"
|
||||||
|
CXX="g++"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export CC CXX
|
||||||
|
|
||||||
|
echo CC="$CC" >> $GITHUB_ENV
|
||||||
|
echo CXX="$CXX" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
ls -la $(which $CC) $(which $CXX)
|
||||||
|
$CC --version
|
||||||
|
$CXX --version
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [[ -z "$CSTD" ]]; then
|
||||||
|
case "$CPPSTD" in
|
||||||
|
c++11) export CSTD=c11 ;;
|
||||||
|
c++14) export CSTD=c11 ;;
|
||||||
|
c++17) export CSTD=c17 ;;
|
||||||
|
esac
|
||||||
|
echo CSTD="$CSTD" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
if test -n "$CPPSTD"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=$CPPSTD $CXXFLAGS"); fi
|
||||||
|
if test -n "$CSTD"; then CONFIGOPTS+=("CFLAGS=-std=$CSTD $CFLAGS"); 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[@]}"
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: build/build
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
make -s $SWIGJOBS
|
||||||
|
./swig -version && ./swig -pcreversion
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: build/build
|
||||||
|
run: |
|
||||||
|
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if test -z "$SWIGLANG"; then
|
||||||
|
make $SWIGJOBS check-ccache
|
||||||
|
make $SWIGJOBS check-errors-test-suite
|
||||||
|
else
|
||||||
|
case "$SWIGLANG" in
|
||||||
|
javascript)
|
||||||
|
case "$ENGINE" in
|
||||||
|
v8 | jsc)
|
||||||
|
# Running tests using v8 or jsc involves creating a custom
|
||||||
|
# interpreter in Tools/javascript, which is currently broken
|
||||||
|
# for parallel builds (we attempt to update this interpreter
|
||||||
|
# while running, resulting in "Text file busy" error).
|
||||||
|
unset SWIGJOBS
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
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)
|
||||||
|
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"
|
||||||
|
make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
working-directory: build/build
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi
|
||||||
|
|
||||||
|
- name: Clean
|
||||||
|
working-directory: build/build
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
make check-maintainer-clean && ../../configure
|
||||||
499
.travis.yml
499
.travis.yml
|
|
@ -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'
|
|
||||||
|
|
@ -2,7 +2,7 @@ This directory contains a version of ccache. The initial version was based on cc
|
||||||
debian patches 01-02, 04-14, see the debian/patches subdirectory. The ccache-win32-2.4 modifications
|
debian patches 01-02, 04-14, see the debian/patches subdirectory. The ccache-win32-2.4 modifications
|
||||||
to ccache-2.4 have also been merged in.
|
to ccache-2.4 have also been merged in.
|
||||||
|
|
||||||
Changes have been made to support cacheing the output from SWIG. The ability to cache c/c++ compiler
|
Changes have been made to support caching the output from SWIG. The ability to cache c/c++ compiler
|
||||||
output has been retained.
|
output has been retained.
|
||||||
|
|
||||||
Additional features added are the CCACHE_VERBOSE and CCACHE_SWIG environment variables, see docs.
|
Additional features added are the CCACHE_VERBOSE and CCACHE_SWIG environment variables, see docs.
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ int execute(char **argv,
|
||||||
_dup2(fd, 2);
|
_dup2(fd, 2);
|
||||||
_close(fd);
|
_close(fd);
|
||||||
|
|
||||||
/* Spawn process (_exec* familly doesn't return) */
|
/* Spawn process (_exec* family doesn't return) */
|
||||||
status = _spawnv(_P_WAIT, argv[0], (const char **)argv);
|
status = _spawnv(_P_WAIT, argv[0], (const char **)argv);
|
||||||
|
|
||||||
/* Restore descriptors */
|
/* Restore descriptors */
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* for string length. This covers a nasty loophole.
|
* for string length. This covers a nasty loophole.
|
||||||
*
|
*
|
||||||
* The other functions are there to prevent NULL pointers from
|
* The other functions are there to prevent NULL pointers from
|
||||||
* causing nast effects.
|
* causing nasty effects.
|
||||||
*
|
*
|
||||||
* More Recently:
|
* More Recently:
|
||||||
* Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
|
* Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
* probably requires libm on most operating systems. Don't yet
|
* probably requires libm on most operating systems. Don't yet
|
||||||
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
|
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
|
||||||
* was pretty badly broken, it just wasn't being exercised in ways
|
* was pretty badly broken, it just wasn't being exercised in ways
|
||||||
* which showed it, so that's been fixed. Also, formated the code
|
* which showed it, so that's been fixed. Also, formatted the code
|
||||||
* to mutt conventions, and removed dead code left over from the
|
* to mutt conventions, and removed dead code left over from the
|
||||||
* original. Also, there is now a builtin-test, just compile with:
|
* original. Also, there is now a builtin-test, just compile with:
|
||||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ on the new options.<p>
|
||||||
|
|
||||||
You can get this release from the <a href="http://ccache.samba.org/ftp/ccache/">download directory</a>
|
You can get this release from the <a href="http://ccache.samba.org/ftp/ccache/">download directory</a>
|
||||||
|
|
||||||
<p>NOTE! This release changes the hash input slighly, so you will
|
<p>NOTE! This release changes the hash input slightly, so you will
|
||||||
probably find that you will not get any hits against your existing
|
probably find that you will not get any hits against your existing
|
||||||
cache when you upgrade.
|
cache when you upgrade.
|
||||||
|
|
||||||
|
|
|
||||||
143
CHANGES.current
143
CHANGES.current
|
|
@ -7,6 +7,149 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-02-02: olly
|
||||||
|
[Ruby] https://sourceforge.net/p/swig/bugs/1136/ Fix remove of prefix
|
||||||
|
from method name to only remove it at the start.
|
||||||
|
|
||||||
|
2022-02-01: olly
|
||||||
|
#231 Handle returning an object by reference in a C++ trailing
|
||||||
|
return type.
|
||||||
|
|
||||||
|
2022-02-01: davidcl
|
||||||
|
[Scilab] #745 use SWIG_<module>_Init() as a C module init function.
|
||||||
|
|
||||||
|
2022-02-01: olly
|
||||||
|
[OCaml] #2083 Fix to work when CAML_SAFE_STRING is on, which it is
|
||||||
|
by default in recent Ocaml releases.
|
||||||
|
|
||||||
|
2022-01-31: mreeez
|
||||||
|
https://sourceforge.net/p/swig/bugs/1147/
|
||||||
|
Fix copyToR() generated for a struct in a namespace.
|
||||||
|
|
||||||
|
2022-01-29: fschlimb
|
||||||
|
#655 Better handling of using declarations.
|
||||||
|
|
||||||
|
2022-01-29: dontpanic92
|
||||||
|
#676 Fix code generated for a C++ class with a non-capitalised
|
||||||
|
name.
|
||||||
|
|
||||||
|
2022-01-26: trex58
|
||||||
|
#1919 #1921 #1923 Various fixes for AIX portability.
|
||||||
|
|
||||||
|
2022-01-26: olly
|
||||||
|
#1935 Don't crash on an unclosed HTML tag in a doxygen comment
|
||||||
|
when -doxygen is specified.
|
||||||
|
|
||||||
|
2022-01-25: olly
|
||||||
|
Constant expressions now support member access with `.` such as
|
||||||
|
`foo.bar`. Previous this only worked in a case like `x->foo.bar`.
|
||||||
|
|
||||||
|
2022-01-25: olly
|
||||||
|
#2091 Support most cases of `sizeof` applied to an expression
|
||||||
|
in constant expressions. Previously there was only support for
|
||||||
|
`sizeof(<type>)` and expressions which syntactically look like a
|
||||||
|
type (such as `sizeof(foo)`).
|
||||||
|
|
||||||
|
2022-01-25: olly
|
||||||
|
#80 #635 https://sourceforge.net/p/swig/bugs/1139/
|
||||||
|
Add support for parsing common cases of `<` and `>` comparisons
|
||||||
|
in constant expressions. Adding full support for these seems hard
|
||||||
|
to do without introducing conflicts into the parser grammar, but in
|
||||||
|
fact all reported cases have had parentheses around the comparison
|
||||||
|
and we can support that with a few restrictions on the left side of
|
||||||
|
`<`.
|
||||||
|
|
||||||
|
2022-01-25: wsfulton
|
||||||
|
New warning 327 for extern templates, eg:
|
||||||
|
|
||||||
|
extern template class std::vector<int>;
|
||||||
|
extern template void Func<int>();
|
||||||
|
|
||||||
|
results in warning
|
||||||
|
|
||||||
|
example.i:3: Warning 327: Extern template ignored.
|
||||||
|
example.i:4: Warning 327: Extern template ignored.
|
||||||
|
|
||||||
|
Extern template classes previously resulted in warning 320.
|
||||||
|
|
||||||
|
2022-01-24: romintomasetti
|
||||||
|
#2131 #2157 C++11 extern function template parsing error fix.
|
||||||
|
|
||||||
|
2022-01-21: wsfulton
|
||||||
|
#2120 #2138 Replace legacy PCRE dependency with PCRE2.
|
||||||
|
This requires changes for building SWIG from source. See updated
|
||||||
|
html documentation in Preface.html and Windows.html. Updated
|
||||||
|
instructions are also shown when running ./configure if PCRE2 is not
|
||||||
|
found. Note that debian based systems can install PCRE2 using:
|
||||||
|
|
||||||
|
apt install libpcre2-dev
|
||||||
|
|
||||||
|
Note that https://github.com/swig/swig/wiki/Getting-Started also has
|
||||||
|
updated information for building from source.
|
||||||
|
|
||||||
|
2022-01-19: olly
|
||||||
|
[PHP] #2027 Automatically generate PHP type declarations for PHP 8.
|
||||||
|
The generate code still compiles for PHP 7.x, but without type
|
||||||
|
declarations since PHP 7.x has much more limited type declaration
|
||||||
|
support.
|
||||||
|
|
||||||
|
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
|
||||||
|
by mkoctfile.
|
||||||
|
|
||||||
|
2021-12-02: jsenn
|
||||||
|
[Python] #2102 Fixed crashes when using embedded Python interpreters.
|
||||||
|
|
||||||
|
2021-11-12: wsfulton
|
||||||
|
[Javascript] v8 and node only. Fix mismatched new char[] and free()
|
||||||
|
when wrapping C code char arrays. Now calloc is now used instead of
|
||||||
|
new char[] in SWIG_AsCharPtrAndSize.
|
||||||
|
|
||||||
|
2021-10-03: ajrh1
|
||||||
|
[Perl] #2074: Avoid -Wmisleading-indentation in generated code
|
||||||
|
when using gcc11.
|
||||||
|
|
||||||
|
2021-10-03: jschueller
|
||||||
|
[CMake] #2065: Add option to enable or disable PCRE support.
|
||||||
|
|
||||||
|
2021-09-16: ianlancetaylor
|
||||||
|
[Go] Improved _cgo_panic implementation.
|
||||||
|
|
||||||
|
2021-09-16: ianlancetaylor
|
||||||
|
[Go] Don't use crosscall2 for panicking. Instead rely on documented
|
||||||
|
and exported interfaces.
|
||||||
|
|
||||||
|
2021-09-14: ianlancetaylor
|
||||||
|
[Go] Remove -no-cgo option (long unsupported in Go)
|
||||||
|
|
||||||
2021-05-04: olly
|
2021-05-04: olly
|
||||||
[PHP] #2014 Throw PHP exceptions instead of using PHP errors
|
[PHP] #2014 Throw PHP exceptions instead of using PHP errors
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,11 @@ if (MSVC)
|
||||||
set (CMAKE_CXX_FLAGS "/EHsc ${CMAKE_CXX_FLAGS}")
|
set (CMAKE_CXX_FLAGS "/EHsc ${CMAKE_CXX_FLAGS}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set (PCRE_REQUIRED_ARG "REQUIRED" CACHE STRING "required arg")
|
option (WITH_PCRE "Enable PCRE" ON)
|
||||||
find_package (PCRE ${PCRE_REQUIRED_ARG})
|
if (WITH_PCRE)
|
||||||
if (PCRE_FOUND)
|
find_package (PCRE2 REQUIRED)
|
||||||
set (HAVE_PCRE 1)
|
set (HAVE_PCRE 1)
|
||||||
include_directories (${PCRE_INCLUDE_DIRS})
|
include_directories (${PCRE2_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
@ -145,8 +145,8 @@ add_executable (swig
|
||||||
${PROJECT_BINARY_DIR}/Source/CParse/parser.c
|
${PROJECT_BINARY_DIR}/Source/CParse/parser.c
|
||||||
${PROJECT_BINARY_DIR}/Source/CParse/parser.h
|
${PROJECT_BINARY_DIR}/Source/CParse/parser.h
|
||||||
)
|
)
|
||||||
if (PCRE_FOUND)
|
if (PCRE2_FOUND)
|
||||||
target_link_libraries (swig ${PCRE_LIBRARIES})
|
target_link_libraries (swig ${PCRE2_LIBRARIES})
|
||||||
endif ()
|
endif ()
|
||||||
install (TARGETS swig DESTINATION bin)
|
install (TARGETS swig DESTINATION bin)
|
||||||
|
|
||||||
|
|
@ -160,6 +160,7 @@ include (CPack)
|
||||||
# few tests
|
# few tests
|
||||||
enable_testing ()
|
enable_testing ()
|
||||||
add_test (NAME cmd_version COMMAND swig -version)
|
add_test (NAME cmd_version COMMAND swig -version)
|
||||||
|
add_test (NAME cmd_pcreversion COMMAND swig -pcreversion)
|
||||||
add_test (NAME cmd_swiglib COMMAND swig -swiglib)
|
add_test (NAME cmd_swiglib COMMAND swig -swiglib)
|
||||||
add_test (NAME cmd_external_runtime COMMAND swig -external-runtime ext_rt.h)
|
add_test (NAME cmd_external_runtime COMMAND swig -external-runtime ext_rt.h)
|
||||||
set_tests_properties(cmd_external_runtime PROPERTIES ENVIRONMENT "SWIG_LIB=${PROJECT_SOURCE_DIR}/Lib")
|
set_tests_properties(cmd_external_runtime PROPERTIES ENVIRONMENT "SWIG_LIB=${PROJECT_SOURCE_DIR}/Lib")
|
||||||
|
|
|
||||||
|
|
@ -441,12 +441,12 @@ Resulting output:
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
hash len: 5
|
list len: 5
|
||||||
get: hashval2
|
get: listval2
|
||||||
hash item: hashval5 [h5]
|
list item: newlistval1
|
||||||
hash item: hashval1 [h1]
|
list item: listval2
|
||||||
hash item: hashval2 [h2]
|
list item: listval3
|
||||||
hash item: hashval3 [h3]
|
list item: listval5
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
|
@ -494,12 +494,12 @@ Resulting output:
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
list len: 5
|
hash len: 5
|
||||||
get: listval2
|
get: hashval2
|
||||||
list item: newlistval1
|
hash item: hashval5 [h5]
|
||||||
list item: listval2
|
hash item: hashval1 [h1]
|
||||||
list item: listval3
|
hash item: hashval2 [h2]
|
||||||
list item: listval5
|
hash item: hashval3 [h3]
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,14 +144,39 @@ When either of these is used from a target language, a runtime call is made to o
|
||||||
<H3><a name="CPlusPlus11_extern_template">7.2.3 Extern template</a></H3>
|
<H3><a name="CPlusPlus11_extern_template">7.2.3 Extern template</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>SWIG correctly parses the keywords <tt>extern template</tt>.
|
<p>SWIG correctly parses <tt>extern template</tt> explicit instantiation declarations.
|
||||||
However, this template instantiation suppression in a translation unit has no relevance outside of the C++ compiler and so is not used by SWIG.
|
However, this template instantiation suppression in a translation unit has no relevance outside of the C++ compiler and so is not used by SWIG.
|
||||||
SWIG only uses <tt>%template</tt> for instantiating and wrapping templates.</p>
|
SWIG only uses <tt>%template</tt> for instantiating and wrapping templates.
|
||||||
|
Consider the class template below:
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
template class std::vector<int>; // C++03 explicit instantiation in C++
|
// Class template
|
||||||
extern template class std::vector<int>; // C++11 explicit instantiation suppression in C++
|
template class std::vector<int>; // C++03 template explicit instantiation definition in C++
|
||||||
%template(VectorInt) std::vector<int>; // SWIG instantiation
|
extern template class std::vector<int>; // C++11 template explicit instantiation declaration (extern template)
|
||||||
|
%template(VectorInt) std::vector<int>; // SWIG template instantiation
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The above result in warnings:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="shell">
|
||||||
|
<pre>
|
||||||
|
example.i:2: Warning 320: Explicit template instantiation ignored.
|
||||||
|
example.i:3: Warning 327: Extern template ignored.
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Similarly for the function template below:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code"><pre>
|
||||||
|
// Function template
|
||||||
|
template void Func<int>(); // C++03 template explicit instantiation definition in C++
|
||||||
|
extern template void Func<int>(); // C++11 template explicit instantiation declaration (extern template)
|
||||||
|
%template(FuncInt) Func<int>; // SWIG template instantiation
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<H3><a name="CPlusPlus11_initializer_lists">7.2.4 Initializer lists</a></H3>
|
<H3><a name="CPlusPlus11_initializer_lists">7.2.4 Initializer lists</a></H3>
|
||||||
|
|
|
||||||
|
|
@ -91,17 +91,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="Windows.html#Windows_other_compilers">Instructions for using the Examples with other compilers</a>
|
<li><a href="Windows.html#Windows_other_compilers">Instructions for using the Examples with other compilers</a>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="Windows.html#Windows_cygwin_mingw">SWIG on Cygwin and MinGW</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="Windows.html#Windows_swig_exe">Building swig.exe on Windows</a>
|
<li><a href="Windows.html#Windows_swig_exe">Building swig.exe on Windows</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="Windows.html#Windows_cmake">Building swig.exe using CMake</a>
|
<li><a href="Windows.html#Windows_cmake">Building swig.exe using CMake</a>
|
||||||
<li><a href="Windows.html#Windows_mingw_msys">Building swig.exe using MSYS2</a>
|
<li><a href="Windows.html#Windows_msys2">Building swig.exe using MSYS2</a>
|
||||||
<li><a href="Windows.html#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a>
|
<li><a href="Windows.html#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a>
|
||||||
<li><a href="Windows.html#Windows_cygwin">Building swig.exe using Cygwin</a>
|
<li><a href="Windows.html#Windows_cygwin">Building swig.exe using Cygwin</a>
|
||||||
</ul>
|
<ul>
|
||||||
<li><a href="Windows.html#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a>
|
<li><a href="Windows.html#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
</ul>
|
||||||
<li><a href="Windows.html#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
<li><a href="Windows.html#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -172,6 +171,7 @@
|
||||||
<li><a href="SWIG.html#SWIG_rename_ignore">Renaming and ignoring declarations</a>
|
<li><a href="SWIG.html#SWIG_rename_ignore">Renaming and ignoring declarations</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="SWIG.html#SWIG_nn29">Simple renaming of specific identifiers</a>
|
<li><a href="SWIG.html#SWIG_nn29">Simple renaming of specific identifiers</a>
|
||||||
|
<li><a href="SWIG.html#SWIG_ignore">Ignoring identifiers</a>
|
||||||
<li><a href="SWIG.html#SWIG_advanced_renaming">Advanced renaming support</a>
|
<li><a href="SWIG.html#SWIG_advanced_renaming">Advanced renaming support</a>
|
||||||
<li><a href="SWIG.html#SWIG_limiting_renaming">Limiting global renaming rules</a>
|
<li><a href="SWIG.html#SWIG_limiting_renaming">Limiting global renaming rules</a>
|
||||||
<li><a href="SWIG.html#SWIG_chosen_unignore">Ignoring everything then wrapping a few selected symbols</a>
|
<li><a href="SWIG.html#SWIG_chosen_unignore">Ignoring everything then wrapping a few selected symbols</a>
|
||||||
|
|
@ -251,6 +251,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="SWIGPlus.html#SWIGPlus_nn28">Overloaded operators</a>
|
<li><a href="SWIGPlus.html#SWIGPlus_nn28">Overloaded operators</a>
|
||||||
<li><a href="SWIGPlus.html#SWIGPlus_class_extension">Class extension</a>
|
<li><a href="SWIGPlus.html#SWIGPlus_class_extension">Class extension</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="SWIGPlus.html#SWIGPlus_replacing_methods">Replacing class methods</a>
|
||||||
|
</ul>
|
||||||
<li><a href="SWIGPlus.html#SWIGPlus_nn30">Templates</a>
|
<li><a href="SWIGPlus.html#SWIGPlus_nn30">Templates</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="SWIGPlus.html#SWIGPlus_template_directive">The %template directive</a>
|
<li><a href="SWIGPlus.html#SWIGPlus_template_directive">The %template directive</a>
|
||||||
|
|
|
||||||
|
|
@ -1354,7 +1354,7 @@ Here is the list of all Doxygen tags and the description of how they are transla
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>\throws</td>
|
<td>\throws</td>
|
||||||
<td>replaced wih ':raises:'</td>
|
<td>replaced with ':raises:'</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>\todo</td>
|
<td>\todo</td>
|
||||||
|
|
|
||||||
|
|
@ -3613,7 +3613,7 @@ A target language is given the 'Supported' status when
|
||||||
Examples must be available and run successfully.
|
Examples must be available and run successfully.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
The examples and test-suite must be fully functioning on the Travis Continuous Integration platform.
|
The examples and test-suite must be fully functioning on the Github Actions Continuous Integration platform.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
@ -3660,9 +3660,9 @@ Some minimum requirements and notes about languages with the 'Experimental' stat
|
||||||
The number of tests in these lists should be no greater than half of the number of tests in the full test-suite.
|
The number of tests in these lists should be no greater than half of the number of tests in the full test-suite.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
The examples and test-suite must also be fully functioning on the Travis Continuous Integration platform.
|
The examples and test-suite must also be fully functioning on the Github Actions Continuous Integration platform.
|
||||||
However, experimental languages will be set as 'allow_failures'.
|
However, experimental languages will be flagged as 'continue-on-error'.
|
||||||
This means that pull requests and normal development commits will not break the entire Travis build should an experimental language fail.
|
This means that pull requests and normal development commits will not break the entire Github Actions build should an experimental language fail.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Any new failed tests will be fixed on a 'best effort' basis by core developers with no promises made.
|
Any new failed tests will be fixed on a 'best effort' basis by core developers with no promises made.
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ code. SWIG fills this gap.
|
||||||
There are (at least) two different Go compilers. The first is the gc compiler
|
There are (at least) two different Go compilers. The first is the gc compiler
|
||||||
of the <a href="https://golang.org/doc/install">Go distribution</a>, normally
|
of the <a href="https://golang.org/doc/install">Go distribution</a>, normally
|
||||||
invoked via the <a href="https://golang.org/cmd/go/">go tool</a>.
|
invoked via the <a href="https://golang.org/cmd/go/">go tool</a>.
|
||||||
|
SWIG supports the gc compiler version 1.2 or later.
|
||||||
The second Go compiler is the <a href="https://golang.org/doc/install/gccgo">
|
The second Go compiler is the <a href="https://golang.org/doc/install/gccgo">
|
||||||
gccgo compiler</a>, which is a frontend to the GCC compiler suite.
|
gccgo compiler</a>, which is a frontend to the GCC compiler suite.
|
||||||
The interface to C/C++ code is completely different for the two Go compilers.
|
The interface to C/C++ code is completely different for the two Go compilers.
|
||||||
|
|
@ -142,44 +143,6 @@ You will now have a Go package that you can import from other Go packages as
|
||||||
usual.
|
usual.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
SWIG can be used without cgo, via the <tt>-no-cgo</tt> option, but
|
|
||||||
more steps are required. This only works with Go versions before 1.5.
|
|
||||||
When using Go version 1.2 or later, or when using gccgo, the code
|
|
||||||
generated by SWIG can be linked directly into the Go program. A
|
|
||||||
typical command sequence when using the Go compiler of the Go
|
|
||||||
distribution would look like this:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="code"><pre>
|
|
||||||
% swig -go -no-cgo example.i
|
|
||||||
% gcc -c code.c # The C library being wrapped.
|
|
||||||
% gcc -c example_wrap.c
|
|
||||||
% go tool 6g example.go
|
|
||||||
% go tool 6c example_gc.c
|
|
||||||
% go tool pack grc example.a example.6 example_gc.6 code.o example_wrap.o
|
|
||||||
% go tool 6g main.go
|
|
||||||
% go tool 6l main.6
|
|
||||||
</pre></div>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
You can also put the wrapped code into a shared library, and when using the Go
|
|
||||||
versions before 1.2 this is the only supported option. A typical command
|
|
||||||
sequence for this approach would look like this:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="code"><pre>
|
|
||||||
% swig -go -no-cgo -use-shlib example.i
|
|
||||||
% gcc -c -fpic example.c
|
|
||||||
% gcc -c -fpic example_wrap.c
|
|
||||||
% gcc -shared example.o example_wrap.o -o example.so
|
|
||||||
% go tool 6g example.go
|
|
||||||
% go tool 6c example_gc.c
|
|
||||||
% go tool pack grc example.a example.6 example_gc.6
|
|
||||||
% go tool 6g main.go # your code, not generated by SWIG
|
|
||||||
% go tool 6l main.6
|
|
||||||
</pre></div>
|
|
||||||
|
|
||||||
|
|
||||||
<H3><a name="Go_commandline">25.3.1 Go-specific Commandline Options</a></H3>
|
<H3><a name="Go_commandline">25.3.1 Go-specific Commandline Options</a></H3>
|
||||||
|
|
||||||
|
|
@ -206,9 +169,7 @@ swig -go -help
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>-no-cgo</td>
|
<td>-no-cgo</td>
|
||||||
<td>Generate files that can be used directly, rather than via the Go
|
<td>This option is no longer supported.</td>
|
||||||
cgo tool. This option does not work with Go 1.5 or later. It is
|
|
||||||
required for versions of Go before 1.2.</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -279,13 +240,10 @@ swig -go -help
|
||||||
<H3><a name="Go_outputs">25.3.2 Generated Wrapper Files</a></H3>
|
<H3><a name="Go_outputs">25.3.2 Generated Wrapper Files</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>There are two different approaches to generating wrapper files,
|
<p>
|
||||||
controlled by SWIG's <tt>-no-cgo</tt> option. The <tt>-no-cgo</tt>
|
SWIG will generate the following files when generating wrapper
|
||||||
option only works with version of Go before 1.5. It is required
|
code:
|
||||||
when using versions of Go before 1.2.</p>
|
</p>
|
||||||
|
|
||||||
<p>With or without the <tt>-no-cgo</tt> option, SWIG will generate the
|
|
||||||
following files when generating wrapper code:</p>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|
@ -308,17 +266,6 @@ or C++ compiler.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>When the <tt>-no-cgo</tt> option is used, and the <tt>-gccgo</tt>
|
|
||||||
option is not used, SWIG will also generate an additional file:</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
MODULE_gc.c will contain C code which should be compiled with the C
|
|
||||||
compiler distributed as part of the gc compiler. It should then be
|
|
||||||
combined with the compiled MODULE.go using go tool pack.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
<H2><a name="Go_basic_tour">25.4 A tour of basic C/C++ wrapping</a></H2>
|
<H2><a name="Go_basic_tour">25.4 A tour of basic C/C++ wrapping</a></H2>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9067,6 +9067,11 @@ You may have to add in some "jtype", "jstype", "javain" and "javaout" typemaps w
|
||||||
Here the default typemaps work for <tt>int</tt> and <tt>char *</tt>.
|
Here the default typemaps work for <tt>int</tt> and <tt>char *</tt>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that if you're wanting to effectively <b>replace</b> the JNI code generated for a C/C++ function then you'll need to use <tt>%ignore</tt> as well
|
||||||
|
to tell SWIG not to automatically generate a JNI wrapper for it.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In summary the <tt>%native</tt> directive is telling SWIG to generate the Java code to access the JNI C code, but not the JNI C function itself.
|
In summary the <tt>%native</tt> directive is telling SWIG to generate the Java code to access the JNI C code, but not the JNI C function itself.
|
||||||
This directive is only really useful if you want to mix your own hand crafted JNI code and the SWIG generated code into one Java class or package.
|
This directive is only really useful if you want to mix your own hand crafted JNI code and the SWIG generated code into one Java class or package.
|
||||||
|
|
@ -9100,7 +9105,7 @@ This method normally calls the C++ destructor or <tt>free()</tt> for C code.
|
||||||
<p>
|
<p>
|
||||||
The generated code can be debugged using both a Java debugger and a C++ debugger using the usual debugging techniques.
|
The generated code can be debugged using both a Java debugger and a C++ debugger using the usual debugging techniques.
|
||||||
Breakpoints can be set in either Java or C++ code and so both can be debugged simultaneously.
|
Breakpoints can be set in either Java or C++ code and so both can be debugged simultaneously.
|
||||||
Most debuggers do not understand both Java and C++, with one noteable exception of Sun Studio,
|
Most debuggers do not understand both Java and C++, with one notable exception of Sun Studio,
|
||||||
where it is possible to step from Java code into a JNI method within one environment.
|
where it is possible to step from Java code into a JNI method within one environment.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,24 +89,10 @@ $ swig -javascript -jsc example.i</pre>
|
||||||
<pre>
|
<pre>
|
||||||
$ swig -c++ -javascript -jsc example.i</pre>
|
$ swig -c++ -javascript -jsc example.i</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>The V8 code that SWIG generates should work with most versions from 3.11.10.
|
<p>The V8 code that SWIG generates requires at least V8 5.0. Keep in mind
|
||||||
However, the only early version that receives some testing is 3.14.5, which is
|
that this is theV8 version, not Node.js. To give some perspective, Node.js v6.0
|
||||||
still shipped with Ubuntu for some reason. Other than that it's probably safer
|
|
||||||
to assume that versions earlier than 5.0 are no longer supported. Keep in mind
|
|
||||||
that these are V8 versions, not Node.js. To give some perspective, Node.js v6.0
|
|
||||||
uses V8 5.0, v12.0 - 7.4, v14.0 - 8.1...</p>
|
uses V8 5.0, v12.0 - 7.4, v14.0 - 8.1...</p>
|
||||||
<p>The API headers for V8 >= 4.3.10 define constants which SWIG can use to
|
<p>To generate code for V8, you would run swig like so:</p>
|
||||||
determine the V8 version it is compiling for. For versions < 4.3.10, you
|
|
||||||
need to specify the V8 version when running SWIG. This is specified as a hex
|
|
||||||
constant, but the constant is read as pairs of decimal digits, so for V8
|
|
||||||
3.25.30 use constant 0x032530. This scheme can't represent components > 99,
|
|
||||||
but this constant is only useful for V8 < 4.3.10, and no V8 versions from
|
|
||||||
that era had a component > 99. For example:</p>
|
|
||||||
<div class="shell">
|
|
||||||
<pre>
|
|
||||||
$ swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i</pre>
|
|
||||||
</div>
|
|
||||||
<p>If you're targeting V8 >= 4.3.10, you would just run swig like so:</p>
|
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>
|
<pre>
|
||||||
$ swig -c++ -javascript -v8 example.i</pre>
|
$ swig -c++ -javascript -v8 example.i</pre>
|
||||||
|
|
|
||||||
|
|
@ -720,7 +720,6 @@ Here's a simple example using Trolltech's Qt Library:
|
||||||
class QApplication {
|
class QApplication {
|
||||||
public:
|
public:
|
||||||
QApplication( int argc, char **argv );
|
QApplication( int argc, char **argv );
|
||||||
void setMainWidget( QWidget *widget );
|
|
||||||
void exec();
|
void exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -736,16 +735,15 @@ public:
|
||||||
|
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
bash-2.05a$ QTPATH=/your/qt/path
|
$ QTPATH=/your/qt/path
|
||||||
bash-2.05a$ for file in swig.mli swig.ml swigp4.ml ; do swig -ocaml -co $file ; done
|
$ for file in swig.mli swig.ml swigp4.ml ; do swig -ocaml -co $file ; done
|
||||||
bash-2.05a$ ocamlc -c swig.mli ; ocamlc -c swig.ml
|
$ ocamlc -c swig.mli ; ocamlc -c swig.ml
|
||||||
bash-2.05a$ ocamlc -I `camlp4 -where` -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
|
$ ocamlc -I `camlp4 -where` -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml
|
||||||
bash-2.05a$ swig -ocaml -c++ -I$QTPATH/include qt.i
|
$ swig -ocaml -c++ -o qt_wrap.c qt.i
|
||||||
bash-2.05a$ mv qt_wrap.cxx qt_wrap.c
|
$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
|
||||||
bash-2.05a$ ocamlc -c -ccopt -xc++ -ccopt -g -g -ccopt -I$QTPATH/include qt_wrap.c
|
$ ocamlc -c qt.mli
|
||||||
bash-2.05a$ ocamlc -c qt.mli
|
$ ocamlc -c qt.ml
|
||||||
bash-2.05a$ ocamlc -c qt.ml
|
$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
|
||||||
bash-2.05a$ ocamlmktop -custom swig.cmo -I `camlp4 -where` \
|
|
||||||
camlp4o.cma swigp4.cmo qt_wrap.o qt.cmo -o qt_top -cclib \
|
camlp4o.cma swigp4.cmo qt_wrap.o qt.cmo -o qt_top -cclib \
|
||||||
-L$QTPATH/lib -cclib -lqt
|
-L$QTPATH/lib -cclib -lqt
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
|
||||||
|
|
@ -570,13 +570,13 @@ __mul__ a * b
|
||||||
__div__ a / b
|
__div__ a / b
|
||||||
__pow__ a ^ b
|
__pow__ a ^ b
|
||||||
__ldiv__ a \ b
|
__ldiv__ a \ b
|
||||||
__lshift__ a << b
|
__lshift__ a << b
|
||||||
__rshift__ a >> b
|
__rshift__ a >> b
|
||||||
__lt__ a < b
|
__lt__ a < b
|
||||||
__le__ a <= b
|
__le__ a <= b
|
||||||
__eq__ a == b
|
__eq__ a == b
|
||||||
__ge__ a >= b
|
__ge__ a >= b
|
||||||
__gt__ a > b
|
__gt__ a > b
|
||||||
__ne__ a != b
|
__ne__ a != b
|
||||||
__el_mul__ a .* b
|
__el_mul__ a .* b
|
||||||
__el_div__ a ./ b
|
__el_div__ a ./ b
|
||||||
|
|
@ -598,16 +598,16 @@ On the C++ side, the default mappings are as follows:
|
||||||
%rename(__mul__) *::operator*;
|
%rename(__mul__) *::operator*;
|
||||||
%rename(__div__) *::operator/;
|
%rename(__div__) *::operator/;
|
||||||
%rename(__mod__) *::operator%;
|
%rename(__mod__) *::operator%;
|
||||||
%rename(__lshift__) *::operator<<;
|
%rename(__lshift__) *::operator<<;
|
||||||
%rename(__rshift__) *::operator>>;
|
%rename(__rshift__) *::operator>>;
|
||||||
%rename(__el_and__) *::operator&&;
|
%rename(__el_and__) *::operator&&;
|
||||||
%rename(__el_or__) *::operator||;
|
%rename(__el_or__) *::operator||;
|
||||||
%rename(__xor__) *::operator^;
|
%rename(__xor__) *::operator^;
|
||||||
%rename(__invert__) *::operator~;
|
%rename(__invert__) *::operator~;
|
||||||
%rename(__lt__) *::operator<;
|
%rename(__lt__) *::operator<;
|
||||||
%rename(__le__) *::operator<=;
|
%rename(__le__) *::operator<=;
|
||||||
%rename(__gt__) *::operator>;
|
%rename(__gt__) *::operator>;
|
||||||
%rename(__ge__) *::operator>=;
|
%rename(__ge__) *::operator>=;
|
||||||
%rename(__eq__) *::operator==;
|
%rename(__eq__) *::operator==;
|
||||||
%rename(__ne__) *::operator!=;
|
%rename(__ne__) *::operator!=;
|
||||||
%rename(__not__) *::operator!;
|
%rename(__not__) *::operator!;
|
||||||
|
|
@ -634,7 +634,7 @@ You can use it to define special behavior, like for example defining Octave oper
|
||||||
%extend A {
|
%extend A {
|
||||||
string __str__() {
|
string __str__() {
|
||||||
stringstream sout;
|
stringstream sout;
|
||||||
sout<<$self->value;
|
sout<<$self->value;
|
||||||
return sout.str();
|
return sout.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,10 @@
|
||||||
<p>
|
<p>
|
||||||
This chapter describes SWIG's support of Perl5. Although the Perl5
|
This chapter describes SWIG's support of Perl5. Although the Perl5
|
||||||
module is one of the earliest SWIG modules, it has continued to evolve
|
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
|
and has been improved greatly with the help of SWIG users. As of SWIG
|
||||||
best results, it is recommended that SWIG be used with Perl 5.8 or
|
4.1.0, the minimum version of Perl we aim to support is Perl 5.8.0.
|
||||||
later. We're no longer testing regularly with older versions, but
|
We can no longer easily test with older versions, and they no longer
|
||||||
Perl 5.6 seems to mostly work, while older versions don't.
|
seem to be in active use.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H2><a name="Perl5_nn2">31.1 Overview</a></H2>
|
<H2><a name="Perl5_nn2">31.1 Overview</a></H2>
|
||||||
|
|
@ -680,7 +680,6 @@ files(s) field".
|
||||||
installation under "Additional include directories".
|
installation under "Additional include directories".
|
||||||
|
|
||||||
<li>Define the symbols WIN32 and MSWIN32 under preprocessor options.
|
<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
|
Note that all extensions to the ActiveWare port must be compiled with
|
||||||
the C++ compiler since Perl has been encapsulated in a C++ class.
|
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
|
"new" and "DESTROY". The constructor always returns a tied hash
|
||||||
table. This hash table is used to access the member variables of a
|
table. This hash table is used to access the member variables of a
|
||||||
structure in addition to being able to invoke member functions. The
|
structure in addition to being able to invoke member functions. The
|
||||||
<tt>%OWNER</tt> and <tt>%BLESSEDMEMBERS</tt> hash tables are used
|
<tt>%OWNER</tt> and <tt>%BLESSEDMEMBERS</tt> hash tables are
|
||||||
internally and described shortly.
|
implementation details used internally and described shortly.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<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
|
corresponding Perl object (this situation turns out to come up
|
||||||
frequently when constructing objects like linked lists and trees).
|
frequently when constructing objects like linked lists and trees).
|
||||||
When C takes possession of an object, you can change Perl's ownership
|
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
|
by calling the <tt>DISOWN</tt> method (which will delete the object
|
||||||
done using the <tt>DISOWN</tt> method.
|
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>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang"><pre>
|
<div class="targetlang"><pre>
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,19 @@
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In this chapter, we discuss SWIG's support of PHP. SWIG currently supports
|
In this chapter, we discuss SWIG's support of PHP. Currently any PHP7 or PHP8
|
||||||
generating wrappers for PHP7 and PHP8. Support for PHP5 was removed in SWIG
|
release should work.
|
||||||
4.0.0 and support for PHP4 was removed in SWIG 1.3.37.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Currently any PHP7 or PHP8 release should work.
|
Support for PHP7 was added in SWIG 3.0.11 and for PHP8 in 4.1.0.
|
||||||
|
Support for PHP5 was removed in SWIG 4.0.0 and support for PHP4 was removed in
|
||||||
|
SWIG 1.3.37. There never was a PHP6 release.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In order to use this module, you will need to have a copy of the PHP
|
In order to use this module, you will need to have a copy of the PHP
|
||||||
include files to compile the SWIG generated files. If you installed
|
include files to compile the SWIG generated C/C++ sources. If you installed
|
||||||
PHP from a binary package, you may need to install a "php-dev" or "php-devel"
|
PHP from a binary package, you may need to install a "php-dev" or "php-devel"
|
||||||
package for these to be installed. You can find out where these files are
|
package for these to be installed. You can find out where these files are
|
||||||
by running <tt>php-config --includes</tt>. To use the built PHP module you
|
by running <tt>php-config --includes</tt>. To use the built PHP module you
|
||||||
|
|
@ -161,7 +162,7 @@ default extension directory, you also need to specify the path, for example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
extension=/path/to/modulename.so
|
extension=/path/to/modulename.so
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -343,6 +344,80 @@ $c = bar(3.5); # Use default argument for 2nd parameter
|
||||||
|
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
SWIG generates PHP type declarations for function parameters and return
|
||||||
|
types for PHP 8 and later (we don't try to support PHP 7's more limited type
|
||||||
|
declarations and the generated wrappers compiled for PHP 7 will not have any
|
||||||
|
type declarations).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You can control the generation of PHP type declarations using
|
||||||
|
the "php:type" %feature. This has three settings:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li> <p>If unset or set to "0" then no type declarations are generated, e.g.: <tt>%feature("php:type", "0");</tt>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li> <p>If set to "1" then type declarations are generated for both parameters and return types, e.g.: <tt>%feature("php:type", "1");</tt>
|
||||||
|
</p></li>
|
||||||
|
<li> <p>The default setting is "compat", which is the same as "1" except no
|
||||||
|
return type declarations are generated for virtual methods for which
|
||||||
|
directors are enabled. This provides better compatibility for PHP
|
||||||
|
subclasses of wrapped virtual methods in existing SWIG-generated bindings, e.g.: <tt>%feature("php:type", "compat");</tt>
|
||||||
|
</p></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you have an existing PHP interface and are upgrading to SWIG >= 4.1.0
|
||||||
|
then the default "compat" setting should work well.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you're writing a new set of bindings and <b>only targetting PHP8 or newer</b>
|
||||||
|
then enabling type declarations everywhere probably makes sense. It will
|
||||||
|
only actually make a difference if you enable directors and are wrapping C++
|
||||||
|
classes with virtual methods, but doing it anyway means you won't forget to if
|
||||||
|
the code you are wrapping later evolves to have such classes and methods.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The type declaration information will make the generated source code and
|
||||||
|
compiler extension module larger, so you might want to turn off type
|
||||||
|
declarations if keeping these small is important to you. If you find you
|
||||||
|
need to turn off type declarations to fix a problem, please let us know
|
||||||
|
via our github issue tracker.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that being a SWIG feature this can be specified globally (like above) or
|
||||||
|
per class, per method, etc. See the <a
|
||||||
|
href="Customization.html#Customization_features">%feature directives</a>
|
||||||
|
section for full details of how to control at a fine-grained level.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The PHP type information is specified via a "phptype" attribute on "in" and
|
||||||
|
"out" typemaps, and these have been added for all the typemaps we supply for
|
||||||
|
PHP. We don't currently support this for "argout" templates, but probably
|
||||||
|
will in a future version.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you have written custom SWIG typemaps for PHP and want to add PHP type
|
||||||
|
declarations, then the syntax is very like how you'd specify the type in
|
||||||
|
PHP code, e.g. <tt>%typemap(in, phptype="int|string|Foo")</tt> means the
|
||||||
|
typemap accepts a PHP int or string or an object of class Foo,
|
||||||
|
<tt>%typemap(in, phptype="?int")</tt> means a PHP int or NULL, etc.
|
||||||
|
As well as the standard PHP type declaration types, SWIG also understands the
|
||||||
|
special type "SWIGTYPE" as an entry in phptype, which means the PHP type
|
||||||
|
corresponding to the type that this typemap matched on - for a object this
|
||||||
|
will give you the PHP class for the object, and for a pointer to a non-class
|
||||||
|
type it will give you the name of the PHP class SWIG created for that
|
||||||
|
pointer type.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- This isn't correct for 1.3.30 and needs rewriting to reflect reality
|
<!-- This isn't correct for 1.3.30 and needs rewriting to reflect reality
|
||||||
<p>
|
<p>
|
||||||
Because PHP is a dynamically typed language, the default typemaps
|
Because PHP is a dynamically typed language, the default typemaps
|
||||||
|
|
@ -426,6 +501,7 @@ taking the integer argument.
|
||||||
|
|
||||||
<H3><a name="Php_nn2_5">32.2.5 Pointers and References</a></H3>
|
<H3><a name="Php_nn2_5">32.2.5 Pointers and References</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Since SWIG 4.1.0, SWIG wraps C/C++ classes directly with PHP objects.
|
Since SWIG 4.1.0, SWIG wraps C/C++ classes directly with PHP objects.
|
||||||
Pointers to other types are also wrapped as PHP objects - mostly this is an
|
Pointers to other types are also wrapped as PHP objects - mostly this is an
|
||||||
|
|
@ -742,7 +818,10 @@ class Ko {
|
||||||
};
|
};
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
would be executed in PHP as,
|
<p>
|
||||||
|
would be executed in PHP as
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="code"><pre>
|
<div class="code"><pre>
|
||||||
Ko::threats();
|
Ko::threats();
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
@ -1158,7 +1237,7 @@ should suffice in most cases:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you only need to support SWIG >= 4.1.0, you can just use the
|
If you only need to support SWIG >= 4.1.0, you can just use the
|
||||||
<tt>($error != NULL)</tt> condition.
|
<tt>($error != NULL)</tt> condition.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,12 +281,12 @@ You must use <a href="http://www.gnu.org/software/make/">GNU make</a> to build a
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="http://www.pcre.org/">PCRE</a>
|
<a href="http://www.pcre.org/">PCRE2</a>
|
||||||
needs to be installed on your system to build SWIG, in particular
|
needs to be installed on your system to build SWIG, in particular
|
||||||
pcre-config must be available. If you have PCRE headers and libraries but not
|
pcre2-config must be available. If you have PCRE2 headers and libraries but not
|
||||||
pcre-config itself or, alternatively, wish to override the compiler or linker
|
pcre2-config itself or, alternatively, wish to override the compiler or linker
|
||||||
flags returned by pcre-config, you may set PCRE_LIBS and PCRE_CFLAGS variables
|
flags returned by pcre2-config, you may set PCRE2_LIBS and PCRE2_CFLAGS variables
|
||||||
to be used instead. And if you don't have PCRE at all, the configure script
|
to be used instead. And if you don't have PCRE2 at all, the configure script
|
||||||
will provide instructions for obtaining it.
|
will provide instructions for obtaining it.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1608,7 +1608,7 @@ public:
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In Python, the static member can be access in three different ways:
|
In Python, the static member can be accessed in three different ways:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
|
|
@ -1616,7 +1616,7 @@ In Python, the static member can be access in three different ways:
|
||||||
>>> example.Spam_foo() # Spam::foo()
|
>>> example.Spam_foo() # Spam::foo()
|
||||||
>>> s = example.Spam()
|
>>> s = example.Spam()
|
||||||
>>> s.foo() # Spam::foo() via an instance
|
>>> s.foo() # Spam::foo() via an instance
|
||||||
>>> example.Spam.foo() # Spam::foo(). Python-2.2 only
|
>>> example.Spam.foo() # Spam::foo() using Python-2.2 and later
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1627,16 +1627,31 @@ last technique is only available in Python-2.2 and later versions.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Static member variables are currently accessed as global variables. This means,
|
Static member variables are currently accessed as global variables. This means,
|
||||||
they are accessed through <tt>cvar</tt> like this:
|
they are accessed through <tt>cvar</tt> or via an instance property:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="targetlang">
|
<div class="targetlang">
|
||||||
<pre>
|
<pre>
|
||||||
>>> print example.cvar.Spam_bar
|
>>> example.cvar.Spam_bar # Spam::bar
|
||||||
|
7
|
||||||
|
>>> s = example.Spam()
|
||||||
|
>>> s.bar # Spam::bar via an instance property
|
||||||
7
|
7
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <tt>-builtin</tt> option uses a metaclass to additionally provide access as follows:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="targetlang">
|
||||||
|
<pre>
|
||||||
|
>>> example.Spam.bar # Spam::bar using -builtin option only
|
||||||
|
7
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<H3><a name="Python_nn21">33.3.8 C++ inheritance</a></H3>
|
<H3><a name="Python_nn21">33.3.8 C++ inheritance</a></H3>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4939,7 +4954,6 @@ object to be used as a <tt>char **</tt> object.
|
||||||
if (PyString_Check(o)) {
|
if (PyString_Check(o)) {
|
||||||
$1[i] = PyString_AsString(PyList_GetItem($input, i));
|
$1[i] = PyString_AsString(PyList_GetItem($input, i));
|
||||||
} else {
|
} else {
|
||||||
free($1);
|
|
||||||
PyErr_SetString(PyExc_TypeError, "list must contain strings");
|
PyErr_SetString(PyExc_TypeError, "list must contain strings");
|
||||||
SWIG_fail;
|
SWIG_fail;
|
||||||
}
|
}
|
||||||
|
|
@ -5038,7 +5052,6 @@ previous example:
|
||||||
if (PyString_Check(o)) {
|
if (PyString_Check(o)) {
|
||||||
$2[i] = PyString_AsString(PyList_GetItem($input, i));
|
$2[i] = PyString_AsString(PyList_GetItem($input, i));
|
||||||
} else {
|
} else {
|
||||||
free($2);
|
|
||||||
PyErr_SetString(PyExc_TypeError, "list must contain strings");
|
PyErr_SetString(PyExc_TypeError, "list must contain strings");
|
||||||
SWIG_fail;
|
SWIG_fail;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ slices)
|
||||||
<p>
|
<p>
|
||||||
Wrapping of C++ classes for R works quite well. R has a special
|
Wrapping of C++ classes for R works quite well. R has a special
|
||||||
type, known as an external reference, that can be used as a pointer
|
type, known as an external reference, that can be used as a pointer
|
||||||
to arbitary things, including C++ classes. The proxy layers generated
|
to arbitrary things, including C++ classes. The proxy layers generated
|
||||||
for other classes are not required.
|
for other classes are not required.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -265,7 +265,7 @@ v2$Axles
|
||||||
[1] 4
|
[1] 4
|
||||||
v1$Available
|
v1$Available
|
||||||
[1] FALSE
|
[1] FALSE
|
||||||
# Set availabilty
|
# Set availability
|
||||||
v1$Available <- TRUE
|
v1$Available <- TRUE
|
||||||
v1$Available
|
v1$Available
|
||||||
[1] TRUE
|
[1] TRUE
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
<li><a href="#SWIG_rename_ignore">Renaming and ignoring declarations</a>
|
<li><a href="#SWIG_rename_ignore">Renaming and ignoring declarations</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#SWIG_nn29">Simple renaming of specific identifiers</a>
|
<li><a href="#SWIG_nn29">Simple renaming of specific identifiers</a>
|
||||||
|
<li><a href="#SWIG_ignore">Ignoring identifiers</a>
|
||||||
<li><a href="#SWIG_advanced_renaming">Advanced renaming support</a>
|
<li><a href="#SWIG_advanced_renaming">Advanced renaming support</a>
|
||||||
<li><a href="#SWIG_limiting_renaming">Limiting global renaming rules</a>
|
<li><a href="#SWIG_limiting_renaming">Limiting global renaming rules</a>
|
||||||
<li><a href="#SWIG_chosen_unignore">Ignoring everything then wrapping a few selected symbols</a>
|
<li><a href="#SWIG_chosen_unignore">Ignoring everything then wrapping a few selected symbols</a>
|
||||||
|
|
@ -208,7 +209,7 @@ General Options
|
||||||
-oh <headfile> - Set name of C++ output header file for directors to <headfile>
|
-oh <headfile> - Set name of C++ output header file for directors to <headfile>
|
||||||
-outcurrentdir - Set default output dir to current dir instead of input file's path
|
-outcurrentdir - Set default output dir to current dir instead of input file's path
|
||||||
-outdir <dir> - Set language specific files output directory to <dir>
|
-outdir <dir> - Set language specific files output directory to <dir>
|
||||||
-pcreversion - Display PCRE version information
|
-pcreversion - Display PCRE2 version information
|
||||||
-small - Compile in virtual elimination and compact mode
|
-small - Compile in virtual elimination and compact mode
|
||||||
-swiglib - Report location of SWIG library and exit
|
-swiglib - Report location of SWIG library and exit
|
||||||
-templatereduce - Reduce all the typedefs in templates
|
-templatereduce - Reduce all the typedefs in templates
|
||||||
|
|
@ -1469,14 +1470,14 @@ SWIG generates the following code:
|
||||||
<pre>
|
<pre>
|
||||||
/* C mode */
|
/* C mode */
|
||||||
void foo_set(char *value) {
|
void foo_set(char *value) {
|
||||||
if (foo) free(foo);
|
free(foo);
|
||||||
foo = (char *) malloc(strlen(value)+1);
|
foo = (char *) malloc(strlen(value)+1);
|
||||||
strcpy(foo, value);
|
strcpy(foo, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* C++ mode. When -c++ option is used */
|
/* C++ mode. When -c++ option is used */
|
||||||
void foo_set(char *value) {
|
void foo_set(char *value) {
|
||||||
if (foo) delete [] foo;
|
delete [] foo;
|
||||||
foo = new char[strlen(value)+1];
|
foo = new char[strlen(value)+1];
|
||||||
strcpy(foo, value);
|
strcpy(foo, value);
|
||||||
}
|
}
|
||||||
|
|
@ -1841,6 +1842,25 @@ all to `output' by specifying :</p>
|
||||||
%rename(output) print; // Rename all `print' functions to `output'
|
%rename(output) print; // Rename all `print' functions to `output'
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
A new <tt>%rename</tt> for the same name will replace the current
|
||||||
|
<tt>%rename</tt> for all uses after it in the file, and setting the
|
||||||
|
new name to "" will remove the rename. So, for instance, if you
|
||||||
|
wanted to rename some things in one file and not in another, you could
|
||||||
|
do:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%rename(print1) print;
|
||||||
|
%include "header1.h" //Anything "print" in here will become "print1"
|
||||||
|
%rename(print2) print;
|
||||||
|
%include "header2.h" //Anything "print" in here will become "print2"
|
||||||
|
%rename("") print;
|
||||||
|
%include "header3.h" //Anything "print" in here will remain "print"
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
SWIG does not normally perform any checks to see if the functions it wraps are
|
SWIG does not normally perform any checks to see if the functions it wraps are
|
||||||
already defined in the target scripting language. However, if you are
|
already defined in the target scripting language. However, if you are
|
||||||
|
|
@ -1857,6 +1877,9 @@ If you are using the <tt>%rename</tt> directive and C++, make sure you read the
|
||||||
for method overloading and default arguments.
|
for method overloading and default arguments.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<H4><a name="SWIG_ignore">5.4.7.2 Ignoring identifiers</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Closely related to <tt>%rename</tt> is the <tt>%ignore</tt> directive. <tt>%ignore</tt> instructs SWIG
|
Closely related to <tt>%rename</tt> is the <tt>%ignore</tt> directive. <tt>%ignore</tt> instructs SWIG
|
||||||
to ignore declarations that match a given identifier. For example:
|
to ignore declarations that match a given identifier. For example:
|
||||||
|
|
@ -1896,7 +1919,7 @@ This directive is still supported, but it is deprecated and should probably be a
|
||||||
directive is more powerful and better supports wrapping of raw header file information.
|
directive is more powerful and better supports wrapping of raw header file information.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H4><a name="SWIG_advanced_renaming">5.4.7.2 Advanced renaming support</a></H4>
|
<H4><a name="SWIG_advanced_renaming">5.4.7.3 Advanced renaming support</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2022,8 +2045,8 @@ and a more descriptive one, but the two functions are otherwise equivalent:
|
||||||
<td>String after (Perl-like) regex substitution operation. This function
|
<td>String after (Perl-like) regex substitution operation. This function
|
||||||
allows applying arbitrary regular expressions to the identifier names. The
|
allows applying arbitrary regular expressions to the identifier names. The
|
||||||
<i>pattern</i> part is a regular expression in Perl syntax (as supported
|
<i>pattern</i> part is a regular expression in Perl syntax (as supported
|
||||||
by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions (PCRE)</a>)
|
by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions</a>)
|
||||||
library and the <i>subst</i> string
|
(PCRE2 library) and the <i>subst</i> string
|
||||||
can contain back-references of the form <tt>\N</tt> where <tt>N</tt> is a digit
|
can contain back-references of the form <tt>\N</tt> where <tt>N</tt> is a digit
|
||||||
from 0 to 9, or one of the following escape sequences: <tt>\l</tt>, <tt>\L</tt>,
|
from 0 to 9, or one of the following escape sequences: <tt>\l</tt>, <tt>\L</tt>,
|
||||||
<tt>\u</tt>, <tt>\U</tt> or <tt>\E</tt>. The back-references are replaced with the
|
<tt>\u</tt>, <tt>\U</tt> or <tt>\E</tt>. The back-references are replaced with the
|
||||||
|
|
@ -2105,7 +2128,7 @@ are exactly equivalent and <tt>%rename</tt> can be used to selectively ignore
|
||||||
multiple declarations using the previously described matching possibilities.
|
multiple declarations using the previously described matching possibilities.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H4><a name="SWIG_limiting_renaming">5.4.7.3 Limiting global renaming rules</a></H4>
|
<H4><a name="SWIG_limiting_renaming">5.4.7.4 Limiting global renaming rules</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2203,7 +2226,7 @@ wrap C++ overloaded functions and methods or C++ methods which use default argum
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<H4><a name="SWIG_chosen_unignore">5.4.7.4 Ignoring everything then wrapping a few selected symbols</a></H4>
|
<H4><a name="SWIG_chosen_unignore">5.4.7.5 Ignoring everything then wrapping a few selected symbols</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -2227,6 +2250,23 @@ the following approach could be taken:
|
||||||
%rename("%s") Star::shine; // named method
|
%rename("%s") Star::shine; // named method
|
||||||
|
|
||||||
%include "myheader.h"
|
%include "myheader.h"
|
||||||
|
|
||||||
|
%rename("%s") ""; // Undo the %ignore
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If <tt>Star</tt> was in the <tt>Galaxy</tt> namespace, you would need
|
||||||
|
to unignore the namespace, too, and add the namespace to all the
|
||||||
|
renames:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%rename("%s") Galaxy;
|
||||||
|
%rename("%s") Galaxy::Star;
|
||||||
|
%rename("%s") Galaxy::Star::Star;
|
||||||
|
...
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -2241,6 +2281,7 @@ members of the class, so when the chosen class is unignored, all of its methods
|
||||||
%rename($ignore, %$isclass) ""; // Only ignore all classes
|
%rename($ignore, %$isclass) ""; // Only ignore all classes
|
||||||
%rename("%s") Star; // Unignore 'Star'
|
%rename("%s") Star; // Unignore 'Star'
|
||||||
%include "myheader.h"
|
%include "myheader.h"
|
||||||
|
%rename("%s", %$isclass) ""; // Stop ignoring all classes
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -2594,8 +2635,7 @@ char *Foo_name_get(Foo *obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Foo_name_set(Foo *obj, char *c) {
|
char *Foo_name_set(Foo *obj, char *c) {
|
||||||
if (obj->name)
|
free(obj->name);
|
||||||
free(obj->name);
|
|
||||||
obj->name = (char *) malloc(strlen(c)+1);
|
obj->name = (char *) malloc(strlen(c)+1);
|
||||||
strcpy(obj->name, c);
|
strcpy(obj->name, c);
|
||||||
return obj->name;
|
return obj->name;
|
||||||
|
|
@ -2976,6 +3016,11 @@ typedef struct Vector {
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You'll also need to use these names if you want to directly call methods added
|
||||||
|
using <tt>%extend</tt> from other C/C++ code.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The name used for %extend should be the name of the struct and not the name of any typedef to the struct.
|
The name used for %extend should be the name of the struct and not the name of any typedef to the struct.
|
||||||
For example:
|
For example:
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="#SWIGPlus_nn28">Overloaded operators</a>
|
<li><a href="#SWIGPlus_nn28">Overloaded operators</a>
|
||||||
<li><a href="#SWIGPlus_class_extension">Class extension</a>
|
<li><a href="#SWIGPlus_class_extension">Class extension</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#SWIGPlus_replacing_methods">Replacing class methods</a>
|
||||||
|
</ul>
|
||||||
<li><a href="#SWIGPlus_nn30">Templates</a>
|
<li><a href="#SWIGPlus_nn30">Templates</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#SWIGPlus_template_directive">The %template directive</a>
|
<li><a href="#SWIGPlus_template_directive">The %template directive</a>
|
||||||
|
|
@ -2944,6 +2947,59 @@ be used to extend a structure with more than just methods, a more suitable
|
||||||
directive name has been chosen.
|
directive name has been chosen.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<H3><a name="SWIGPlus_replacing_methods">6.17.1 Replacing class methods</a></H3>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Suppose there is a method in a class that you need to replace and keep the method name the same.
|
||||||
|
This can be achieved combining the <tt>%extend</tt> and <tt>%ignore</tt> directives covered earlier.
|
||||||
|
Here is an example to replace the <tt>MyClass::mymethod()</tt>:
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%extend MyClass {
|
||||||
|
void mymethod() {
|
||||||
|
std::cout << "swig mymethod" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%ignore MyClass::mymethod;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class MyClass {
|
||||||
|
public:
|
||||||
|
void mymethod() {
|
||||||
|
std::cout << "class mymethod" << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Or if your code organization makes more sense to put
|
||||||
|
the <tt>%extend</tt> after the class definition, you would need the following:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%rename("") MyClass::mymethod; // unignores the method
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
before the <tt>%extend</tt> or SWIG will continue to ignore
|
||||||
|
<tt>mymethod()</tt>, even in an <tt>%extend</tt>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that you can call the class method from the method
|
||||||
|
in <tt>%extend</tt>, just use <tt>self->mymethod()</tt> and it will call
|
||||||
|
the class method, not the one in <tt>%extend</tt>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<H2><a name="SWIGPlus_nn30">6.18 Templates</a></H2>
|
<H2><a name="SWIGPlus_nn30">6.18 Templates</a></H2>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3632,7 +3688,7 @@ Alternatively, you could expand the constructor template in selected instantiati
|
||||||
|
|
||||||
// Create default and conversion constructors
|
// Create default and conversion constructors
|
||||||
%extend pair<double, double> {
|
%extend pair<double, double> {
|
||||||
%template(paird) pair<double, dobule>; // Default constructor
|
%template(paird) pair<double, double>; // Default constructor
|
||||||
%template(pairc) pair<int, int>; // Conversion constructor
|
%template(pairc) pair<int, int>; // Conversion constructor
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
|
|
@ -3647,7 +3703,7 @@ instead:
|
||||||
<pre>
|
<pre>
|
||||||
// Create default and conversion constructors
|
// Create default and conversion constructors
|
||||||
%extend pair<double, double> {
|
%extend pair<double, double> {
|
||||||
%template(pair) pair<double, dobule>; // Default constructor
|
%template(pair) pair<double, double>; // Default constructor
|
||||||
%template(pair) pair<int, int>; // Conversion constructor
|
%template(pair) pair<int, int>; // Conversion constructor
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -1227,7 +1227,15 @@ _108fea88_p_Bar
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Finally, to destroy objects created from Tcl, you can either let the object
|
Finally, to destroy objects created from Tcl, you can either let the object
|
||||||
name go out of scope or you can explicitly delete the object. For example:
|
name go out of scope or you can explicitly delete the object as shown below.
|
||||||
|
Objects won't get automatically destroyed when the Tcl program exits, so if
|
||||||
|
it's important that the C++ destructor is called for a class you'll need to
|
||||||
|
make sure that you explicitly do this for objects of that class before program
|
||||||
|
exit.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
For example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
|
|
@ -2811,9 +2819,7 @@ used as a <tt>char **</tt> object.
|
||||||
|
|
||||||
// This gives SWIG some cleanup code that will get called after the function call
|
// This gives SWIG some cleanup code that will get called after the function call
|
||||||
%typemap(freearg) char ** {
|
%typemap(freearg) char ** {
|
||||||
if ($1) {
|
free($1);
|
||||||
free($1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now a test functions
|
// Now a test functions
|
||||||
|
|
|
||||||
|
|
@ -3103,7 +3103,7 @@ as shown. To work with heap allocated data, the following technique can be use
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(freearg) float value[ANY] {
|
%typemap(freearg) float value[ANY] {
|
||||||
if ($1) free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -3556,7 +3556,7 @@ maps perform the conversion described for the above example:
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(freearg) (int argc, char *argv[]) {
|
%typemap(freearg) (int argc, char *argv[]) {
|
||||||
if ($2) free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Required for C++ method overloading */
|
/* Required for C++ method overloading */
|
||||||
|
|
|
||||||
|
|
@ -428,6 +428,7 @@ example.i(4) : Syntax error in input(1).
|
||||||
<li>324. Named nested template instantiations not supported. Processing as if no name was given to %template().
|
<li>324. Named nested template instantiations not supported. Processing as if no name was given to %template().
|
||||||
<li>325. Nested <em>kind</em> not currently supported (<em>name</em> ignored).
|
<li>325. Nested <em>kind</em> not currently supported (<em>name</em> ignored).
|
||||||
<li>326. Deprecated %extend name used - the <em>kind</em> name '<em>name</em>' should be used instead of the typedef name '<em>name</em>'.
|
<li>326. Deprecated %extend name used - the <em>kind</em> name '<em>name</em>' should be used instead of the typedef name '<em>name</em>'.
|
||||||
|
<li>327. Extern template ignored.
|
||||||
<li>350. operator new ignored.
|
<li>350. operator new ignored.
|
||||||
<li>351. operator delete ignored.
|
<li>351. operator delete ignored.
|
||||||
<li>352. operator+ ignored.
|
<li>352. operator+ ignored.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Getting started on Windows</title>
|
<title>Getting started on Windows</title>
|
||||||
|
|
@ -29,17 +29,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="#Windows_other_compilers">Instructions for using the Examples with other compilers</a>
|
<li><a href="#Windows_other_compilers">Instructions for using the Examples with other compilers</a>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a href="#Windows_cygwin_mingw">SWIG on Cygwin and MinGW</a>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#Windows_swig_exe">Building swig.exe on Windows</a>
|
<li><a href="#Windows_swig_exe">Building swig.exe on Windows</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#Windows_cmake">Building swig.exe using CMake</a>
|
<li><a href="#Windows_cmake">Building swig.exe using CMake</a>
|
||||||
<li><a href="#Windows_mingw_msys">Building swig.exe using MSYS2</a>
|
<li><a href="#Windows_msys2">Building swig.exe using MSYS2</a>
|
||||||
<li><a href="#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a>
|
<li><a href="#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a>
|
||||||
<li><a href="#Windows_cygwin">Building swig.exe using Cygwin</a>
|
<li><a href="#Windows_cygwin">Building swig.exe using Cygwin</a>
|
||||||
</ul>
|
<ul>
|
||||||
<li><a href="#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a>
|
<li><a href="#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
</ul>
|
||||||
<li><a href="#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
<li><a href="#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -210,94 +209,97 @@ RUBY_LIB: D:\ruby\lib\mswin32-ruby16.lib<br>
|
||||||
If you do not have access to Visual C++ you will have to set up project files / Makefiles for your chosen compiler. There is a section in each of the language modules detailing what needs setting up using Visual C++ which may be of some guidance. Alternatively you may want to use Cygwin as described in the following section.
|
If you do not have access to Visual C++ you will have to set up project files / Makefiles for your chosen compiler. There is a section in each of the language modules detailing what needs setting up using Visual C++ which may be of some guidance. Alternatively you may want to use Cygwin as described in the following section.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H2><a name="Windows_cygwin_mingw">3.3 SWIG on Cygwin and MinGW</a></H2>
|
<H2><a name="Windows_swig_exe">3.3 Building swig.exe on Windows</a></H2>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ISO C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied.
|
The SWIG distribution provides a pre-built swig.exe and so it is not necessary for users to build the SWIG executable.
|
||||||
|
However, this section is provided for those that want to modify the SWIG source code in a Windows environment.
|
||||||
|
Normally this is not needed, so most people will want to ignore this section.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H3><a name="Windows_swig_exe">3.3.1 Building swig.exe on Windows</a></H3>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you want to replicate the build of swig.exe that comes with the download, follow the MinGW instructions below.
|
There are various ways to build the SWIG executable including <a href="https://cmake.org/">CMake</a> which is able to generate project files for building with Visual Studio.
|
||||||
This is not necessary to use the supplied swig.exe.
|
SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</a>, <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a>, all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
|
||||||
This information is provided for those that want to modify the SWIG source code in a Windows environment.
|
|
||||||
Normally this is not needed, so most people will want to ignore this section.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<H4><a name="Windows_cmake">3.3.1.1 Building swig.exe using CMake</a></H4>
|
|
||||||
|
<H3><a name="Windows_cmake">3.3.1 Building swig.exe using CMake</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
SWIG can also be built using <a href="https://cmake.org/">CMake</a> and Visual Studio rather than autotools. As with the other approaches to
|
SWIG can be built using <a href="https://cmake.org/">CMake</a> and Visual Studio rather than autotools. As with the other approaches to
|
||||||
building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
|
building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
|
||||||
For fully working build steps always check the Continuous Integration setups currently detailed in the <a href="https://github.com/swig/swig/blob/master/appveyor.yml">Appveyor YAML file</a>.
|
For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the <a href="https://github.com/swig/swig/blob/master/appveyor.yml">Appveyor YAML file</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
Install Nuget from <a href="https://www.nuget.org/downloads">https://www.nuget.org/downloads</a> (v5.8.1 is used in this example, and installed to C:\Tools). Nuget is the package manager
|
Install Nuget from <a href="https://www.nuget.org/downloads">https://www.nuget.org/downloads</a> (v6.0.0 is used in this example, and installed to <tt>C:\Tools</tt>). Nuget is the package manager
|
||||||
for .NET, but allows us to easily install <a href="https://www.pcre.org/">PCRE</a> and other dependencies required by SWIG.
|
for .NET, but allows us to easily install <a href="https://cmake.org/">CMake</a> and other dependencies required by SWIG.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Install CMake using the following command: <pre>C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
|
Install <a href="https://www.nuget.org/packages/CMake-win64/">CMake-win64 Nuget package</a> using the following command: <pre>C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
|
||||||
Alternatively you can download CMake from <a href="https://cmake.org/download/">https://cmake.org/download/</a>.
|
Alternatively you can download CMake from <a href="https://cmake.org/download/">https://cmake.org/download/</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Install Bison using the following command: <pre>C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison</pre>
|
Install the <a href="https://www.nuget.org/packages/bison/">Bison Nuget package</a> using the following command: <pre>C:\Tools\nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison</pre>
|
||||||
Alternatively download Bison from <a href="https://sourceforge.net/projects/gnuwin32/files/bison/">https://sourceforge.net/projects/gnuwin32/files/bison/</a> (2.4.1 is used in this example)
|
Alternatively download Bison from <a href="https://sourceforge.net/projects/winflexbison/files/">https://sourceforge.net/projects/winflexbison/files/</a> (Bison 3.7.4 is used in this example)
|
||||||
and save to a folder e.g. C:\Tools\Bison
|
and save to a folder e.g. <tt>C:\Tools\Bison</tt>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Install PCRE using Nuget using the following command: <pre>C:\Tools\nuget install pcre -Version 8.33.0.1 -OutputDirectory C:\Tools\pcre</pre>
|
Unfortunately, PCRE2 is not yet available on Nuget. Instead we will use CMake to build and install <a href="https://www.pcre.org/">PCRE2</a> to <tt>C:\Tools\pcre2</tt> using the following commands:
|
||||||
|
<div class="shell"><pre>
|
||||||
|
cd C:\
|
||||||
|
SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;%PATH%
|
||||||
|
git clone https://github.com/PhilipHazel/pcre2.git
|
||||||
|
cd pcre2
|
||||||
|
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:/Tools/pcre2 -S . -B build
|
||||||
|
cmake --build build --config Release --target install
|
||||||
|
</pre></div>
|
||||||
|
Alternatively, set <tt>WITH_PCRE=OFF</tt> to disable PCRE2 support if you are sure you do not require it.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
|
We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
|
||||||
using <pre>git clone https://github.com/swig/swig.git</pre>
|
using <pre>git clone https://github.com/swig/swig.git</pre>
|
||||||
In this example we are assuming the source code is available at C:\swig
|
In this example we are assuming the source code is available at <tt>C:\swig</tt>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
<li>
|
||||||
|
<p>
|
||||||
<p>
|
Now we have all the required dependencies we can build SWIG using the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change <tt>"Visual Studio 16 2019 -A x64"</tt> to the relevant
|
||||||
We are assuming Visual Studio 2017 is installed. For other versions of Visual Studio change <i>"Visual Studio 15 2017 Win64"</i> to the relevant
|
<a href="https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators">Visual Studio Generator</a> and
|
||||||
<a href="https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators">Visual Studio Generator</a>.
|
architecture. We add the required build tools to the system PATH, and then
|
||||||
Now we have all the required dependencies we can build SWIG using the commands below. We add the required build tools to the system PATH, and then
|
build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in the <tt>C:/swig/install2/bin</tt> folder.
|
||||||
build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in a /Release folder.
|
</p>
|
||||||
</p>
|
<div class="shell"> <pre>
|
||||||
|
|
||||||
<div class="shell">
|
|
||||||
<pre>
|
|
||||||
cd C:\swig
|
cd C:\swig
|
||||||
SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\bison-win32.2.4.1.1\tools\native\bin;%PATH%
|
SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;%PATH%
|
||||||
SET PCRE_ROOT=C:\Tools\pcre\pcre.8.33.0.1\build\native
|
SET PCRE_ROOT=C:/Tools/pcre2
|
||||||
SET PCRE_PLATFORM=x64
|
SET PCRE_PLATFORM=x64
|
||||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE_STATIC" ^
|
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
|
||||||
-DPCRE_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE_LIBRARY=%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8/pcre8.lib .
|
-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build
|
||||||
cmake --build . --config Release
|
cmake --build build --config Release --target install
|
||||||
|
|
||||||
REM to test the exe
|
REM to test the exe
|
||||||
cd /Release
|
cd install2/bin
|
||||||
swig.exe -help
|
swig.exe -help
|
||||||
</pre>
|
</pre></div>
|
||||||
</div>
|
</li>
|
||||||
|
</ol>
|
||||||
<p>
|
<p>
|
||||||
In addition to Release builds you can create a Debug build using:
|
In addition to Release builds you can create a Debug build using:
|
||||||
</p>
|
</p>
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>cmake --build . --config Debug</pre>
|
<pre>cmake --build build --config Debug</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
A Visual Studio solution file should be generated named swig.sln. This can be opened and debugged by running the swig project and setting the
|
A Visual Studio solution file should be generated named swig.sln. This can be opened and debugged by running the swig project and setting <tt>Properties > Debugging > Command Arguments</tt>. For example to debug one of the test-suite .i files included with the SWIG source use the following:
|
||||||
Debugging Command Arguments. For example to debug one of the test-suite .i files included with the SWIG source use the following:
|
|
||||||
</p>
|
</p>
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>-python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i</pre>
|
<pre>-python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<H4><a name="Windows_mingw_msys">3.3.1.2 Building swig.exe using MSYS2</a></H4>
|
<H3><a name="Windows_msys2">3.3.2 Building swig.exe using MSYS2</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -310,7 +312,7 @@ Install the packages needed to build swig:<br>
|
||||||
|
|
||||||
<div class="shell">
|
<div class="shell">
|
||||||
<pre>
|
<pre>
|
||||||
pacman -S git autoconf automake bison gcc make pcre-devel
|
pacman -S git autoconf automake bison gcc make pcre2-devel
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -349,7 +351,7 @@ make install
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<H4><a name="Windows_mingw_msys">3.3.1.3 Building swig.exe using MinGW and MSYS</a></H4>
|
<H3><a name="Windows_mingw_msys">3.3.3 Building swig.exe using MinGW and MSYS</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -444,10 +446,10 @@ the autotools will fail miserably on those.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
The PCRE third party library needs to be built next.
|
The PCRE2 third party library needs to be built next.
|
||||||
Download the latest PCRE source tarball, such as <tt>pcre-8.10.tar.bz2</tt>, from
|
Download the latest PCRE2 source tarball, such as <tt>pcre2-10.39.tar.bz2</tt>, from
|
||||||
<a href=http://www.pcre.org>PCRE</a> and place in the <tt>/usr/src/swig</tt> directory.
|
<a href=http://www.pcre.org>www.pcre.org</a> and place in the <tt>/usr/src/swig</tt> directory.
|
||||||
Build PCRE as a static library using the Tools/pcre-build.sh script as follows:
|
Build PCRE2 as a static library using the Tools/pcre-build.sh script as follows:
|
||||||
|
|
||||||
<div class="shell"><pre>
|
<div class="shell"><pre>
|
||||||
cd /usr/src/swig
|
cd /usr/src/swig
|
||||||
|
|
@ -467,7 +469,7 @@ make
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
<H4><a name="Windows_cygwin">3.3.1.4 Building swig.exe using Cygwin</a></H4>
|
<H3><a name="Windows_cygwin">3.3.4 Building swig.exe using Cygwin</a></H3>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -479,7 +481,7 @@ These files are generated using the <tt>autogen.sh</tt> script and will only nee
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<H3><a name="Windows_examples_cygwin">3.3.2 Running the examples on Windows using Cygwin</a></H3>
|
<H4><a name="Windows_examples_cygwin">3.3.4.1 Running the examples on Windows using Cygwin</a></H4>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,8 @@
|
||||||
|
|
||||||
%include math.i
|
%include math.i
|
||||||
|
|
||||||
extern double drand48();
|
%{
|
||||||
|
/* Add drand48 declaration as it is posix only and is not in stdlib.h when using strict c99 and later */
|
||||||
|
extern double drand48(void);
|
||||||
|
%}
|
||||||
|
extern double drand48(void);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ extern int count(char *bytes, int len, char c);
|
||||||
|
|
||||||
%typemap(argout) (char *str, int len) {
|
%typemap(argout) (char *str, int len) {
|
||||||
SWIG_APPEND_VALUE(scm_from_locale_stringn($1,$2));
|
SWIG_APPEND_VALUE(scm_from_locale_stringn($1,$2));
|
||||||
if ($1) SWIG_free($1);
|
SWIG_free($1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void capitalize(char *str, int len);
|
extern void capitalize(char *str, int len);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Exc {
|
||||||
public:
|
public:
|
||||||
Exc(int c, const char *m) {
|
Exc(int c, const char *m) {
|
||||||
code = c;
|
code = c;
|
||||||
strncpy(msg,m,256);
|
strncpy(msg,m,255);
|
||||||
}
|
}
|
||||||
int code;
|
int code;
|
||||||
char msg[256];
|
char msg[256];
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Exc {
|
||||||
public:
|
public:
|
||||||
Exc(int c, const char *m) {
|
Exc(int c, const char *m) {
|
||||||
code = c;
|
code = c;
|
||||||
strncpy(msg,m,256);
|
strncpy(msg,m,255);
|
||||||
}
|
}
|
||||||
int code;
|
int code;
|
||||||
char msg[256];
|
char msg[256];
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Exc {
|
||||||
public:
|
public:
|
||||||
Exc(int c, const char *m) {
|
Exc(int c, const char *m) {
|
||||||
code = c;
|
code = c;
|
||||||
strncpy(msg,m,256);
|
strncpy(msg,m,255);
|
||||||
}
|
}
|
||||||
int code;
|
int code;
|
||||||
char msg[256];
|
char msg[256];
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ x.B()
|
||||||
print("\nTesting some dynamic casts\n")
|
print("\nTesting some dynamic casts\n")
|
||||||
x = d.toBase()
|
x = d.toBase()
|
||||||
|
|
||||||
y = foo.Foo_fromBase(x)
|
y = foo.Foo.fromBase(x)
|
||||||
print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
|
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"))
|
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"))
|
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"))
|
print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ x.B()
|
||||||
print("\nTesting some dynamic casts\n")
|
print("\nTesting some dynamic casts\n")
|
||||||
x = d.toBase()
|
x = d.toBase()
|
||||||
|
|
||||||
y = foo.intFoo_fromBase(x)
|
y = foo.intFoo.fromBase(x)
|
||||||
print(" Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
|
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"))
|
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"))
|
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"))
|
print(" Foo -> Spam : {} swig".format("bad" if y else "good"))
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ below.
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define OTHERLAND_MSG "Little message from the safe world."
|
#define OTHERLAND_MSG "Little message from the safe world."
|
||||||
#define CPLUSPLUS_MSG "A message from the deep dark world of C++, where anything is possible."
|
#define CPLUSPLUS_MSG "A message from the deep dark world of C++, where anything is possible."
|
||||||
|
|
@ -150,11 +151,11 @@ const char global_const_char_array2[sizeof(CPLUSPLUS_MSG)+1] = CPLUSPLUS_MSG;
|
||||||
%inline {
|
%inline {
|
||||||
struct Formatpos;
|
struct Formatpos;
|
||||||
struct OBFormat;
|
struct OBFormat;
|
||||||
|
|
||||||
static int GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat) {
|
static int GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
Examples/test-suite/class_case.i
Normal file
18
Examples/test-suite/class_case.i
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
%module class_case
|
||||||
|
|
||||||
|
// Regression test for SWIG/Go bug #676
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class ClassA {};
|
||||||
|
|
||||||
|
class classB {};
|
||||||
|
class classB2 : public classB {};
|
||||||
|
|
||||||
|
int Test1(ClassA* a) { return 1; }
|
||||||
|
int Test1(int i) { return 0; }
|
||||||
|
|
||||||
|
int Test2(classB* a) { return 1; }
|
||||||
|
int Test2(int i) { return 0; }
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -134,6 +134,7 @@ CPP_TEST_CASES += \
|
||||||
char_binary \
|
char_binary \
|
||||||
char_strings \
|
char_strings \
|
||||||
chartest \
|
chartest \
|
||||||
|
class_case \
|
||||||
class_scope_namespace \
|
class_scope_namespace \
|
||||||
class_forward \
|
class_forward \
|
||||||
class_ignore \
|
class_ignore \
|
||||||
|
|
@ -141,6 +142,7 @@ CPP_TEST_CASES += \
|
||||||
compactdefaultargs \
|
compactdefaultargs \
|
||||||
const_const_2 \
|
const_const_2 \
|
||||||
constant_directive \
|
constant_directive \
|
||||||
|
constant_expr \
|
||||||
constant_pointers \
|
constant_pointers \
|
||||||
constover \
|
constover \
|
||||||
constructor_copy \
|
constructor_copy \
|
||||||
|
|
@ -313,6 +315,7 @@ CPP_TEST_CASES += \
|
||||||
namespace_forward_declaration \
|
namespace_forward_declaration \
|
||||||
namespace_nested \
|
namespace_nested \
|
||||||
namespace_spaces \
|
namespace_spaces \
|
||||||
|
namespace_struct \
|
||||||
namespace_template \
|
namespace_template \
|
||||||
namespace_typedef_class \
|
namespace_typedef_class \
|
||||||
namespace_typemap \
|
namespace_typemap \
|
||||||
|
|
@ -547,6 +550,7 @@ CPP_TEST_CASES += \
|
||||||
using_directive_and_declaration_forward \
|
using_directive_and_declaration_forward \
|
||||||
using_extend \
|
using_extend \
|
||||||
using_inherit \
|
using_inherit \
|
||||||
|
using_member \
|
||||||
using_namespace \
|
using_namespace \
|
||||||
using_namespace_loop \
|
using_namespace_loop \
|
||||||
using_pointers \
|
using_pointers \
|
||||||
|
|
@ -689,7 +693,7 @@ C_TEST_CASES += \
|
||||||
c_delete_function \
|
c_delete_function \
|
||||||
char_constant \
|
char_constant \
|
||||||
const_const \
|
const_const \
|
||||||
constant_expr \
|
constant_expr_c \
|
||||||
default_args_c \
|
default_args_c \
|
||||||
empty_c \
|
empty_c \
|
||||||
enums \
|
enums \
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,17 @@
|
||||||
%module constant_expr;
|
%module constant_expr;
|
||||||
/* Tests of constant expressions. */
|
/* Tests of constant expressions (C++ version). */
|
||||||
|
|
||||||
|
%include "constant_expr_c.i"
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
/* % didn't work in SWIG 1.3.40 and earlier. */
|
// Testcase from https://sourceforge.net/p/swig/bugs/1139/
|
||||||
const int X = 123%7;
|
template<typename Tp>
|
||||||
#define FOO 12 % 9
|
struct SizeInfo {
|
||||||
double d_array[12 % 9];
|
enum {
|
||||||
|
isLarge = (sizeof(Tp)>sizeof(void*)),
|
||||||
|
isPointer = false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
56
Examples/test-suite/constant_expr_c.i
Normal file
56
Examples/test-suite/constant_expr_c.i
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
%module constant_expr_c;
|
||||||
|
/* Tests of constant expressions (C version). */
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
/* % didn't work in SWIG 1.3.40 and earlier. */
|
||||||
|
const int X = 123%7;
|
||||||
|
#define FOO 12 % 9
|
||||||
|
double d_array[12 % 9];
|
||||||
|
|
||||||
|
/* `<` and `>` in constant expressions caused parse errors before SWIG 4.1.0.
|
||||||
|
* They're now supported if inside parentheses (and with some restrictions
|
||||||
|
* on the LHS of `<`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Testcase from https://github.com/swig/swig/issues/635
|
||||||
|
#define TEST_A 1
|
||||||
|
#define TEST_B 2
|
||||||
|
#define TEST_C (TEST_A < TEST_B)
|
||||||
|
#define TEST_D (TEST_A > TEST_B)
|
||||||
|
// These have been supported since 1.3.41.
|
||||||
|
#define TEST_E (TEST_A <= TEST_B)
|
||||||
|
#define TEST_F (TEST_A >= TEST_B)
|
||||||
|
// For completeness
|
||||||
|
#define TEST_G (TEST_A == TEST_B)
|
||||||
|
#define TEST_H (TEST_A != TEST_B)
|
||||||
|
|
||||||
|
// No warning
|
||||||
|
#if (TEST_A < TEST_B)
|
||||||
|
#define TEST_I 1
|
||||||
|
#else
|
||||||
|
#define TEST_I 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* sizeof didn't work on an expression before SWIG 4.1.0 except for cases where
|
||||||
|
* the expression was in parentheses and looked syntactically like a type (so
|
||||||
|
* sizeof(X) worked because X could be a type syntactically).
|
||||||
|
*/
|
||||||
|
const int s1a = sizeof(X); /* worked before 4.1.0 */
|
||||||
|
//const int s1b = sizeof X; /* not currently supported */
|
||||||
|
const int s2a = sizeof("a string" );
|
||||||
|
const int s2b = sizeof "a string";
|
||||||
|
const int s3a = sizeof('c');
|
||||||
|
const int s3b = sizeof('c');
|
||||||
|
const int s4a = sizeof(L"a wstring");
|
||||||
|
const int s4b = sizeof L"a wstring";
|
||||||
|
const int s5a = sizeof(L'C');
|
||||||
|
const int s5b = sizeof L'C';
|
||||||
|
const int s6a = sizeof(sizeof(X));
|
||||||
|
const int s6b = sizeof sizeof(X);
|
||||||
|
const int s7a = sizeof(3.14);
|
||||||
|
const int s7b = sizeof 3.14;
|
||||||
|
const int s8a = sizeof(2.1e-6);
|
||||||
|
const int s8b = sizeof 2.1e-6;
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
%module cpp11_alternate_function_syntax
|
%module cpp11_alternate_function_syntax
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
struct Hello {};
|
||||||
|
|
||||||
struct SomeStruct {
|
struct SomeStruct {
|
||||||
int addNormal(int x, int y);
|
int addNormal(int x, int y);
|
||||||
auto addAlternate(int x, int y) -> int;
|
auto addAlternate(int x, int y) -> int;
|
||||||
|
|
@ -12,6 +14,9 @@ struct SomeStruct {
|
||||||
auto addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int;
|
auto addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int)) -> int;
|
||||||
auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
|
auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
|
||||||
|
|
||||||
|
// Returning a reference didn't parse in SWIG < 4.1.0 (#231)
|
||||||
|
auto output() -> Hello&;
|
||||||
|
|
||||||
virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
|
virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
|
||||||
virtual ~SomeStruct() = default;
|
virtual ~SomeStruct() = default;
|
||||||
};
|
};
|
||||||
|
|
@ -27,5 +32,6 @@ auto SomeStruct::addAlternateMemberPtrParm(int x, int (SomeStruct::*mp)(int, int
|
||||||
auto SomeStruct::addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int {
|
auto SomeStruct::addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int {
|
||||||
return 1000*x + (this->*mp)(x, x);
|
return 1000*x + (this->*mp)(x, x);
|
||||||
}
|
}
|
||||||
|
auto SomeStruct::output() -> Hello& { static Hello h; return h; }
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -53,3 +53,12 @@ int Array300[ConstExpressions::LLL];
|
||||||
//int Array400[ConstExpressions::MMM()];
|
//int Array400[ConstExpressions::MMM()];
|
||||||
//int Array500[ConstExpressions::NNN()];
|
//int Array500[ConstExpressions::NNN()];
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
// Test handling of ID PERIOD ID in constant expressions (supported since 4.1.0).
|
||||||
|
struct A {
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
constexpr A a{42};
|
||||||
|
constexpr int N = a.i;
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ struct FinalOverrideMethods {
|
||||||
virtual void override(int) {}
|
virtual void override(int) {}
|
||||||
virtual ~FinalOverrideMethods() = default;
|
virtual ~FinalOverrideMethods() = default;
|
||||||
};
|
};
|
||||||
struct FinalOverrideVariables {
|
struct FinalOverrideVars {
|
||||||
int final;
|
int final;
|
||||||
double override;
|
double override;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@
|
||||||
%include <std_wstring.i>
|
%include <std_wstring.i>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SWIGLUA)
|
||||||
|
// Lua uses a parameter called L in every wrapper function
|
||||||
|
%ignore L;
|
||||||
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
||||||
|
|
@ -24,19 +24,19 @@ void takeit3(Thing const*&& t) {}
|
||||||
void takeit4(Thing *const&& t) {}
|
void takeit4(Thing *const&& t) {}
|
||||||
void takeit5(Thing const*const&& t) {}
|
void takeit5(Thing const*const&& t) {}
|
||||||
|
|
||||||
struct Containing {
|
struct Contain {
|
||||||
Thing && member_rvalue_ref;
|
Thing && m_ref;
|
||||||
Thing *&& member_rvalue_ref_ptr1;
|
Thing *&& m_ref_ptr1;
|
||||||
Thing const*&& member_rvalue_ref_ptr2;
|
Thing const*&& m_ref_ptr2;
|
||||||
Thing *const&& member_rvalue_ref_ptr3;
|
Thing *const&& m_ref_ptr3;
|
||||||
Thing const*const &&member_rvalue_ref_ptr4;
|
Thing const*const &&m_ref_ptr4;
|
||||||
|
|
||||||
Containing(Thing&&r, Thing*&& r1, Thing const*&& r2, Thing *const&& r3, Thing const*const && r4) :
|
Contain(Thing&&r, Thing*&& r1, Thing const*&& r2, Thing *const&& r3, Thing const*const && r4) :
|
||||||
member_rvalue_ref(std::move(r)),
|
m_ref(std::move(r)),
|
||||||
member_rvalue_ref_ptr1(std::move(r1)),
|
m_ref_ptr1(std::move(r1)),
|
||||||
member_rvalue_ref_ptr2(std::move(r2)),
|
m_ref_ptr2(std::move(r2)),
|
||||||
member_rvalue_ref_ptr3(std::move(r3)),
|
m_ref_ptr3(std::move(r3)),
|
||||||
member_rvalue_ref_ptr4(std::move(r4))
|
m_ref_ptr4(std::move(r4))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
@ -61,19 +61,19 @@ void int_takeit3(int const*&& t) {}
|
||||||
void int_takeit4(int *const&& t) {}
|
void int_takeit4(int *const&& t) {}
|
||||||
void int_takeit5(int const*const&& t) {}
|
void int_takeit5(int const*const&& t) {}
|
||||||
|
|
||||||
struct IntContaining {
|
struct IContain {
|
||||||
int && member_rvalue_ref;
|
int && m_ref;
|
||||||
int *&& member_rvalue_ref_ptr1;
|
int *&& m_ref_ptr1;
|
||||||
int const*&& member_rvalue_ref_ptr2;
|
int const*&& m_ref_ptr2;
|
||||||
int *const&& member_rvalue_ref_ptr3;
|
int *const&& m_ref_ptr3;
|
||||||
int const*const &&member_rvalue_ref_ptr4;
|
int const*const &&m_ref_ptr4;
|
||||||
|
|
||||||
IntContaining(int&& r, int*&& r1, int const*&& r2, int *const&& r3, int const*const && r4) :
|
IContain(int&& r, int*&& r1, int const*&& r2, int *const&& r3, int const*const && r4) :
|
||||||
member_rvalue_ref(std::move(r)),
|
m_ref(std::move(r)),
|
||||||
member_rvalue_ref_ptr1(std::move(r1)),
|
m_ref_ptr1(std::move(r1)),
|
||||||
member_rvalue_ref_ptr2(std::move(r2)),
|
m_ref_ptr2(std::move(r2)),
|
||||||
member_rvalue_ref_ptr3(std::move(r3)),
|
m_ref_ptr3(std::move(r3)),
|
||||||
member_rvalue_ref_ptr4(std::move(r4))
|
m_ref_ptr4(std::move(r4))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
%module cpp11_std_array
|
%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>
|
#include <array>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* This interface checks whether SWIG supports the new double angled brackets
|
/* This interface checks whether SWIG supports the new double angled brackets
|
||||||
in the template syntax without having a space inbetween. This feature was
|
in the template syntax without having a space in between. This feature was
|
||||||
introduced in new C++11 standard.
|
introduced in new C++11 standard.
|
||||||
*/
|
*/
|
||||||
%module cpp11_template_double_brackets
|
%module cpp11_template_double_brackets
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@
|
||||||
*/
|
*/
|
||||||
%module cpp11_template_explicit
|
%module cpp11_template_explicit
|
||||||
|
|
||||||
|
/* Suppress SWIG warnings related to explicit template instantiation and extern templates */
|
||||||
#pragma SWIG nowarn=SWIGWARN_PARSE_EXPLICIT_TEMPLATE
|
#pragma SWIG nowarn=SWIGWARN_PARSE_EXPLICIT_TEMPLATE
|
||||||
|
#pragma SWIG nowarn=SWIGWARN_PARSE_EXTERN_TEMPLATE
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
|
|
@ -33,6 +35,30 @@ extern template class Temper<B*>;
|
||||||
|
|
||||||
template class Temper<int>;
|
template class Temper<int>;
|
||||||
extern template class Temper<short>;
|
extern template class Temper<short>;
|
||||||
|
|
||||||
|
/* Templated function to check support for extern template functions */
|
||||||
|
template <typename T>
|
||||||
|
T my_templated_function(int a, double b)
|
||||||
|
{
|
||||||
|
return T();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Explicit extern function template instantiation with simple type */
|
||||||
|
extern template int my_templated_function<int>(int, double);
|
||||||
|
template int my_templated_function<int>(int, double);
|
||||||
|
|
||||||
|
/* Explicit extern function template instantiation with more complex types */
|
||||||
|
extern template A my_templated_function<A>(int, double);
|
||||||
|
template A my_templated_function<A>(int, double);
|
||||||
|
|
||||||
|
extern template Temper<int> my_templated_function<Temper<int>>(int, double);
|
||||||
|
template Temper<int> my_templated_function<Temper<int>>(int, double);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%template(TemperInt) Temper<int>;
|
%template(TemperInt) Temper<int>;
|
||||||
|
|
||||||
|
/* Enable several versions of the templated function */
|
||||||
|
%template(my_templated_function_int ) my_templated_function<int>;
|
||||||
|
%template(my_templated_function_A ) my_templated_function<A>;
|
||||||
|
%template(my_templated_function_TemperInt) my_templated_function<Temper<int>>;
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,14 @@ using IntArray = Int[];
|
||||||
|
|
||||||
// Test that SWIG understands these new types
|
// Test that SWIG understands these new types
|
||||||
|
|
||||||
|
%{
|
||||||
|
Int mult2(Int x) { return x * 2; }
|
||||||
|
%}
|
||||||
%callback("%s_cb");
|
%callback("%s_cb");
|
||||||
Int mult2(Int x);
|
Int mult2(Int x);
|
||||||
%nocallback;
|
%nocallback;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
Int mult2(Int x) { return x * 2; }
|
|
||||||
IntPtr allocate_int() { return new Int(12); }
|
IntPtr allocate_int() { return new Int(12); }
|
||||||
void free_int(int* ptr) { delete ptr; }
|
void free_int(int* ptr) { delete ptr; }
|
||||||
void inplace_mult2(IntRef x) { x *= 2; }
|
void inplace_mult2(IntRef x) { x *= 2; }
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ public class CSharpDerived : Base
|
||||||
// Note the following method can never be called from unmanaged code.
|
// Note the following method can never be called from unmanaged code.
|
||||||
// It is here only for code that calls it directly from managed code.
|
// It is here only for code that calls it directly from managed code.
|
||||||
// But should always be defined to ensure behaviour is consistent
|
// But should always be defined to ensure behaviour is consistent
|
||||||
// independent of where DefaultParsms is called from (managed or unmanaged code).
|
// independent of where DefaultParams is called from (managed or unmanaged code).
|
||||||
// Note this method can never be called from unmanaged code
|
// Note this method can never be called from unmanaged code
|
||||||
public override String DefaultParms(int x)
|
public override String DefaultParms(int x)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ public class runme {
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_MINUS.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_LSHIFT.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_RSHIFT.GetType() );
|
||||||
|
assert( typeof(int) == preproc_constants_c.EXPR_LT.GetType() );
|
||||||
|
assert( typeof(int) == preproc_constants_c.EXPR_GT.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_LTE.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_GTE.GetType() );
|
||||||
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
|
assert( typeof(int) == preproc_constants_c.EXPR_INEQUALITY.GetType() );
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ public class runme {
|
||||||
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_MINUS.GetType() );
|
||||||
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_LSHIFT.GetType() );
|
||||||
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
|
assert( typeof(int) == preproc_constants.EXPR_RSHIFT.GetType() );
|
||||||
|
assert( typeof(bool) == preproc_constants.EXPR_LT.GetType() );
|
||||||
|
assert( typeof(bool) == preproc_constants.EXPR_GT.GetType() );
|
||||||
assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
|
assert( typeof(bool) == preproc_constants.EXPR_LTE.GetType() );
|
||||||
assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
|
assert( typeof(bool) == preproc_constants.EXPR_GTE.GetType() );
|
||||||
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
|
assert( typeof(bool) == preproc_constants.EXPR_INEQUALITY.GetType() );
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void main() {
|
||||||
enforce(countUntil(vector[], i * 10) == i, "indexOf test failed, i: " ~ to!string(i));
|
enforce(countUntil(vector[], i * 10) == i, "indexOf test failed, i: " ~ to!string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
enforce(countUntil(vector[], 42) == -1, "non-existant item indexOf test failed");
|
enforce(countUntil(vector[], 42) == -1, "non-existent item indexOf test failed");
|
||||||
|
|
||||||
vector.clear();
|
vector.clear();
|
||||||
enforce(vector.length == 0, "clear test failed");
|
enforce(vector.length == 0, "clear test failed");
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ void main() {
|
||||||
static assert(is(int == typeof(EXPR_MINUS())));
|
static assert(is(int == typeof(EXPR_MINUS())));
|
||||||
static assert(is(int == typeof(EXPR_LSHIFT())));
|
static assert(is(int == typeof(EXPR_LSHIFT())));
|
||||||
static assert(is(int == typeof(EXPR_RSHIFT())));
|
static assert(is(int == typeof(EXPR_RSHIFT())));
|
||||||
|
static assert(is(int == typeof(EXPR_LT())));
|
||||||
|
static assert(is(int == typeof(EXPR_GT())));
|
||||||
static assert(is(int == typeof(EXPR_LTE())));
|
static assert(is(int == typeof(EXPR_LTE())));
|
||||||
static assert(is(int == typeof(EXPR_GTE())));
|
static assert(is(int == typeof(EXPR_GTE())));
|
||||||
static assert(is(int == typeof(EXPR_INEQUALITY())));
|
static assert(is(int == typeof(EXPR_INEQUALITY())));
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ void main() {
|
||||||
static assert(is(int == typeof(EXPR_MINUS())));
|
static assert(is(int == typeof(EXPR_MINUS())));
|
||||||
static assert(is(int == typeof(EXPR_LSHIFT())));
|
static assert(is(int == typeof(EXPR_LSHIFT())));
|
||||||
static assert(is(int == typeof(EXPR_RSHIFT())));
|
static assert(is(int == typeof(EXPR_RSHIFT())));
|
||||||
|
static assert(is(int == typeof(EXPR_LT())));
|
||||||
|
static assert(is(int == typeof(EXPR_GT())));
|
||||||
static assert(is(int == typeof(EXPR_LTE())));
|
static assert(is(int == typeof(EXPR_LTE())));
|
||||||
static assert(is(int == typeof(EXPR_GTE())));
|
static assert(is(int == typeof(EXPR_GTE())));
|
||||||
static assert(is(int == typeof(EXPR_INEQUALITY())));
|
static assert(is(int == typeof(EXPR_INEQUALITY())));
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ void main() {
|
||||||
static assert(is(int == typeof(EXPR_MINUS())));
|
static assert(is(int == typeof(EXPR_MINUS())));
|
||||||
static assert(is(int == typeof(EXPR_LSHIFT())));
|
static assert(is(int == typeof(EXPR_LSHIFT())));
|
||||||
static assert(is(int == typeof(EXPR_RSHIFT())));
|
static assert(is(int == typeof(EXPR_RSHIFT())));
|
||||||
|
static assert(is(int == typeof(EXPR_LT())));
|
||||||
|
static assert(is(int == typeof(EXPR_GT())));
|
||||||
static assert(is(bool == typeof(EXPR_LTE())));
|
static assert(is(bool == typeof(EXPR_LTE())));
|
||||||
static assert(is(bool == typeof(EXPR_GTE())));
|
static assert(is(bool == typeof(EXPR_GTE())));
|
||||||
static assert(is(bool == typeof(EXPR_INEQUALITY())));
|
static assert(is(bool == typeof(EXPR_INEQUALITY())));
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ void main() {
|
||||||
static assert(is(int == typeof(EXPR_MINUS())));
|
static assert(is(int == typeof(EXPR_MINUS())));
|
||||||
static assert(is(int == typeof(EXPR_LSHIFT())));
|
static assert(is(int == typeof(EXPR_LSHIFT())));
|
||||||
static assert(is(int == typeof(EXPR_RSHIFT())));
|
static assert(is(int == typeof(EXPR_RSHIFT())));
|
||||||
|
static assert(is(bool == typeof(EXPR_LT())));
|
||||||
|
static assert(is(bool == typeof(EXPR_GT())));
|
||||||
static assert(is(bool == typeof(EXPR_LTE())));
|
static assert(is(bool == typeof(EXPR_LTE())));
|
||||||
static assert(is(bool == typeof(EXPR_GTE())));
|
static assert(is(bool == typeof(EXPR_GTE())));
|
||||||
static assert(is(bool == typeof(EXPR_INEQUALITY())));
|
static assert(is(bool == typeof(EXPR_INEQUALITY())));
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
%{
|
%{
|
||||||
#define TESTCASE_THROW1(T1)
|
#define TESTCASE_THROW1(T1)
|
||||||
#define TESTCASE_THROW2(T1, T2)
|
#define TESTCASE_THROW2(T1, T2)
|
||||||
|
#include <string.h>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%include <std_string.i>
|
%include <std_string.i>
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
class EnumClass {
|
class EnumClass {
|
||||||
public:
|
public:
|
||||||
enum speed { FAST, SLOW };
|
enum speed { FAST, SLOW };
|
||||||
// Note: default values should be EnumClass::FAST and SWEET
|
// Note: default values should be EnumClass::FAST and SWEET
|
||||||
bool blah(speed s = FAST, flavor f = SWEET) { return (s == FAST && f == SWEET); };
|
bool blah(speed s = FAST, flavor f = SWEET) { return (s == FAST && f == SWEET); };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -83,16 +84,16 @@
|
||||||
|
|
||||||
// casts
|
// casts
|
||||||
const char * casts1(const char *m = (const char *) NULL) {
|
const char * casts1(const char *m = (const char *) NULL) {
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
if (m) {
|
if (m) {
|
||||||
ret = new char[strlen(m)+1];
|
ret = new char[strlen(m)+1];
|
||||||
strcpy(ret, m);
|
strcpy(ret, m);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
const char * casts2(const char *m = (const char *) "Hello") {
|
const char * casts2(const char *m = (const char *) "Hello") {
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
if (m) {
|
if (m) {
|
||||||
ret = new char[strlen(m)+1];
|
ret = new char[strlen(m)+1];
|
||||||
strcpy(ret, m);
|
strcpy(ret, m);
|
||||||
}
|
}
|
||||||
|
|
@ -108,16 +109,16 @@
|
||||||
char chartest6(char c = '\x43') { return c; } // 'C'
|
char chartest6(char c = '\x43') { return c; } // 'C'
|
||||||
|
|
||||||
// namespaces
|
// namespaces
|
||||||
namespace AType {
|
namespace AType {
|
||||||
enum AType { NoType };
|
enum AType { NoType };
|
||||||
}
|
}
|
||||||
void dummy(AType::AType aType = AType::NoType) {}
|
void dummy(AType::AType aType = AType::NoType) {}
|
||||||
namespace A {
|
namespace A {
|
||||||
namespace B {
|
namespace B {
|
||||||
int CONST_NUM = 10;
|
int CONST_NUM = 10;
|
||||||
}
|
}
|
||||||
int afunction(int i = B::CONST_NUM) { return i; }
|
int afunction(int i = B::CONST_NUM) { return i; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// references
|
// references
|
||||||
int reftest1(const int &x = 42) { return x; }
|
int reftest1(const int &x = 42) { return x; }
|
||||||
|
|
@ -131,7 +132,7 @@
|
||||||
void test(int x = Oak + Fir + Cedar) {}
|
void test(int x = Oak + Fir + Cedar) {}
|
||||||
};
|
};
|
||||||
enum Tree::types chops(enum Tree::types type) { return type; }
|
enum Tree::types chops(enum Tree::types type) { return type; }
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Rename a class member
|
// Rename a class member
|
||||||
|
|
@ -155,11 +156,11 @@
|
||||||
static int spam;
|
static int spam;
|
||||||
|
|
||||||
Foo(){}
|
Foo(){}
|
||||||
|
|
||||||
Foo(int x, int y = 0, int z = 0){}
|
Foo(int x, int y = 0, int z = 0){}
|
||||||
|
|
||||||
void meth(int x, int y = 0, int z = 0){}
|
void meth(int x, int y = 0, int z = 0){}
|
||||||
|
|
||||||
// Use a renamed member as a default argument. SWIG has to resolve
|
// Use a renamed member as a default argument. SWIG has to resolve
|
||||||
// bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
|
// bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
|
||||||
// (Different default parameter wrapping in SWIG-1.3.23 ensures SWIG doesn't have to resolve these symbols).
|
// (Different default parameter wrapping in SWIG-1.3.23 ensures SWIG doesn't have to resolve these symbols).
|
||||||
|
|
@ -189,20 +190,20 @@
|
||||||
// tests valuewrapper
|
// tests valuewrapper
|
||||||
%feature("compactdefaultargs") MyClass2::set;
|
%feature("compactdefaultargs") MyClass2::set;
|
||||||
%inline %{
|
%inline %{
|
||||||
enum MyType { Val1, Val2 };
|
enum MyType { Val1, Val2 };
|
||||||
|
|
||||||
class MyClass1
|
class MyClass1
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyClass1(MyType myType) {}
|
MyClass1(MyType myType) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyClass2
|
class MyClass2
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
void set(MyClass1 cl1 = Val1) {}
|
void set(MyClass1 cl1 = Val1) {}
|
||||||
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
|
// This could have been written : set(MyClass1 cl1 = MyClass1(Val1))
|
||||||
// But it works in C++ since there is a "conversion" constructor in MyClass1.
|
// But it works in C++ since there is a "conversion" constructor in MyClass1.
|
||||||
void set2(MyClass1 cl1 = Val1) {}
|
void set2(MyClass1 cl1 = Val1) {}
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
@ -281,7 +282,7 @@ struct ConstMethods {
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// const methods
|
// const methods
|
||||||
// runtime test needed to check that the const method is called
|
// runtime test needed to check that the const method is called
|
||||||
struct ConstMethods {
|
struct ConstMethods {
|
||||||
int coo(double d = 0.0) const;
|
int coo(double d = 0.0) const;
|
||||||
|
|
@ -305,8 +306,8 @@ struct ConstMethods {
|
||||||
return(x+p);
|
return(x+p);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct Pointf {
|
typedef struct Pointf {
|
||||||
double x,y;
|
double x,y;
|
||||||
} Pointf;
|
} Pointf;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ namespace TopLevel
|
||||||
class FooBar {
|
class FooBar {
|
||||||
public:
|
public:
|
||||||
FooBar() {}
|
FooBar() {}
|
||||||
FooBar(const FooBar&) {}
|
|
||||||
virtual ~FooBar() {}
|
virtual ~FooBar() {}
|
||||||
|
|
||||||
std::string FooBarDo() { return "Bar::Foo2::Foo2Bar()"; }
|
std::string FooBarDo() { return "Bar::Foo2::Foo2Bar()"; }
|
||||||
|
|
@ -56,7 +55,6 @@ namespace TopLevel
|
||||||
class FooBar {
|
class FooBar {
|
||||||
public:
|
public:
|
||||||
FooBar();
|
FooBar();
|
||||||
FooBar(const FooBar&);
|
|
||||||
virtual ~FooBar();
|
virtual ~FooBar();
|
||||||
|
|
||||||
std::string FooBarDo();
|
std::string FooBarDo();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <stdio.h>
|
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
@ -30,6 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "swig_examples_lock.h"
|
#include "swig_examples_lock.h"
|
||||||
|
|
||||||
class Foo;
|
class Foo;
|
||||||
|
|
@ -42,15 +42,15 @@ extern "C" {
|
||||||
static pthread_t thread;
|
static pthread_t thread;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int thread_terminate = 0;
|
static int swig_thread_terminate = 0;
|
||||||
static SwigExamples::CriticalSection critical_section;
|
static SwigExamples::CriticalSection critical_section;
|
||||||
int get_thread_terminate() {
|
int get_thread_terminate() {
|
||||||
SwigExamples::Lock lock(critical_section);
|
SwigExamples::Lock lock(critical_section);
|
||||||
return thread_terminate;
|
return swig_thread_terminate;
|
||||||
}
|
}
|
||||||
void set_thread_terminate(int value) {
|
void set_thread_terminate(int value) {
|
||||||
SwigExamples::Lock lock(critical_section);
|
SwigExamples::Lock lock(critical_section);
|
||||||
thread_terminate = value;
|
swig_thread_terminate = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
%module xxx
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace std {
|
||||||
|
template<typename T> class vector {};
|
||||||
|
}
|
||||||
|
template<typename T> void Func() {}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
// Class template
|
||||||
|
template class std::vector<int>; // C++03 template explicit instantiation definition in C++
|
||||||
|
extern template class std::vector<int>; // C++11 template explicit instantiation declaration (extern template)
|
||||||
|
%}
|
||||||
|
%template(VectorInt) std::vector<int>; // SWIG template instantiation
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
// Function template
|
||||||
|
template void Func<int>(); // C++03 template explicit instantiation definition in C++
|
||||||
|
extern template void Func<int>(); // C++11 template explicit instantiation declaration (extern template)
|
||||||
|
%}
|
||||||
|
%template(FuncInt) Func<int>; // SWIG template instantiation
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
cpp_template_explicit_instantiation.i:12: Warning 320: Explicit template instantiation ignored.
|
||||||
|
cpp_template_explicit_instantiation.i:13: Warning 327: Extern template ignored.
|
||||||
|
cpp_template_explicit_instantiation.i:19: Warning 320: Explicit template instantiation ignored.
|
||||||
|
cpp_template_explicit_instantiation.i:20: Warning 327: Extern template ignored.
|
||||||
6
Examples/test-suite/errors/doxygen_unclosed_tag.i
Normal file
6
Examples/test-suite/errors/doxygen_unclosed_tag.i
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
%module xxx
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a random variate with uniform distribution in the range [a,b), where a<b
|
||||||
|
*/
|
||||||
|
double uniform(double a, double b);
|
||||||
1
Examples/test-suite/errors/doxygen_unclosed_tag.stderr
Normal file
1
Examples/test-suite/errors/doxygen_unclosed_tag.stderr
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
doxygen_unclosed_tag.i:4: Warning 563: Doxygen HTML error for tag b: HTML tag without '>' found.
|
||||||
3
Examples/test-suite/errors/swig_constant_missing_semi.i
Normal file
3
Examples/test-suite/errors/swig_constant_missing_semi.i
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
%module xxx
|
||||||
|
%constant int BAR=0
|
||||||
|
int foo(int);
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
swig_constant_missing_semi.i:3: Warning 305: Bad constant value (ignored).
|
||||||
12
Examples/test-suite/go/class_case_runme.go
Normal file
12
Examples/test-suite/go/class_case_runme.go
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import . "swigtests/class_case"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
b2 := NewClassB2()
|
||||||
|
// This used to fail with:
|
||||||
|
// panic: interface conversion: interface {} is class_case.SwigcptrClassB2, not int
|
||||||
|
if Test2(b2) != 1 {
|
||||||
|
panic("Unexpected overload used")
|
||||||
|
}
|
||||||
|
}
|
||||||
68
Examples/test-suite/go/cpp11_std_array_runme.go
Normal file
68
Examples/test-suite/go/cpp11_std_array_runme.go
Normal file
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -39,15 +39,15 @@
|
||||||
;(check (=~ 15 (Overload-byval2cpr o #nil)))
|
;(check (=~ 15 (Overload-byval2cpr o #nil)))
|
||||||
;(check (=~ 16 (Overload-byval2cpr o x)))
|
;(check (=~ 16 (Overload-byval2cpr o x)))
|
||||||
|
|
||||||
; forward class declaration
|
; fwd class declaration
|
||||||
(check (=~ 17 (Overload-byval1forwardptr o x)))
|
(check (=~ 17 (Overload-byval1fwdptr o x)))
|
||||||
(check (=~ 18 (Overload-byval1forwardptr o #nil)))
|
(check (=~ 18 (Overload-byval1fwdptr o #nil)))
|
||||||
|
|
||||||
(check (=~ 19 (Overload-byval2forwardptr o #nil)))
|
(check (=~ 19 (Overload-byval2fwdptr o #nil)))
|
||||||
(check (=~ 20 (Overload-byval2forwardptr o x)))
|
(check (=~ 20 (Overload-byval2fwdptr o x)))
|
||||||
|
|
||||||
(check (=~ 21 (Overload-byval1forwardref o x)))
|
(check (=~ 21 (Overload-byval1fwdref o x)))
|
||||||
|
|
||||||
(check (=~ 22 (Overload-byval2forwardref o x)))
|
(check (=~ 22 (Overload-byval2fwdref o x)))
|
||||||
|
|
||||||
(exit 0)
|
(exit 0)
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ class JavaDerived extends Base
|
||||||
// Note the following method can never be called from unmanaged code.
|
// Note the following method can never be called from unmanaged code.
|
||||||
// It is here only for code that calls it directly from managed code.
|
// It is here only for code that calls it directly from managed code.
|
||||||
// But should always be defined to ensure behaviour is consistent
|
// But should always be defined to ensure behaviour is consistent
|
||||||
// independent of where DefaultParsms is called from (managed or unmanaged code).
|
// independent of where DefaultParams is called from (managed or unmanaged code).
|
||||||
// Note this method can never be called from unmanaged code
|
// Note this method can never be called from unmanaged code
|
||||||
public String DefaultParms(int x)
|
public String DefaultParms(int x)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ srcdir = @srcdir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
|
|
||||||
C_TEST_CASES += \
|
|
||||||
ccomplextest \
|
|
||||||
|
|
||||||
CPP_TEST_CASES += \
|
CPP_TEST_CASES += \
|
||||||
javascript_lib_arrays \
|
javascript_lib_arrays \
|
||||||
|
|
||||||
|
|
@ -57,8 +54,10 @@ ifeq (node,$(JSENGINE))
|
||||||
# dunno... ignoring generously
|
# dunno... ignoring generously
|
||||||
apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
|
cpp11_ref_qualifiers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
director_basic.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
director_basic.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
|
member_funcptr_galore.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
|
||||||
|
|
||||||
setup_node = \
|
setup_node = \
|
||||||
test -d $* || mkdir $* && \
|
test -d $* || mkdir $* && \
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,13 @@ check(13, o.byval1cpr(x));
|
||||||
// check(15, o.byval2cpr(null));
|
// check(15, o.byval2cpr(null));
|
||||||
check(16, o.byval2cpr(x));
|
check(16, o.byval2cpr(x));
|
||||||
|
|
||||||
// forward class declaration
|
// fwd class declaration
|
||||||
check(17, o.byval1forwardptr(x));
|
check(17, o.byval1fwdptr(x));
|
||||||
// check(18, o.byval1forwardptr(null));
|
// check(18, o.byval1fwdptr(null));
|
||||||
|
|
||||||
// check(19, o.byval2forwardptr(null));
|
// check(19, o.byval2fwdptr(null));
|
||||||
check(20, o.byval2forwardptr(x));
|
check(20, o.byval2fwdptr(x));
|
||||||
|
|
||||||
check(21, o.byval1forwardref(x));
|
check(21, o.byval1fwdref(x));
|
||||||
|
|
||||||
check(22, o.byval2forwardref(x));
|
check(22, o.byval2fwdref(x));
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
virtual int foo(int a = 1, int b = 0) {return a + b; }
|
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(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)
|
static Foo *create(int a = 1, int b = 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,8 @@
|
||||||
%cdata(int);
|
%cdata(int);
|
||||||
%cdata(double);
|
%cdata(double);
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdlib.h>
|
||||||
|
%}
|
||||||
|
|
||||||
void *malloc(size_t size);
|
void *malloc(size_t size);
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,8 @@
|
||||||
%cdata(int);
|
%cdata(int);
|
||||||
%cdata(double);
|
%cdata(double);
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdlib.h>
|
||||||
|
%}
|
||||||
|
|
||||||
void *malloc(size_t size);
|
void *malloc(size_t size);
|
||||||
|
|
|
||||||
|
|
@ -16,34 +16,33 @@
|
||||||
struct Geometry {
|
struct Geometry {
|
||||||
enum GeomType{
|
enum GeomType{
|
||||||
POINT,
|
POINT,
|
||||||
CIRCLE
|
CIRCLE,
|
||||||
|
SHAPELESS
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~Geometry() {}
|
virtual ~Geometry() {}
|
||||||
virtual int draw() = 0;
|
virtual int draw() = 0;
|
||||||
static Geometry *create(GeomType i);
|
static Geometry *create(GeomType i);
|
||||||
virtual Geometry *clone() = 0;
|
virtual Geometry *clone() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Point : Geometry {
|
struct Point : Geometry {
|
||||||
int draw() { return 1; }
|
int draw() { return 1; }
|
||||||
double width() { return 1.0; }
|
double width() { return 1.0; }
|
||||||
Geometry *clone() { return new Point(); }
|
Geometry *clone() { return new Point(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Circle : Geometry {
|
struct Circle : Geometry {
|
||||||
int draw() { return 2; }
|
int draw() { return 2; }
|
||||||
double radius() { return 1.5; }
|
double radius() { return 1.5; }
|
||||||
Geometry *clone() { return new Circle(); }
|
Geometry *clone() { return new Circle(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
Geometry *Geometry::create(GeomType type) {
|
Geometry *Geometry::create(GeomType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case POINT: return new Point();
|
case POINT: return new Point();
|
||||||
case CIRCLE: return new Circle();
|
case CIRCLE: return new Circle();
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <typeinfo>
|
||||||
struct E1 : public std::exception
|
struct E1 : public std::exception
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -140,3 +140,13 @@ std::vector<std::string> RevStringVec (const std::vector<std::string> &In)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// regression test for Tcl typecheck bug with empty list fixed in 4.2.0
|
||||||
|
%inline %{
|
||||||
|
int sum(const std::vector<int> &v) {
|
||||||
|
return std::accumulate(v.begin(),v.end(),0);
|
||||||
|
}
|
||||||
|
int sum(int v) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ assert(14 == o:byval1cpr(nil))
|
||||||
assert(15 == o:byval2cpr(nil))
|
assert(15 == o:byval2cpr(nil))
|
||||||
assert(16 == o:byval2cpr(x))
|
assert(16 == o:byval2cpr(x))
|
||||||
|
|
||||||
-- forward class declaration
|
-- fwd class declaration
|
||||||
assert(17 == o:byval1forwardptr(x))
|
assert(17 == o:byval1fwdptr(x))
|
||||||
assert(18 == o:byval1forwardptr(nil))
|
assert(18 == o:byval1fwdptr(nil))
|
||||||
|
|
||||||
assert(19 == o:byval2forwardptr(nil))
|
assert(19 == o:byval2fwdptr(nil))
|
||||||
assert(20 == o:byval2forwardptr(x))
|
assert(20 == o:byval2fwdptr(x))
|
||||||
|
|
||||||
assert(21 == o:byval1forwardref(x))
|
assert(21 == o:byval1fwdref(x))
|
||||||
|
|
||||||
assert(22 == o:byval2forwardref(x))
|
assert(22 == o:byval2fwdref(x))
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ struct ExtendMe {
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string.h>
|
||||||
std::map<ExtendMe*, char *> ExtendMeStringMap;
|
std::map<ExtendMe*, char *> ExtendMeStringMap;
|
||||||
void ExtendMe_thing_set(ExtendMe *self, const char *val) {
|
void ExtendMe_thing_set(ExtendMe *self, const char *val) {
|
||||||
char *old_val = ExtendMeStringMap[self];
|
char *old_val = ExtendMeStringMap[self];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class C;
|
class C;
|
||||||
|
|
||||||
|
|
|
||||||
8
Examples/test-suite/namespace_struct.i
Normal file
8
Examples/test-suite/namespace_struct.i
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
%module namespace_struct
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
// SWIG/R generated bad code for copyToR for a struct in a namespace in SWIG < 4.1.0
|
||||||
|
namespace X { struct Y { int x, y; }; }
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
%module namespace_typemap
|
%module namespace_typemap
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
#include <string.h>
|
||||||
namespace test {
|
namespace test {
|
||||||
/* A minimalistic string class */
|
/* A minimalistic string class */
|
||||||
class string_class {
|
class string_class {
|
||||||
|
|
@ -15,7 +16,7 @@ namespace test {
|
||||||
strcpy(data,s);
|
strcpy(data,s);
|
||||||
}
|
}
|
||||||
~string_class() {
|
~string_class() {
|
||||||
if (data) delete [] data;
|
delete [] data;
|
||||||
}
|
}
|
||||||
char *c_str() {
|
char *c_str() {
|
||||||
return data;
|
return data;
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ struct Outer {
|
||||||
Integer xx;
|
Integer xx;
|
||||||
} MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
|
} 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 */
|
/* some compilers do not accept these */
|
||||||
struct : public InnerMultiple {
|
struct : public InnerMultiple {
|
||||||
Integer xx;
|
Integer xx;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include "stdlib.h"
|
||||||
|
%}
|
||||||
|
|
||||||
#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
|
#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8)
|
||||||
%extend hiA {
|
%extend hiA {
|
||||||
hiA() {
|
hiA() {
|
||||||
|
|
|
||||||
|
|
@ -40,13 +40,13 @@ check(14, o.byval1cpr(null));
|
||||||
check(15, o.byval2cpr(null));
|
check(15, o.byval2cpr(null));
|
||||||
check(16, o.byval2cpr(x));
|
check(16, o.byval2cpr(x));
|
||||||
|
|
||||||
# forward class declaration
|
# fwd class declaration
|
||||||
check(17, o.byval1forwardptr(x));
|
check(17, o.byval1fwdptr(x));
|
||||||
check(18, o.byval1forwardptr(null));
|
check(18, o.byval1fwdptr(null));
|
||||||
|
|
||||||
check(19, o.byval2forwardptr(null));
|
check(19, o.byval2fwdptr(null));
|
||||||
check(20, o.byval2forwardptr(x));
|
check(20, o.byval2fwdptr(x));
|
||||||
|
|
||||||
check(21, o.byval1forwardref(x));
|
check(21, o.byval1fwdref(x));
|
||||||
|
|
||||||
check(22, o.byval2forwardref(x));
|
check(22, o.byval2fwdref(x));
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <stdlib.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
|
#pragma warning(disable: 4996) // 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
|
||||||
#endif
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%rename(AsCharStarRef) operator char*&;
|
%rename(AsCharStarRef) operator char*&;
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,18 @@ struct Overload {
|
||||||
int byval2cpr(Y*const& y) { return 15; }
|
int byval2cpr(Y*const& y) { return 15; }
|
||||||
int byval2cpr(X x) { return 16; }
|
int byval2cpr(X x) { return 16; }
|
||||||
|
|
||||||
// forward class declaration
|
// fwd class declaration
|
||||||
int byval1forwardptr(X x) { return 17; }
|
int byval1fwdptr(X x) { return 17; }
|
||||||
int byval1forwardptr(F* f) { return 18; }
|
int byval1fwdptr(F* f) { return 18; }
|
||||||
|
|
||||||
int byval2forwardptr(F* f) { return 19; }
|
int byval2fwdptr(F* f) { return 19; }
|
||||||
int byval2forwardptr(X x) { return 20; }
|
int byval2fwdptr(X x) { return 20; }
|
||||||
|
|
||||||
int byval1forwardref(X x) { return 21; }
|
int byval1fwdref(X x) { return 21; }
|
||||||
int byval1forwardref(F& f) { return -21; }
|
int byval1fwdref(F& f) { return -21; }
|
||||||
|
|
||||||
int byval2forwardref(F& f) { return -22; }
|
int byval2fwdref(F& f) { return -22; }
|
||||||
int byval2forwardref(X x) { return 22; }
|
int byval2fwdref(X x) { return 22; }
|
||||||
|
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,6 @@ use Test::More tests => 9;
|
||||||
|
|
||||||
use operator_overload_break;
|
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");
|
pass("loaded");
|
||||||
|
|
||||||
my $op = operator_overload_break::Op->new(5);
|
my $op = operator_overload_break::Op->new(5);
|
||||||
|
|
@ -32,7 +23,7 @@ $op->{k} = 22;
|
||||||
ok((10 == (32 - $op)),
|
ok((10 == (32 - $op)),
|
||||||
"reversed subtraction");
|
"reversed subtraction");
|
||||||
|
|
||||||
ok_not((3 == $op),
|
ok(not(3 == $op),
|
||||||
'not equal');
|
'not equal');
|
||||||
|
|
||||||
$op->{k} = 3;
|
$op->{k} = 3;
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,6 @@ use Test::More tests => 39;
|
||||||
|
|
||||||
use operator_overload;
|
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");
|
pass("loaded");
|
||||||
|
|
||||||
# first check all the operators are implemented correctly from pure C++ code
|
# 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;
|
$op->{i} = 5;
|
||||||
$op2->{i} = 3;
|
$op2->{i} = 3;
|
||||||
|
|
||||||
ok_not(($op == $op2), "operator equal: not equal");
|
ok(not($op == $op2), "operator equal: not equal");
|
||||||
|
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
ok(($op == $op2), "operator equal: equal");
|
ok(($op == $op2), "operator equal: equal");
|
||||||
|
|
@ -42,7 +33,7 @@ $op2->{i} = 3;
|
||||||
ok(($op != $op2), "operator not equal: not equal");
|
ok(($op != $op2), "operator not equal: not equal");
|
||||||
|
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
ok_not(($op != $op2), "operator not equal: equal");
|
ok(not($op != $op2), "operator not equal: equal");
|
||||||
|
|
||||||
# stringify operator
|
# stringify operator
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
|
|
@ -99,16 +90,16 @@ is($op3->{i}, 2, "operator modulus");
|
||||||
$op->{i} = 8;
|
$op->{i} = 8;
|
||||||
$op2->{i} = 3;
|
$op2->{i} = 3;
|
||||||
ok($op > $op2, "operator greater than");
|
ok($op > $op2, "operator greater than");
|
||||||
ok_not(($op2 > $op), "operator greater than");
|
ok(not($op2 > $op), "operator greater than");
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
ok_not(($op2 > $op), "operator greater than");
|
ok(not($op2 > $op), "operator greater than");
|
||||||
ok_not(($op > $op2), "operator greater than");
|
ok(not($op > $op2), "operator greater than");
|
||||||
|
|
||||||
# greater than or equal operator
|
# greater than or equal operator
|
||||||
$op->{i} = 8;
|
$op->{i} = 8;
|
||||||
$op2->{i} = 3;
|
$op2->{i} = 3;
|
||||||
ok($op >= $op2, "operator greater than or equal");
|
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;
|
$op->{i} = 3;
|
||||||
ok(($op2 >= $op), "operator greater than or equal");
|
ok(($op2 >= $op), "operator greater than or equal");
|
||||||
ok(($op >= $op2), "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;
|
$op2->{i} = 8;
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
ok($op < $op2, "operator lesser than");
|
ok($op < $op2, "operator lesser than");
|
||||||
ok_not(($op2 < $op), "operator lesser than");
|
ok(not($op2 < $op), "operator lesser than");
|
||||||
$op2->{i} = 3;
|
$op2->{i} = 3;
|
||||||
ok_not(($op2 < $op), "operator lesser than");
|
ok(not($op2 < $op), "operator lesser than");
|
||||||
ok_not(($op < $op2), "operator lesser than");
|
ok(not($op < $op2), "operator lesser than");
|
||||||
|
|
||||||
# less than or equal operator
|
# less than or equal operator
|
||||||
$op2->{i} = 8;
|
$op2->{i} = 8;
|
||||||
$op->{i} = 3;
|
$op->{i} = 3;
|
||||||
ok($op <= $op2, "operator lesser than or equal");
|
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;
|
$op2->{i} = 3;
|
||||||
ok(($op2 <= $op), "operator less than or equal");
|
ok(($op2 <= $op), "operator less than or equal");
|
||||||
ok(($op <= $op2), "operator less than or equal");
|
ok(($op <= $op2), "operator less than or equal");
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ is(14, $o->byval1cpr(undef));
|
||||||
is(15, $o->byval2cpr(undef));
|
is(15, $o->byval2cpr(undef));
|
||||||
is(16, $o->byval2cpr($x));
|
is(16, $o->byval2cpr($x));
|
||||||
|
|
||||||
# forward class declaration
|
# fwd class declaration
|
||||||
is(17, $o->byval1forwardptr($x));
|
is(17, $o->byval1fwdptr($x));
|
||||||
is(18, $o->byval1forwardptr(undef));
|
is(18, $o->byval1fwdptr(undef));
|
||||||
|
|
||||||
is(19, $o->byval2forwardptr(undef));
|
is(19, $o->byval2fwdptr(undef));
|
||||||
is(20, $o->byval2forwardptr($x));
|
is(20, $o->byval2fwdptr($x));
|
||||||
|
|
||||||
is(21, $o->byval1forwardref($x));
|
is(21, $o->byval1fwdref($x));
|
||||||
|
|
||||||
is(22, $o->byval2forwardref($x));
|
is(22, $o->byval2fwdref($x));
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,6 @@ use Test::More tests => 4;
|
||||||
BEGIN { use_ok('packageoption_a'); }
|
BEGIN { use_ok('packageoption_a'); }
|
||||||
BEGIN { use_ok('packageoption_b'); }
|
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();
|
my $a = CommonPackage::A->new();
|
||||||
|
|
||||||
isa_ok($a, 'CommonPackage::A');
|
isa_ok($a, 'CommonPackage::A');
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,24 @@
|
||||||
|
|
||||||
require "tests.php";
|
require "tests.php";
|
||||||
|
|
||||||
check::classes(array('Foo','Spam'));
|
// No new functions
|
||||||
$spam=new Spam();
|
check::functions(array());
|
||||||
|
|
||||||
|
check::classes(array('Foo','Spam'));
|
||||||
|
|
||||||
|
// No new vars
|
||||||
|
check::globals(array());
|
||||||
|
|
||||||
|
// We shouldn't be able to instantiate abstract class Foo.
|
||||||
|
$class = 'Foo';
|
||||||
|
try {
|
||||||
|
$obj = eval("new $class();");
|
||||||
|
check::fail("Should not be able to instantiate abstract class $class");
|
||||||
|
} catch (Error $e) {
|
||||||
|
check::equal($e->getMessage(), "Cannot instantiate abstract class $class", "Unexpected exception: {$e->getMessage()}");
|
||||||
|
}
|
||||||
|
|
||||||
|
$spam=new Spam();
|
||||||
check::equal(0,$spam->blah(),"spam object method");
|
check::equal(0,$spam->blah(),"spam object method");
|
||||||
|
|
||||||
check::done();
|
check::done();
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,17 @@
|
||||||
require "tests.php";
|
require "tests.php";
|
||||||
|
|
||||||
check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i'));
|
check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i'));
|
||||||
// This constructor attempt should fail as there isn't one
|
|
||||||
//$spam=new Spam();
|
|
||||||
|
|
||||||
//check::equal(0,$spam->blah(),"spam object method");
|
// We shouldn't be able to instantiate any of these classes since they are all
|
||||||
//check::equal(0,Spam::blah($spam),"spam class method");
|
// abstract (in each case there's a pure virtual function in the base class
|
||||||
|
// which isn't implemented).
|
||||||
|
foreach (array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i')as $class) {
|
||||||
|
try {
|
||||||
|
$obj = eval("new $class();");
|
||||||
|
check::fail("Should not be able to instantiate abstract class $class");
|
||||||
|
} catch (Error $e) {
|
||||||
|
check::equal($e->getMessage(), "Cannot instantiate abstract class $class", "Unexpected exception: {$e->getMessage()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
check::done();
|
check::done();
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,14 @@ $tr=copy_intp(4);
|
||||||
check::equal(4,inctr($tr),"4==incr($tr)");
|
check::equal(4,inctr($tr),"4==incr($tr)");
|
||||||
check::equal(5,intp_value($tr),"5==$tr");
|
check::equal(5,intp_value($tr),"5==$tr");
|
||||||
|
|
||||||
# Check the voidhandle call, first with null
|
# Check the voidhandle call, first with NULL and then with the SWIG\p_void we
|
||||||
|
# get from the first call.
|
||||||
$handle=NULL;
|
$handle=NULL;
|
||||||
voidhandle($handle);
|
for ($i=0; $i != 1; $i++) {
|
||||||
check::equal(get_class($handle),"SWIG\\_p_void",'$handle is not _p_void');
|
voidhandle($handle);
|
||||||
$handledata=handle($handle);
|
check::equal(get_class($handle),"SWIG\\_p_void",'$handle is not _p_void');
|
||||||
check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
|
$handledata=handle($handle);
|
||||||
|
check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
|
||||||
|
}
|
||||||
|
|
||||||
check::done();
|
check::done();
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,9 @@ check::classes(array('arrays_scope','Bar'));
|
||||||
check::globals(array());
|
check::globals(array());
|
||||||
|
|
||||||
$bar=new bar();
|
$bar=new bar();
|
||||||
|
$bar->blah($bar->adata, $bar->bdata, $bar->cdata);
|
||||||
|
// Like C/C++, SWIG treats `int asize[ASIZE]` as `int*` so there's no checking
|
||||||
|
// of the passed array size.
|
||||||
|
$bar->blah($bar->bdata, $bar->cdata, $bar->adata);
|
||||||
|
|
||||||
check::done();
|
check::done();
|
||||||
|
|
|
||||||
16
Examples/test-suite/php/cpp11_final_directors_runme.php
Normal file
16
Examples/test-suite/php/cpp11_final_directors_runme.php
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require "tests.php";
|
||||||
|
|
||||||
|
// No new functions
|
||||||
|
check::functions(array());
|
||||||
|
check::classes(array('Base','BaseFinalDestructor','BaseFinalDestructor2','Derived'));
|
||||||
|
// No new vars
|
||||||
|
check::globals(array());
|
||||||
|
|
||||||
|
class Derived2 extends Derived {
|
||||||
|
function meth() { return 3; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$b = new Derived2();
|
||||||
|
check::equal($b->meth(), 3, "Wrong return value");
|
||||||
|
|
@ -164,3 +164,5 @@ enumCheck($class1->class1Test2(Class1::Enum12_Val5c), 1121);
|
||||||
enumCheck(globalTest1(Enum1_Val5a), 13);
|
enumCheck(globalTest1(Enum1_Val5a), 13);
|
||||||
enumCheck(globalTest2(Class1::Enum12_Val5c), 1121);
|
enumCheck(globalTest2(Class1::Enum12_Val5c), 1121);
|
||||||
#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121);
|
#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121);
|
||||||
|
|
||||||
|
check::done();
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue