Swig v3.0.12 am: cb28bf46fd Change-Id: I09a7a83edd129abb8bb0bbeaa39ddc07be9a7952
diff --git a/bin/ccache-swig b/bin/ccache-swig deleted file mode 100755 index 6ada796..0000000 --- a/bin/ccache-swig +++ /dev/null Binary files differ
diff --git a/bin/swig b/bin/swig index d643699..eba0838 100755 --- a/bin/swig +++ b/bin/swig Binary files differ
diff --git a/build-common.sh b/build-common.sh deleted file mode 100644 index d6d3a32..0000000 --- a/build-common.sh +++ /dev/null
@@ -1,113 +0,0 @@ -# inputs -# $PROJ - project name (cmake|ninja|swig) -# $VER - project version -# $1 - name of this file -# -# this file does the following: -# -# 1) define the following env vars -# OS - linux|darwin|windows -# USER - username -# CORES - numer of cores (for parallel builds) -# PATH (with appropriate compilers) -# CFLAGS/CXXFLAGS/LDFLAGS -# RD - root directory for source and object files -# INSTALL - install directory/git repo root -# SCRIPT_FILE=absolute path to the parent build script -# SCRIPT_DIR=absolute path to the parent build script's directory -# COMMON_FILE=absolute path to this file - -# -# 2) create an empty tmp directory at /tmp/$PROJ-$USER -# 3) checkout the destination git repo to /tmp/prebuilts/$PROJ/$OS-x86/$VER -# 4) cd $RD - -UNAME="$(uname)" -case "$UNAME" in -Linux) - SCRATCH=/tmp - OS='linux' - INSTALL_VER=$VER - ;; -Darwin) - SCRATCH=/tmp - OS='darwin' - OSX_MIN=10.6 - export CFLAGS="$CFLAGS -mmacosx-version-min=$OSX_MIN" - export CXXFLAGS="$CXXFLAGS -mmacosx-version-min=$OSX_MIN" - export LDFLAGS="$LDFLAGS -mmacosx-version-min=$OSX_MIN" - INSTALL_VER=$VER - ;; -*_NT-*) - if [[ "$UNAME" == CYGWIN_NT-* ]]; then - PATH_PREFIX=/cygdrive - else - # MINGW32_NT-* - PATH_PREFIX= - fi - SCRATCH=$PATH_PREFIX/d/src/tmp - USER=$USERNAME - OS='windows' - CORES=$NUMBER_OF_PROCESSORS - # VS2013 x64 Native Tools Command Prompt - case "$MSVS" in - 2013) - export PATH="$PATH_PREFIX/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/":"$PATH_PREFIX/c/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/":"$PATH" - export INCLUDE="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\INCLUDE;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\INCLUDE;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt;" - export LIB="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64;" - export LIBPATH="C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\ATLMFC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\8.1\\References\\CommonConfiguration\\Neutral;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v8.1\\ExtensionSDKs\\Microsoft.VCLibs\\12.0\\References\\CommonConfiguration\\neutral;" - INSTALL_VER=${VER}_${MSVS} - ;; - *) - # g++/make build - export CC=x86_64-w64-mingw32-gcc - export CXX=x86_64-w64-mingw32-g++ - export LD=x86_64-w64-mingw32-ld - ;; - esac - ;; -*) - exit 1 - ;; -esac - -RD=$SCRATCH/$PROJ-$USER -INSTALL="$RD/install" - -cd /tmp # windows can't delete if you're in the dir -rm -rf $RD -mkdir -p $INSTALL -mkdir -p $RD -cd $RD - -# OSX lacks a "realpath" bash command -realpath() { - [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" -} - -SCRIPT_FILE=$(realpath "$0") -SCRIPT_DIR="$(dirname "$SCRIPT_FILE")" -COMMON_FILE="$SCRIPT_DIR/$1" - -commit_and_push() -{ - # check into a local git clone - rm -rf $SCRATCH/prebuilts/$PROJ/ - mkdir -p $SCRATCH/prebuilts/$PROJ/ - cd $SCRATCH/prebuilts/$PROJ/ - git clone https://android.googlesource.com/platform/prebuilts/$PROJ/$OS-x86 - GIT_REPO="$SCRATCH/prebuilts/$PROJ/$OS-x86" - cd $GIT_REPO - git rm -r * || true # ignore error caused by empty directory - mv $INSTALL/* $GIT_REPO - cp $SCRIPT_FILE $GIT_REPO - cp $COMMON_FILE $GIT_REPO - - git add . - git commit -m "Adding binaries for $INSTALL_VER" - - # execute this command to upload - #git push origin HEAD:refs/for/master - - rm -rf $RD || true # ignore error -}
diff --git a/build-swig.sh b/build-swig.sh deleted file mode 100755 index a54aa93..0000000 --- a/build-swig.sh +++ /dev/null
@@ -1,29 +0,0 @@ -#!/bin/bash -ex -# Download & build swig on the local machine -# works on Linux, OSX, and Windows (Cygwin w/make 4.1, curl, gcc 4.9.2) -# leaves output in /tmp/prebuilts/install/ -# cmake must be installed on Windows - -PROJ=swig -VER=2.0.11 - -source $(dirname "$0")/build-common.sh build-common.sh - -TGZ=$PROJ-$VER.tar.gz -curl -L http://downloads.sourceforge.net/project/swig/swig/$PROJ-$VER/$TGZ -o $TGZ -tar xzf $TGZ || cat $TGZ -mkdir -p $RD/build -cd $RD/build - -# build PCRE as a static library from a tarball just for use during the SWIG build. -# GNU make 3.81 (MinGW version) crashes on Windows -curl -L ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz -o pcre-8.37.tar.gz -$RD/$PROJ-$VER/Tools/pcre-build.sh - -$RD/$PROJ-$VER/configure --prefix=$INSTALL -make -j$CORES -make install -cd $INSTALL/bin -ln -s swig swig2.0 - -commit_and_push
diff --git a/revisions b/revisions new file mode 100644 index 0000000..dc53131 --- /dev/null +++ b/revisions
@@ -0,0 +1,5 @@ +external/lldb-utils 6d596eeb80688412346080adb28552790331a112 +external/swig fbeb566014a1d320df972aef965daf042db7db36 +prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 73ca99196723f810dad42390d154654354f57c16 +prebuilts/clang/linux-x86/host/3.6 c4da85d149dd9f763fb9d1db8d165621216a2aea +external/pcre c0b835ad863cbed40715e439043aa5ef1114c8ad
diff --git a/share/man/man1/ccache-swig.1 b/share/man/man1/ccache-swig.1 deleted file mode 100644 index 0081b6d..0000000 --- a/share/man/man1/ccache-swig.1 +++ /dev/null
@@ -1,453 +0,0 @@ -.TH "ccache\-swig" "1" "" "" "" - -.PP -.SH "NAME" -ccache\-swig \- a fast compiler cache -.PP -.SH "SYNOPSIS" - -.PP -ccache\-swig [OPTION] -.PP -ccache\-swig <compiler> [COMPILER OPTIONS] -.PP -<compiler> [COMPILER OPTIONS] -.PP -.SH "DESCRIPTION" - -.PP -ccache\-swig is a compiler cache\&. It speeds up re\-compilation of C/C++/SWIG code -by caching previous compiles and detecting when the same compile is -being done again\&. ccache\-swig is ccache plus support for SWIG\&. ccache -and ccache\-swig are used interchangeably in this document\&. -.PP -.SH "OPTIONS SUMMARY" - -.PP -Here is a summary of the options to ccache\-swig\&. -.PP -.nf - -\-s show statistics summary -\-z zero statistics -\-c run a cache cleanup -\-C clear the cache completely -\-F <n> set maximum files in cache -\-M <n> set maximum size of cache (use G, M or K) -\-h this help page -\-V print version number - -.fi - -.PP -.SH "OPTIONS" - -.PP -These options only apply when you invoke ccache as \(dq\&ccache\-swig\(dq\&\&. When -invoked as a compiler none of these options apply\&. In that case your -normal compiler options apply and you should refer to your compilers -documentation\&. -.PP -.IP "\fB\-h\fP" -Print a options summary page -.IP -.IP "\fB\-s\fP" -Print the current statistics summary for the cache\&. The -statistics are stored spread across the subdirectories of the -cache\&. Using \(dq\&ccache\-swig \-s\(dq\& adds up the statistics across all -subdirectories and prints the totals\&. -.IP -.IP "\fB\-z\fP" -Zero the cache statistics\&. -.IP -.IP "\fB\-V\fP" -Print the ccache version number -.IP -.IP "\fB\-c\fP" -Clean the cache and re\-calculate the cache file count and -size totals\&. Normally the \-c option should not be necessary as ccache -keeps the cache below the specified limits at runtime and keeps -statistics up to date on each compile\&. This option is mostly useful -if you manually modify the cache contents or believe that the cache -size statistics may be inaccurate\&. -.IP -.IP "\fB\-C\fP" -Clear the entire cache, removing all cached files\&. -.IP -.IP "\fB\-F <maxfiles>\fP" -This sets the maximum number of files allowed in -the cache\&. The value is stored inside the cache directory and applies -to all future compiles\&. Due to the way the value is stored the actual -value used is always rounded down to the nearest multiple of 16\&. -.IP -.IP "\fB\-M <maxsize>\fP" -This sets the maximum cache size\&. You can specify -a value in gigabytes, megabytes or kilobytes by appending a G, M or K -to the value\&. The default is gigabytes\&. The actual value stored is -rounded down to the nearest multiple of 16 kilobytes\&. -.IP -.SH "INSTALLATION" - -.PP -There are two ways to use ccache\&. You can either prefix your compile -commands with \(dq\&ccache\-swig\(dq\& or you can create a symbolic link between -ccache\-swig and the names of your compilers\&. The first method is most -convenient if you just want to try out ccache or wish to use it for -some specific projects\&. The second method is most useful for when you -wish to use ccache for all your compiles\&. -.PP -To install for usage by the first method just copy ccache\-swig to somewhere -in your path\&. -.PP -To install for the second method do something like this: -.nf - - cp ccache\-swig /usr/local/bin/ - ln \-s /usr/local/bin/ccache\-swig /usr/local/bin/gcc - ln \-s /usr/local/bin/ccache\-swig /usr/local/bin/g++ - ln \-s /usr/local/bin/ccache\-swig /usr/local/bin/cc - ln \-s /usr/local/bin/ccache\-swig /usr/local/bin/swig - -.fi -This will work as long as /usr/local/bin comes before the path to gcc -(which is usually in /usr/bin)\&. After installing you may wish to run -\(dq\&which gcc\(dq\& to make sure that the correct link is being used\&. -.PP -Note! Do not use a hard link, use a symbolic link\&. A hardlink will -cause \(dq\&interesting\(dq\& problems\&. -.PP -.SH "EXTRA OPTIONS" - -.PP -When run as a compiler front end ccache usually just takes the same -command line options as the compiler you are using\&. The only exception -to this is the option \(cq\&\-\-ccache\-skip\(cq\&\&. That option can be used to tell -ccache that the next option is definitely not a input filename, and -should be passed along to the compiler as\-is\&. -.PP -The reason this can be important is that ccache does need to parse the -command line and determine what is an input filename and what is a -compiler option, as it needs the input filename to determine the name -of the resulting object file (among other things)\&. The heuristic -ccache uses in this parse is that any string on the command line that -exists as a file is treated as an input file name (usually a C -file)\&. By using \-\-ccache\-skip you can force an option to not be -treated as an input file name and instead be passed along to the -compiler as a command line option\&. -.PP -.SH "ENVIRONMENT VARIABLES" - -.PP -ccache uses a number of environment variables to control operation\&. In -most cases you won\(cq\&t need any of these as the defaults will be fine\&. -.PP -.IP "\fBCCACHE_DIR\fP" -the CCACHE_DIR environment variable specifies -where ccache will keep its cached compiler output\&. The default is -\(dq\&$HOME/\&.ccache\(dq\&\&. -.IP -.IP "\fBCCACHE_TEMPDIR\fP" -the CCACHE_TEMPDIR environment variable specifies -where ccache will put temporary files\&. The default is the same as -CCACHE_DIR\&. Note that the CCACHE_TEMPDIR path must be on the same -filesystem as the CCACHE_DIR path, so that renames of files between -the two directories can work\&. -.IP -.IP "\fBCCACHE_LOGFILE\fP" -If you set the CCACHE_LOGFILE environment -variable then ccache will write some log information on cache hits -and misses in that file\&. This is useful for tracking down problems\&. -.IP -.IP "\fBCCACHE_VERBOSE\fP" -If you set the CCACHE_VERBOSE environment -variable then ccache will display on stdout all the compiler invocations -that it makes\&. This can useful for debugging unexpected problems\&. -.IP -.IP "\fBCCACHE_PATH\fP" -You can optionally set CCACHE_PATH to a colon -separated path where ccache will look for the real compilers\&. If you -don\(cq\&t do this then ccache will look for the first executable matching -the compiler name in the normal PATH that isn\(cq\&t a symbolic link to -ccache itself\&. -.IP -.IP "\fBCCACHE_CC\fP" -You can optionally set CCACHE_CC to force the name -of the compiler to use\&. If you don\(cq\&t do this then ccache works it out -from the command line\&. -.IP -.IP "\fBCCACHE_PREFIX\fP" -This option adds a prefix to the command line -that ccache runs when invoking the compiler\&. Also see the section -below on using ccache with distcc\&. -.IP -.IP "\fBCCACHE_DISABLE\fP" -If you set the environment variable -CCACHE_DISABLE then ccache will just call the real compiler, -bypassing the cache completely\&. -.IP -.IP "\fBCCACHE_READONLY\fP" -the CCACHE_READONLY environment variable -tells ccache to attempt to use existing cached object files, but not -to try to add anything new to the cache\&. If you are using this because -your CCACHE_DIR is read\-only, then you may find that you also need to -set CCACHE_TEMPDIR as otherwise ccache will fail to create the -temporary files\&. -.IP -.IP "\fBCCACHE_CPP2\fP" -If you set the environment variable CCACHE_CPP2 -then ccache will not use the optimisation of avoiding the 2nd call to -the pre\-processor by compiling the pre\-processed output that was used -for finding the hash in the case of a cache miss\&. This is primarily a -debugging option, although it is possible that some unusual compilers -will have problems with the intermediate filename extensions used in -this optimisation, in which case this option could allow ccache to be -used\&. -.IP -.IP "\fBCCACHE_NOCOMPRESS\fP" -If you set the environment variable -CCACHE_NOCOMPRESS then there is no compression used on files that go -into the cache\&. However, this setting has no effect on how files are -retrieved from the cache, compressed results will still be usable\&. -.IP -.IP "\fBCCACHE_NOSTATS\fP" -If you set the environment variable -CCACHE_NOSTATS then ccache will not update the statistics files on -each compile\&. -.IP -.IP "\fBCCACHE_NLEVELS\fP" -The environment variable CCACHE_NLEVELS allows -you to choose the number of levels of hash in the cache directory\&. The -default is 2\&. The minimum is 1 and the maximum is 8\&. -.IP -.IP "\fBCCACHE_HARDLINK\fP" -If you set the environment variable -CCACHE_HARDLINK then ccache will attempt to use hard links from the -cache directory when creating the compiler output rather than using a -file copy\&. Using hard links is faster, but can confuse programs like -\(cq\&make\(cq\& that rely on modification times\&. Hard links are never made for -compressed cache files\&. -.IP -.IP "\fBCCACHE_RECACHE\fP" -This forces ccache to not use any cached -results, even if it finds them\&. New results are still cached, but -existing cache entries are ignored\&. -.IP -.IP "\fBCCACHE_UMASK\fP" -This sets the umask for ccache and all child -processes (such as the compiler)\&. This is mostly useful when you wish -to share your cache with other users\&. Note that this also affects the -file permissions set on the object files created from your -compilations\&. -.IP -.IP "\fBCCACHE_HASHDIR\fP" -This tells ccache to hash the current working -directory when calculating the hash that is used to distinguish two -compiles\&. This prevents a problem with the storage of the current -working directory in the debug info of a object file, which can lead -ccache to give a cached object file that has the working directory in -the debug info set incorrectly\&. This option is off by default as the -incorrect setting of this debug info rarely causes problems\&. If you -strike problems with gdb not using the correct directory then enable -this option\&. -.IP -.IP "\fBCCACHE_UNIFY\fP" -If you set the environment variable CCACHE_UNIFY -then ccache will use the C/C++ unifier when hashing the pre\-processor -output if \-g is not used in the compile\&. The unifier is slower than a -normal hash, so setting this environment variable loses a little bit -of speed, but it means that ccache can take advantage of not -recompiling when the changes to the source code consist of -reformatting only\&. Note that using CCACHE_UNIFY changes the hash, so -cached compiles with CCACHE_UNIFY set cannot be used when -CCACHE_UNIFY is not set and vice versa\&. The reason the unifier is off -by default is that it can give incorrect line number information in -compiler warning messages\&. -.IP -.IP "\fBCCACHE_EXTENSION\fP" -Normally ccache tries to automatically -determine the extension to use for intermediate C pre\-processor files -based on the type of file being compiled\&. Unfortunately this sometimes -doesn\(cq\&t work, for example when using the aCC compiler on HP\-UX\&. On -systems like this you can use the CCACHE_EXTENSION option to override -the default\&. On HP\-UX set this environment variable to \(dq\&i\(dq\& if you use -the aCC compiler\&. -.IP -.IP "\fBCCACHE_STRIPC\fP" -If you set the environment variable -CCACHE_STRIPC then ccache will strip the \-c option when invoking -the preprocessor\&. This option is primarily for the Sun Workshop -C++ compiler as without this option an unwarranted warning is displayed: -CC: Warning: \(dq\&\-E\(dq\& redefines product from \(dq\&object\(dq\& to \(dq\&source (stdout)\(dq\& -when \-E and \-c is used together\&. -.IP -.IP "\fBCCACHE_SWIG\fP" -When using SWIG as the compiler and it does not -have \(cq\&swig\(cq\& in the executable name, then the CCACHE_SWIG environment -variable needs to be set in order for ccache to work correctly with -SWIG\&. The use of CCACHE_CPP2 is also recommended for SWIG due to some -preprocessor quirks, however, use of CCACHE_CPP2 can often be skipped -\-\- check your generated code with and without this option set\&. Known -problems are using preprocessor directives within %inline blocks and -the use of \(cq\&#pragma SWIG\(cq\&\&. -.IP -.SH "CACHE SIZE MANAGEMENT" - -.PP -By default ccache has a one gigabyte limit on the cache size and no -maximum number of files\&. You can set a different limit using the -\(dq\&ccache \-M\(dq\& and \(dq\&ccache \-F\(dq\& options, which set the size and number of -files limits\&. -.PP -When these limits are reached ccache will reduce the cache to 20% -below the numbers you specified in order to avoid doing the cache -clean operation too often\&. -.PP -.SH "CACHE COMPRESSION" - -.PP -By default on most platforms ccache will compress all files it puts -into the cache -using the zlib compression\&. While this involves a negligible -performance slowdown, it significantly increases the number of files -that fit in the cache\&. You can turn off compression setting the -CCACHE_NOCOMPRESS environment variable\&. -.PP -.SH "HOW IT WORKS" - -.PP -The basic idea is to detect when you are compiling exactly the same -code a 2nd time and use the previously compiled output\&. You detect -that it is the same code by forming a hash of: -.PP -.IP o -the pre\-processor output from running the compiler with \-E -.IP o -the command line options -.IP o -the real compilers size and modification time -.IP o -any stderr output generated by the compiler - -.PP -These are hashed using md4 (a strong hash) and a cache file is formed -based on that hash result\&. When the same compilation is done a second -time ccache is able to supply the correct compiler output (including -all warnings etc) from the cache\&. -.PP -ccache has been carefully written to always produce exactly the same -compiler output that you would get without the cache\&. If you ever -discover a case where ccache changes the output of your compiler then -please let me know\&. -.PP -.SH "USING CCACHE WITH DISTCC" - -.PP -distcc is a very useful program for distributing compilation across a -range of compiler servers\&. It is often useful to combine distcc with -ccache, so that compiles that are done are sped up by distcc, but that -ccache avoids the compile completely where possible\&. -.PP -To use distcc with ccache I recommend using the CCACHE_PREFIX -option\&. You just need to set the environment variable CCACHE_PREFIX to -\(cq\&distcc\(cq\& and ccache will prefix the command line used with the -compiler with the command \(cq\&distcc\(cq\&\&. -.PP -.SH "SHARING A CACHE" - -.PP -A group of developers can increase the cache hit rate by sharing a -cache directory\&. The hard links however cause unwanted side effects, -as all links to a cached file share the file\(cq\&s modification timestamp\&. -This results in false dependencies to be triggered by timestamp\-based -build systems whenever another user links to an existing -file\&. Typically, users will see that their libraries and binaries are -relinked without reason\&. To share a cache without side effects, the -following conditions need to be met: -.PP -.IP o -Use the same \fBCCACHE_DIR\fP environment variable setting -.IP o -Unset the \fBCCACHE_HARDLINK\fP environment variable -.IP o -Make sure everyone sets the CCACHE_UMASK environment variable -to 002, this ensures that cached files are accessible to everyone in -the group\&. -.IP o -Make sure that all users have write permission in the entire -cache directory (and that you trust all users of the shared cache)\&. -.IP o -Make sure that the setgid bit is set on all directories in the -cache\&. This tells the filesystem to inherit group ownership for new -directories\&. The command \(dq\&chmod g+s `find $CCACHE_DIR \-type d`\(dq\& might -be useful for this\&. -.IP o -Set \fBCCACHE_NOCOMPRESS\fP for all users, if there are users with -versions of ccache that do not support compression\&. - -.PP -.SH "HISTORY" - -.PP -ccache was inspired by the compilercache shell script script written -by Erik Thiele and I would like to thank him for an excellent piece of -work\&. See -http://www\&.erikyyy\&.de/compilercache/ -for the Erik\(cq\&s scripts\&. -ccache\-swig is a port of the original ccache with support added for use -with SWIG\&. -.PP -I wrote ccache because I wanted to get a bit more speed out of a -compiler cache and I wanted to remove some of the limitations of the -shell\-script version\&. -.PP -.SH "DIFFERENCES FROM COMPILERCACHE" - -.PP -The biggest differences between Erik\(cq\&s compilercache script and ccache -are: -.IP o -ccache is written in C, which makes it a bit faster (calling out to -external programs is mostly what slowed down the scripts)\&. -.IP o -ccache can automatically find the real compiler -.IP o -ccache keeps statistics on hits/misses -.IP o -ccache can do automatic cache management -.IP o -ccache can cache compiler output that includes warnings\&. In many -cases this gives ccache a much higher cache hit rate\&. -.IP o -ccache can handle a much wider ranger of compiler options -.IP o -ccache avoids a double call to cpp on a cache miss - -.PP -.SH "CREDITS" - -.PP -Thanks to the following people for their contributions to ccache -.IP o -Erik Thiele for the original compilercache script -.IP o -Luciano Rocha for the idea of compiling the pre\-processor output -to avoid a 2nd cpp pass -.IP o -Paul Russell for many suggestions and the debian packaging - -.PP -.SH "AUTHOR" - -.PP -ccache was written by Andrew Tridgell -http://samba\&.org/~tridge/\&. -ccache was adapted to create ccache\-swig for use with SWIG by William Fulton\&. -.PP -If you wish to report a problem or make a suggestion then please email -the SWIG developers on the swig\-devel mailing list, see -http://www\&.swig\&.org/mail\&.html -.PP -ccache is released under the GNU General Public License version 2 or -later\&. Please see the file COPYING for license details\&. -.PP -
diff --git a/share/swig/2.0.11/go/cdata.i b/share/swig/2.0.11/go/cdata.i deleted file mode 100644 index 0dac642..0000000 --- a/share/swig/2.0.11/go/cdata.i +++ /dev/null
@@ -1,64 +0,0 @@ -/* ----------------------------------------------------------------------------- - * cdata.i - * - * SWIG library file containing macros for manipulating raw C data as strings. - * ----------------------------------------------------------------------------- */ - -%{ -typedef struct SWIGCDATA { - char *data; - int len; -} SWIGCDATA; -%} - -%typemap(gotype) SWIGCDATA %{ []byte %} -%typemap(out) SWIGCDATA %{ - $result.data = (char*)_swig_goallocate($1.len); - memcpy($result.data, $1.data, $1.len); - $result.len = (int)$1.len; -%} - -/* ----------------------------------------------------------------------------- - * %cdata(TYPE [, NAME]) - * - * Convert raw C data to a binary string. - * ----------------------------------------------------------------------------- */ - -%define %cdata(TYPE,NAME...) - -%insert("header") { -#if #NAME == "" -static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) { -#else -static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) { -#endif - SWIGCDATA d; - d.data = (char *) ptr; -#if #TYPE != "void" - d.len = nelements*sizeof(TYPE); -#else - d.len = nelements; -#endif - return d; -} -} - -%typemap(default) int nelements "$1 = 1;" - -#if #NAME == "" -SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements); -#else -SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements); -#endif -%enddef - -%typemap(default) int nelements; - -%rename(cdata) ::cdata_void(void *ptr, int nelements); - -%cdata(void); - -/* Memory move function. Due to multi-argument typemaps this appears - to be wrapped as - void memmove(void *data, const char *s); */ -void memmove(void *data, char *indata, int inlen);
diff --git a/share/swig/2.0.11/go/goruntime.swg b/share/swig/2.0.11/go/goruntime.swg deleted file mode 100644 index 4b7daf4..0000000 --- a/share/swig/2.0.11/go/goruntime.swg +++ /dev/null
@@ -1,218 +0,0 @@ -/* ------------------------------------------------------------ - * goruntime.swg - * - * Go runtime code for the various generated files. - * ------------------------------------------------------------ */ - -%insert(runtime) %{ -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> - -%} - -#if SWIGGO_INTGO_SIZE == 32 -%insert(runtime) %{ -typedef int intgo; -typedef unsigned int uintgo; -%} -#elif SWIGGO_INTGO_SIZE == 64 -%insert(runtime) %{ -typedef long long intgo; -typedef unsigned long long uintgo; -%} -#else -%insert(runtime) %{ -typedef ptrdiff_t intgo; -typedef size_t uintgo; -%} -#endif - -%insert(runtime) %{ - -typedef struct { char *p; intgo n; } _gostring_; -typedef struct { void* array; intgo len; intgo cap; } _goslice_; - -%} - -#ifndef SWIGGO_GCCGO -/* Boilerplate for C/C++ code when using 6g/8g. This code is compiled - with gcc. */ -%insert(runtime) %{ - -#define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1]; -#define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n) - -swiggo_size_assert(char, 1) -swiggo_size_assert(short, 2) -swiggo_size_assert(int, 4) -typedef long long swiggo_long_long; -swiggo_size_assert(swiggo_long_long, 8) -swiggo_size_assert(float, 4) -swiggo_size_assert(double, 8) - -#ifdef __cplusplus -extern "C" { -#endif -extern void crosscall2(void (*fn)(void *, int), void *, int); -extern void _cgo_allocate(void *, int); -extern void _cgo_panic(void *, int); -#ifdef __cplusplus -} -#endif - -static void *_swig_goallocate(size_t len) { - struct { - size_t len; - void *ret; - } a; - a.len = len; - crosscall2(_cgo_allocate, &a, (int) sizeof a); - return a.ret; -} - -static void _swig_gopanic(const char *p) { - struct { - const char *p; - } a; - a.p = p; - crosscall2(_cgo_panic, &a, (int) sizeof a); -} - -%} - -/* Boilerplate for C code when using 6g/8g. This code is compiled - with 6c/8c. */ -%insert(gc_header) %{ -#include "runtime.h" -#include "cgocall.h" - -#ifdef _64BIT -#define SWIG_PARM_SIZE 8 -#else -#define SWIG_PARM_SIZE 4 -#endif -%} - -#else - -/* Boilerplate for C/C++ code when using gccgo. */ -%insert(runtime) %{ -#define SWIGGO_GCCGO - -#ifdef __cplusplus -extern "C" { -#endif -extern void *_cgo_allocate(size_t); -extern void _cgo_panic(const char *); - -/* Implementations of SwigCgocall and friends for different versions - of gccgo. The Go code will call these functions using C names with - a prefix of the module name. The implementations here call the - routine in libgo. The routines to call vary depending on the gccgo - version. We assume that the version of gcc used to compile this - file is the same as the version of gccgo. */ - -#define SWIGCONCAT2(s1, s2) s1 ## s2 -#define SWIGCONCAT1(s1, s2) SWIGCONCAT2(s1, s2) -#define SwigCgocall SWIGCONCAT1(SWIGMODULE, SwigCgocall) -#define SwigCgocallDone SWIGCONCAT1(SWIGMODULE, SwigCgocallDone) -#define SwigCgocallBack SWIGCONCAT1(SWIGMODULE, SwigCgocallBack) -#define SwigCgocallBackDone SWIGCONCAT1(SWIGMODULE, SwigCgocallBackDone) - -#define SWIG_GCC_VERSION \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC__PATH_LEVEL__) - -#if SWIG_GCC_VERSION < 40700 -#define SwigDoCgocall() -#define SwigDoCgocallDone() -#define SwigDoCgocallBack() -#define SwigDoCgocallBackDone() -#elif SWIG_GCC_VERSION == 40700 -void SwigDoCgocall(void) __asm__("libgo_syscall.syscall.Entersyscall"); -void SwigDoCgocallDone(void) __asm__("libgo_syscall.syscall.Exitsyscall"); -void SwigDoCgocallBack(void) __asm__("libgo_syscall.syscall.Exitsyscall"); -void SwigDoCgocallBackDone(void) __asm__("libgo_syscall.syscall.Entersyscall"); -#else -void SwigDoCgocall(void) __asm__("syscall.Cgocall"); -void SwigDoCgocallDone(void) __asm__("syscall.CgocallDone"); -void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack"); -void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone"); -#endif - -void SwigCgocall() { - SwigDoCgocall(); -} - -void SwigCgocallDone() { - SwigDoCgocallDone(); -} - -void SwigCgocallBack() { - SwigDoCgocallBack(); -} - -void SwigCgocallBackDone() { - SwigDoCgocallBackDone(); -} - -#ifdef __cplusplus -} -#endif - -#define _swig_goallocate _cgo_allocate -#define _swig_gopanic _cgo_panic - -%} - -#endif - -%insert(runtime) %{ - -static _gostring_ _swig_makegostring(const char *p, size_t l) { - _gostring_ ret; - ret.p = (char*)_swig_goallocate(l + 1); - memcpy(ret.p, p, l); - ret.n = l; - return ret; -} - -#define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { _swig_gopanic(msg); } else -%} - -#ifndef SWIGGO_GCCGO - -%insert(go_header) %{ - -import _ "runtime/cgo" -import "unsafe" - -type _ unsafe.Pointer - -%} - -#else - -%insert(go_header) %{ - -import "syscall" -import "unsafe" - -type _ syscall.Sockaddr - -type _ unsafe.Pointer - -%} - -#endif - -/* Function pointers are translated by the code in go.cxx into - _swig_fnptr. Member pointers are translated to _swig_memberptr. */ - -%insert(go_header) %{ -type _swig_fnptr *byte -type _swig_memberptr *byte -%}
diff --git a/share/swig/2.0.11/go/std_string.i b/share/swig/2.0.11/go/std_string.i deleted file mode 100644 index 9922fbe..0000000 --- a/share/swig/2.0.11/go/std_string.i +++ /dev/null
@@ -1,55 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_string.i - * - * Typemaps for std::string and const std::string& - * These are mapped to a Go string and are passed around by value. - * - * To use non-const std::string references use the following %apply. Note - * that they are passed by value. - * %apply const std::string & {std::string &}; - * ----------------------------------------------------------------------------- */ - -%{ -#include <string> -%} - -namespace std { - -%naturalvar string; - -class string; - -%typemap(gotype) string, const string & "string" - -%typemap(in) string -%{ $1.assign($input.p, $input.n); %} - -%typemap(directorout) string -%{ $result.assign($input.p, $input.n); %} - -%typemap(out) string -%{ $result = _swig_makegostring($1.data(), $1.length()); %} - -%typemap(directorin) string -%{ $input = _swig_makegostring($1.data(), $1.length()); %} - -%typemap(in) const string & -%{ - $*1_ltype $1_str($input.p, $input.n); - $1 = &$1_str; -%} - -%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string & -%{ - static $*1_ltype $1_str; - $1_str.assign($input.p, $input.n); - $result = &$1_str; -%} - -%typemap(out) const string & -%{ $result = _swig_makegostring((*$1).data(), (*$1).length()); %} - -%typemap(directorin) const string & -%{ $input = _swig_makegostring($1.data(), $1.length()); %} - -}
diff --git a/share/swig/2.0.11/java/director.swg b/share/swig/2.0.11/java/director.swg deleted file mode 100644 index f32fda3..0000000 --- a/share/swig/2.0.11/java/director.swg +++ /dev/null
@@ -1,198 +0,0 @@ -/* ----------------------------------------------------------------------------- - * director.swg - * - * This file contains support for director classes that proxy - * method calls from C++ to Java extensions. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus - -#if defined(DEBUG_DIRECTOR_OWNED) -#include <iostream> -#endif - -namespace Swig { - /* Java object wrapper */ - class JObjectWrapper { - public: - JObjectWrapper() : jthis_(NULL), weak_global_(true) { - } - - ~JObjectWrapper() { - jthis_ = NULL; - weak_global_ = true; - } - - bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { - if (!jthis_) { - weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned - if (jobj) - jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; -#endif - return true; - } else { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; -#endif - return false; - } - } - - jobject get(JNIEnv *jenv) const { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::get("; - if (jthis_) - std::cout << jthis_; - else - std::cout << "null"; - std::cout << ") -> return new local ref" << std::endl; -#endif - return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); - } - - void release(JNIEnv *jenv) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; -#endif - if (jthis_) { - if (weak_global_) { - if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) - jenv->DeleteWeakGlobalRef((jweak)jthis_); - } else - jenv->DeleteGlobalRef(jthis_); - } - - jthis_ = NULL; - weak_global_ = true; - } - - /* Only call peek if you know what you are doing wrt to weak/global references */ - jobject peek() { - return jthis_; - } - - /* Java proxy releases ownership of C++ object, C++ object is now - responsible for destruction (creates NewGlobalRef to pin Java - proxy) */ - void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ - if (!weak_global_) { - jenv->DeleteGlobalRef(jthis_); - jthis_ = jenv->NewWeakGlobalRef(jself); - weak_global_ = true; - } - } else { /* Java releases ownership of C++ object's lifetime */ - if (weak_global_) { - jenv->DeleteWeakGlobalRef((jweak)jthis_); - jthis_ = jenv->NewGlobalRef(jself); - weak_global_ = false; - } - } - } - - private: - /* pointer to Java object */ - jobject jthis_; - /* Local or global reference flag */ - bool weak_global_; - }; - - /* director base class */ - class Director { - /* pointer to Java virtual machine */ - JavaVM *swig_jvm_; - - protected: -#if defined (_MSC_VER) && (_MSC_VER<1300) - class JNIEnvWrapper; - friend class JNIEnvWrapper; -#endif - /* Utility class for managing the JNI environment */ - class JNIEnvWrapper { - const Director *director_; - JNIEnv *jenv_; - int env_status; - public: - JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { -#if defined(__ANDROID__) - JNIEnv **jenv = &jenv_; -#else - void **jenv = (void **)&jenv_; -#endif - env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); -#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) - // Attach a daemon thread to the JVM. Useful when the JVM should not wait for - // the thread to exit upon shutdown. Only for jdk-1.4 and later. - director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); -#else - director_->swig_jvm_->AttachCurrentThread(jenv, NULL); -#endif - } - ~JNIEnvWrapper() { -#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) - // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. - // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. - if (env_status == JNI_EDETACHED) - director_->swig_jvm_->DetachCurrentThread(); -#endif - } - JNIEnv *getJNIEnv() const { - return jenv_; - } - }; - - /* Java object wrapper */ - JObjectWrapper swig_self_; - - /* Disconnect director from Java object */ - void swig_disconnect_director_self(const char *disconn_method) { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - jobject jobj = swig_self_.get(jenv); -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; -#endif - if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { - jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); - if (disconn_meth) { -#if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; -#endif - jenv->CallVoidMethod(jobj, disconn_meth); - } - } - jenv->DeleteLocalRef(jobj); - } - - public: - Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { - /* Acquire the Java VM pointer */ - jenv->GetJavaVM(&swig_jvm_); - } - - virtual ~Director() { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - swig_self_.release(jenv); - } - - bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { - return swig_self_.set(jenv, jself, mem_own, weak_global); - } - - jobject swig_get_self(JNIEnv *jenv) const { - return swig_self_.get(jenv); - } - - // Change C++ object's ownership, relative to Java - void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - swig_self_.java_change_ownership(jenv, jself, take_or_release); - } - }; -} - -#endif /* __cplusplus */ - -
diff --git a/share/swig/2.0.11/lua/luarun.swg b/share/swig/2.0.11/lua/luarun.swg deleted file mode 100644 index 4d851bd..0000000 --- a/share/swig/2.0.11/lua/luarun.swg +++ /dev/null
@@ -1,1140 +0,0 @@ -/* ----------------------------------------------------------------------------- - * luarun.swg - * - * This file contains the runtime support for Lua modules - * and includes code for managing global variables and pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "lua.h" -#include "lauxlib.h" -#include <stdlib.h> /* for malloc */ -#include <assert.h> /* for a few sanity tests */ - -/* ----------------------------------------------------------------------------- - * Lua flavors - * ----------------------------------------------------------------------------- */ - -#define SWIG_LUA_FLAVOR_LUA 1 -#define SWIG_LUA_FLAVOR_ELUA 2 -#define SWIG_LUA_FLAVOR_ELUAC 3 - -#if !defined(SWIG_LUA_TARGET) -# error SWIG_LUA_TARGET not defined -#endif - -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) -# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C) -# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C) -# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C) -# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C) -#else /* SWIG_LUA_FLAVOR_LUA */ -# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0 -# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0 -# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0 -# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0 -#endif - -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) -# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING} -# define LSTRVAL LRO_STRVAL -#endif - -/* ----------------------------------------------------------------------------- - * compatibility defines - * ----------------------------------------------------------------------------- */ - -/* History of Lua C API length functions: In Lua 5.0 (and before?) - there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen", - but a compatibility define of "lua_strlen" was added. In Lua 5.2, - this function was again renamed, to "lua_rawlen" (to emphasize that - it doesn't call the "__len" metamethod), and the compatibility - define of lua_strlen was removed. All SWIG uses have been updated - to "lua_rawlen", and we add our own defines of that here for older - versions of Lua. */ -#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 -# define lua_rawlen lua_strlen -#elif LUA_VERSION_NUM == 501 -# define lua_rawlen lua_objlen -#endif - - -/* lua_pushglobaltable is the recommended "future-proof" way to get - the global table for Lua 5.2 and later. Here we define - lua_pushglobaltable ourselves for Lua versions before 5.2. */ -#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 -# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) -#endif - - -/* -------------------------------------------------------------------------- - * Helper functions for error handling - * -------------------------------------------------------------------------- */ - -/* Push the string STR on the Lua stack, like lua_pushstring, but - prefixed with the the location of the innermost Lua call-point - (as formated by luaL_where). */ -SWIGRUNTIME void -SWIG_Lua_pusherrstring (lua_State *L, const char *str) -{ - luaL_where (L, 1); - lua_pushstring (L, str); - lua_concat (L, 2); -} - -/* Push a formatted string generated from FMT and following args on - the Lua stack, like lua_pushfstring, but prefixed with the the - location of the innermost Lua call-point (as formated by luaL_where). */ -SWIGRUNTIME void -SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...) -{ - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); -} - - -/* ----------------------------------------------------------------------------- - * global swig types - * ----------------------------------------------------------------------------- */ -/* Constant table */ -#define SWIG_LUA_INT 1 -#define SWIG_LUA_FLOAT 2 -#define SWIG_LUA_STRING 3 -#define SWIG_LUA_POINTER 4 -#define SWIG_LUA_BINARY 5 -#define SWIG_LUA_CHAR 6 - -/* Structure for variable linking table */ -typedef struct { - const char *name; - lua_CFunction get; - lua_CFunction set; -} swig_lua_var_info; - -/* Constant information structure */ -typedef struct { - int type; - char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_lua_const_info; - -typedef struct { - const char *name; - lua_CFunction method; -} swig_lua_method; - -typedef struct { - const char *name; - lua_CFunction getmethod; - lua_CFunction setmethod; -} swig_lua_attribute; - -// Can be used to create namespaces. Currently used to -// wrap class static methods/variables/constants -typedef struct { - const char *name; - swig_lua_method *ns_methods; - swig_lua_attribute *ns_attributes; - swig_lua_const_info *ns_constants; -} swig_lua_namespace; - -typedef struct swig_lua_class { - const char *name; - swig_type_info **type; - lua_CFunction constructor; - void (*destructor)(void *); - swig_lua_method *methods; - swig_lua_attribute *attributes; - swig_lua_namespace cls_static; - struct swig_lua_class **bases; - const char **base_names; -} swig_lua_class; - -/* this is the struct for wrapping all pointers in SwigLua -*/ -typedef struct { - swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - void *ptr; -} swig_lua_userdata; - -/* this is the struct for wrapping arbitrary packed binary data -(currently it is only used for member function pointers) -the data ordering is similar to swig_lua_userdata, but it is currently not possible -to tell the two structures apart within SWIG, other than by looking at the type -*/ -typedef struct { - swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - char data[1]; /* arbitary amount of data */ -} swig_lua_rawdata; - -/* Common SWIG API */ -#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) -#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) -#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) -#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) - -/* Runtime API */ -#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) -#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer) -#define SWIG_MODULE_CLIENTDATA_TYPE lua_State* - -/* Contract support */ -#define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else - - -/* helper #defines */ -#define SWIG_fail {goto fail;} -#define SWIG_fail_arg(func_name,argnum,type) \ - {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ - func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ - goto fail;} -#define SWIG_fail_ptr(func_name,argnum,type) \ - SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") -#define SWIG_check_num_args(func_name,a,b) \ - if (lua_gettop(L)<a || lua_gettop(L)>b) \ - {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ - goto fail;} - - -#define SWIG_Lua_get_table(L,n) \ - (lua_pushstring(L, n), lua_rawget(L,-2)) - -#define SWIG_Lua_add_function(L,n,f) \ - (lua_pushstring(L, n), \ - lua_pushcfunction(L, f), \ - lua_rawset(L,-3)) - -/* special helper for allowing 'nil' for usertypes */ -#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) - -#ifdef __cplusplus -/* Special helper for member function pointers -it gets the address, casts it, then dereferences it */ -//#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) -#endif - -/* storing/access of swig_module_info */ -SWIGRUNTIME swig_module_info * -SWIG_Lua_GetModule(lua_State* L) { - swig_module_info *ret = 0; - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_rawget(L,LUA_REGISTRYINDEX); - if (lua_islightuserdata(L,-1)) - ret=(swig_module_info*)lua_touserdata(L,-1); - lua_pop(L,1); /* tidy */ - return ret; -} - -SWIGRUNTIME void -SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { - /* add this all into the Lua registry: */ - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_pushlightuserdata(L,(void*)module); - lua_rawset(L,LUA_REGISTRYINDEX); -} - -/* ----------------------------------------------------------------------------- - * global variable support code: modules - * ----------------------------------------------------------------------------- */ - -/* this function is called when trying to set an immutable. -default action is to print an error. -This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ -SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L) -{ -/* there should be 1 param passed in: the new value */ -#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE - lua_pop(L,1); /* remove it */ - luaL_error(L,"This variable is immutable"); -#endif - return 0; /* should not return anything */ -} - -/* the module.get method used for getting linked data */ -SWIGINTERN int SWIG_Lua_module_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute - printf("SWIG_Lua_module_get %p(%s) '%s'\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2)); -*/ - /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,1)); /* just in case */ -#else - assert(lua_istable(L,1)); /* default Lua action */ -#endif - lua_getmetatable(L,1); /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,-1)); /* just in case */ -#else - assert(lua_istable(L,-1)); -#endif - SWIG_Lua_get_table(L,".get"); /* get the .get table */ - lua_remove(L,3); /* remove metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - if (lua_isrotable(L,-1)) -#else - if (lua_istable(L,-1)) -#endif - { - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,3); /* remove .get */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); - return 1; - } - lua_pop(L,1); /* remove the top */ - } - lua_pop(L,1); /* remove the .get */ - lua_pushnil(L); /* return a nil */ - return 1; -} - -/* the module.set method used for setting linked data */ -SWIGINTERN int SWIG_Lua_module_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -*/ - /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,1)); /* just in case */ -#else - assert(lua_istable(L,1)); /* default Lua action */ -#endif - lua_getmetatable(L,1); /* get the metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - assert(lua_isrotable(L,-1)); /* just in case */ -#else - assert(lua_istable(L,-1)); -#endif - SWIG_Lua_get_table(L,".set"); /* get the .set table */ - lua_remove(L,4); /* remove metatable */ -#if ((SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)) - if (lua_isrotable(L,-1)) -#else - if (lua_istable(L,-1)) -#endif - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,4); /* remove .set */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } -#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) - else { - return 0; // Exits stoically if an invalid key is initialized. - } -#endif - } - lua_settop(L,3); /* reset back to start */ - /* we now have the table, key & new value, so just set directly */ - lua_rawset(L,1); /* add direct */ - return 0; -} - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) -/* registering a module in lua. Pushes the module table on the stack. */ -SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name) -{ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushstring(L,name); - lua_newtable(L); /* the table */ - /* add meta table */ - lua_newtable(L); /* the meta table */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); - lua_pushstring(L,".get"); - lua_newtable(L); /* the .get table */ - lua_rawset(L,-3); /* add .get into metatable */ - lua_pushstring(L,".set"); - lua_newtable(L); /* the .set table */ - lua_rawset(L,-3); /* add .set into metatable */ - lua_setmetatable(L,-2); /* sets meta table in module */ -#ifdef SWIG_LUA_MODULE_GLOBAL - /* If requested, install the module directly into the global namespace. */ - lua_rawset(L,-3); /* add module into parent */ - SWIG_Lua_get_table(L,name); /* get the table back out */ -#else - /* Do not install the module table as global name. The stack top has - the module table with the name below. We pop the top and replace - the name with it. */ - lua_replace(L,-2); -#endif -} - -/* ending the register */ -SWIGINTERN void SWIG_Lua_module_end(lua_State* L) -{ - lua_pop(L,1); /* tidy stack (remove module) */ -} - -/* adding a linked variable to the module */ -SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) -{ - assert(lua_istable(L,-1)); /* just in case */ - lua_getmetatable(L,-1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) /* if there is a set fn */ - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } - lua_pop(L,1); /* tidy stack (remove meta) */ -} -#endif - -/* adding a function module */ -SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn) -{ - SWIG_Lua_add_function(L,name,fn); -} - -/* ----------------------------------------------------------------------------- - * global variable support code: namespaces - * ----------------------------------------------------------------------------- */ - -SWIGINTERN int SWIG_Lua_namespace_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute -*/ - assert(lua_istable(L,-2)); /* just in case */ - lua_getmetatable(L,-2); - assert(lua_istable(L,-1)); - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */ - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - return 0; -} - -SWIGINTERN int SWIG_Lua_namespace_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -*/ - - assert(lua_istable(L,1)); - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - return 0; -} - -SWIGINTERN void SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]); // forward declaration -SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn); // forward declaration - -/* helper function - register namespace methods and attributes into namespace */ -SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State* L, swig_lua_namespace* ns) -{ - int i = 0; - assert(lua_istable(L,-1)); - /* There must be table at the top of the stack */ - SWIG_Lua_InstallConstants(L, ns->ns_constants); - - lua_getmetatable(L,-1); - - /* add fns */ - for(i=0;ns->ns_attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod); - } - - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;ns->ns_methods[i].name;i++){ - SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].method); - } - lua_pop(L,1); - - /* clear stack - remove metatble */ - lua_pop(L,1); - -} - -/* helper function. creates namespace table and add it to module table */ -SWIGINTERN int SWIG_Lua_namespace_register(lua_State* L, swig_lua_namespace* ns) -{ - assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table */ - lua_checkstack(L,5); - lua_pushstring(L, ns->name); - lua_newtable(L); /* namespace itself */ - lua_newtable(L); /* metatable for namespace */ - - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - lua_rawset(L,-3); - - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set); - - lua_setmetatable(L,-2); /* set metatable */ - lua_rawset(L,-3); /* add namespace to module table */ -} -/* ----------------------------------------------------------------------------- - * global variable support code: classes - * ----------------------------------------------------------------------------- */ - -/* the class.get method, performs the lookup of class attributes */ -SWIGINTERN int SWIG_Lua_class_get(lua_State* L) -{ -/* there should be 2 params passed in - (1) userdata (not the meta table) - (2) string name of the attribute -*/ - assert(lua_isuserdata(L,-2)); /* just in case */ - lua_getmetatable(L,-2); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* NEW: looks for the __getitem() fn - this is a user provided get fn */ - SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; /* sorry not known */ -} - -/* the class.set method, performs the lookup of class attributes */ -SWIGINTERN int SWIG_Lua_class_set(lua_State* L) -{ -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value -printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2), - lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ - - assert(lua_isuserdata(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* userdata */ - lua_pushvalue(L,3); /* value */ - lua_call(L,2,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - /* NEW: looks for the __setitem() fn - this is a user provided set fn */ - SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_pushvalue(L,3); /* the value */ - lua_call(L,3,0); /* 3 values in ,0 out */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; -} - -/* the class.destruct method called by the interpreter */ -SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L) -{ -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - swig_lua_class* clss; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - /* if must be destroyed & has a destructor */ - if (usr->own) /* if must be destroyed */ - { - clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ - if (clss && clss->destructor) /* there is a destroy fn */ - { - clss->destructor(usr->ptr); /* bye bye */ - } - } - return 0; -} - -/* the class.__tostring method called by the interpreter and print */ -SWIGINTERN int SWIG_Lua_class_tostring(lua_State* L) -{ -/* there should be 1 param passed in - (1) userdata (not the metatable) */ - assert(lua_isuserdata(L,1)); /* just in case */ - unsigned long userData = (unsigned long)lua_touserdata(L,1); /* get the userdata address for later */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - lua_getfield(L, -1, ".type"); - const char* className = lua_tostring(L, -1); - - char output[256]; - sprintf(output, "<%s userdata: %lX>", className, userData); - - lua_pushstring(L, (const char*)output); - return 1; -} - -/* to manually disown some userdata */ -SWIGINTERN int SWIG_Lua_class_disown(lua_State* L) -{ -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - - usr->own = 0; /* clear our ownership */ - return 0; -} - -/* Constructor proxy. Used when class name entry in module is not class constructor, -but special table instead. */ -SWIGINTERN int SWIG_Lua_constructor_proxy(lua_State* L) -{ - /* unlimited number of parameters - First one is our proxy table and we should remove it - Other we should pass to real constructor - */ - assert(lua_istable(L,1)); - lua_pushstring(L,".constructor"); - lua_rawget(L,1); - assert(!lua_isnil(L,-1)); - lua_replace(L,1); /* replace our table with real constructor */ - lua_call(L,lua_gettop(L)-1,1); - return 1; -} - -/* gets the swig class registry (or creates it) */ -SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L) -{ - /* add this all into the swig registry: */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ - if (!lua_istable(L,-1)) /* not there */ - { /* must be first time, so add it */ - lua_pop(L,1); /* remove the result */ - lua_pushstring(L,"SWIG"); - lua_newtable(L); - lua_rawset(L,LUA_REGISTRYINDEX); - /* then get it */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); - } -} - -/* helper fn to get the classes metatable from the register */ -SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname) -{ - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,cname); /* get the name */ - lua_rawget(L,-2); /* get it */ - lua_remove(L,-2); /* tidy up (remove registry) */ -} - -/* helper add a variable to a registered class */ -SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) -{ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } -} - -/* helper to recursively add class static details (static attributes, operations and constants) */ -SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State* L, swig_lua_class* clss) -{ - int i = 0; - /* The class namespace table must be on the top of the stack */ - assert(lua_istable(L,-1)); - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_static_details(L,clss->bases[i]); - } - - SWIG_Lua_add_namespace_details(L, &clss->cls_static); -} - -/* helper to recursively add class details (attributes & operations) */ -SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss) -{ - int i; - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_details(L,clss->bases[i]); - } - /* add fns */ - for(i=0;clss->attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); - } - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;clss->methods[i].name;i++){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - lua_pop(L,1); /* tidy stack (remove table) */ - /* add operator overloads - these look ANY method which start with "__" and assume they - are operator overloads & add them to the metatable - (this might mess up is someone defines a method __gc (the destructor)*/ - for(i=0;clss->methods[i].name;i++){ - if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - } -} - -/* set up the base classes pointers. -Each class structure has a list of pointers to the base class structures. -This function fills them. -It cannot be done at compile time, as this will not work with hireachies -spread over more than one swig file. -Therefore it must be done at runtime, querying the SWIG type system. -*/ -SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) -{ - int i=0; - swig_module_info* module=SWIG_GetModule(L); - for(i=0;clss->base_names[i];i++) - { - if (clss->bases[i]==0) /* not found yet */ - { - /* lookup and cache the base class */ - swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); - if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; - } - } -} - -/* Register class static methods,attributes etc as well as constructor proxy */ -SWIGINTERN void SWIG_Lua_class_register_static(lua_State* L, swig_lua_class* clss) -{ - lua_checkstack(L,5); /* just in case */ - assert(lua_istable(L,-1)); /* just in case */ - assert(strcmp(clss->name, clss->cls_static.name) == 0); /* in class those 2 must be equal */ - - SWIG_Lua_namespace_register(L,&clss->cls_static); - - SWIG_Lua_get_table(L,clss->name); // Get namespace table back - assert(lua_istable(L,-1)); /* just in case */ - - /* add its constructor to module with the name of the class - so you can do MyClass(...) as well as new_MyClass(...) - BUT only if a constructor is defined - (this overcomes the problem of pure virtual classes without constructors)*/ - if (clss->constructor) - { - SWIG_Lua_add_function(L,".constructor", clss->constructor); - lua_getmetatable(L,-1); - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,"__call", SWIG_Lua_constructor_proxy); - lua_pop(L,1); - } - - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_class_static_details(L, clss); - - /* clear stack */ - lua_pop(L,1); -} - -/* performs the entire class registration process */ -SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) -{ - SWIG_Lua_class_register_static(L,clss); - - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,clss->name); /* get the name */ - lua_newtable(L); /* create the metatable */ - /* add string of class name called ".type" */ - lua_pushstring(L,".type"); - lua_pushstring(L,clss->name); - lua_rawset(L,-3); - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - /* add manual disown method */ - SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown); - lua_rawset(L,-3); - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); - SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); - /* add tostring method for better output */ - SWIG_Lua_add_function(L,"__tostring",SWIG_Lua_class_tostring); - /* add it */ - lua_rawset(L,-3); /* metatable into registry */ - lua_pop(L,1); /* tidy stack (remove registry) */ - - SWIG_Lua_get_class_metatable(L,clss->name); - SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ - lua_pop(L,1); /* tidy stack (remove class metatable) */ -} - -/* ----------------------------------------------------------------------------- - * Class/structure conversion fns - * ----------------------------------------------------------------------------- */ - -/* helper to add metatable to new lua object */ -SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type) -{ - if (type->clientdata) /* there is clientdata: so add the metatable */ - { - SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); - if (lua_istable(L,-1)) - { - lua_setmetatable(L,-2); - } - else - { - lua_pop(L,1); - } - } -} - -/* pushes a new object into the lua stack */ -SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own) -{ - swig_lua_userdata* usr; - if (!ptr){ - lua_pushnil(L); - return; - } - usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ - usr->ptr=ptr; /* set the ptr */ - usr->type=type; - usr->own=own; -#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ -#endif -} - -/* takes a object from the lua stack & converts it into an object of the correct type - (if possible) */ -SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags) -{ - swig_lua_userdata* usr; - swig_cast_info *cast; - if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ - usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ - if (usr) - { - if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ - { - usr->own=0; - } - if (!type) /* special cast void*, no casting fn */ - { - *ptr=usr->ptr; - return SWIG_OK; /* ok */ - } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) - { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ - } - } - return SWIG_ERROR; /* error */ -} - -SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags, - int argnum,const char* func_name){ - void* result; - if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ - luaL_error (L,"Error in %s, expected a %s at argument number %d\n", - func_name,(type && type->str)?type->str:"void*",argnum); - } - return result; -} - -/* pushes a packed userdata. user for member fn pointers only */ -SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - assert(ptr); /* not acceptable to pass in a NULL value */ - raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ - raw->type=type; - raw->own=0; - memcpy(raw->data,ptr,size); /* copy the data */ - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ -} - -/* converts a packed userdata. user for member fn pointers only */ -SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ - if (!raw) return SWIG_ERROR; /* error */ - if (type==0 || type==raw->type) /* void* or identical type */ - { - memcpy(ptr,raw->data,size); /* copy it */ - return SWIG_OK; /* ok */ - } - return SWIG_ERROR; /* error */ -} - -/* a function to get the typestring of a piece of data */ -SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) -{ - swig_lua_userdata* usr; - if (lua_isuserdata(L,tp)) - { - usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */ - if (usr && usr->type && usr->type->str) - return usr->type->str; - return "userdata (unknown type)"; - } - return lua_typename(L,lua_type(L,tp)); -} - -/* lua callable function to get the userdata's type */ -SWIGRUNTIME int SWIG_Lua_type(lua_State* L) -{ - lua_pushstring(L,SWIG_Lua_typename(L,1)); - return 1; -} - -/* lua callable function to compare userdata's value -the issue is that two userdata may point to the same thing -but to lua, they are different objects */ -SWIGRUNTIME int SWIG_Lua_equal(lua_State* L) -{ - int result; - swig_lua_userdata *usr1,*usr2; - if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ - return 0; /* nil reply */ - usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ - /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ - result=(usr1->ptr==usr2->ptr); - lua_pushboolean(L,result); - return 1; -} - -/* ----------------------------------------------------------------------------- - * global variable support code: class/struct typemap functions - * ----------------------------------------------------------------------------- */ - -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) -/* Install Constants */ -SWIGINTERN void -SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { - int i; - for (i = 0; constants[i].type; i++) { - switch(constants[i].type) { - case SWIG_LUA_INT: - lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].lvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_FLOAT: - lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].dvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_CHAR: - lua_pushstring(L,constants[i].name); - lua_pushfstring(L,"%c",(char)constants[i].lvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_STRING: - lua_pushstring(L,constants[i].name); - lua_pushstring(L,(char *) constants[i].pvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_POINTER: - lua_pushstring(L,constants[i].name); - SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0); - lua_rawset(L,-3); - break; - case SWIG_LUA_BINARY: - lua_pushstring(L,constants[i].name); - SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); - lua_rawset(L,-3); - break; - default: - break; - } - } -} -#endif - -/* ----------------------------------------------------------------------------- - * executing lua code from within the wrapper - * ----------------------------------------------------------------------------- */ - -#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ -#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) -#endif -/* Executes a C string in Lua which is a really simple way of calling lua from C -Unfortunately lua keeps changing its APIs, so we need a conditional compile -In lua 5.0.X its lua_dostring() -In lua 5.1.X its luaL_dostring() -*/ -SWIGINTERN int -SWIG_Lua_dostring(lua_State *L, const char* str) { - int ok,top; - if (str==0 || str[0]==0) return 0; /* nothing to do */ - top=lua_gettop(L); /* save stack */ -#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) - ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ -#else - ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ -#endif - if (ok!=0) { - SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); - } - lua_settop(L,top); /* restore the stack */ - return ok; -} - -#ifdef __cplusplus -} -#endif - -/* ------------------------------ end luarun.swg ------------------------------ */
diff --git a/share/swig/2.0.11/ocaml/std_common.i b/share/swig/2.0.11/ocaml/std_common.i deleted file mode 100644 index 1c39705..0000000 --- a/share/swig/2.0.11/ocaml/std_common.i +++ /dev/null
@@ -1,19 +0,0 @@ -/* ----------------------------------------------------------------------------- - * std_common.i - * - * SWIG typemaps for STL - common utilities - * ----------------------------------------------------------------------------- */ - -%include <std/std_except.i> - -%apply size_t { std::size_t }; - -%{ -#include <string> - CAML_VALUE SwigString_FromString(const std::string& s) { - return caml_val_string((char *)s.c_str()); - } - std::string SwigString_AsString(CAML_VALUE o) { - return std::string((char *)caml_ptr_val(o,0)); - } -%}
diff --git a/share/swig/2.0.11/octave/exception.i b/share/swig/2.0.11/octave/exception.i deleted file mode 100644 index bb0b15c..0000000 --- a/share/swig/2.0.11/octave/exception.i +++ /dev/null
@@ -1,6 +0,0 @@ -%include <typemaps/exception.swg> - - -%insert("runtime") { - %define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; )) -}
diff --git a/share/swig/2.0.11/octave/octruntime.swg b/share/swig/2.0.11/octave/octruntime.swg deleted file mode 100644 index 43313c3..0000000 --- a/share/swig/2.0.11/octave/octruntime.swg +++ /dev/null
@@ -1,323 +0,0 @@ -%insert(runtime) %{ -#include <cstdlib> -#include <iostream> -#include <octave/oct.h> -#include <octave/Cell.h> -#include <octave/dynamic-ld.h> -#include <octave/oct-env.h> -#include <octave/oct-map.h> -#include <octave/ov-fcn-handle.h> -#include <octave/parse.h> -#include <octave/toplev.h> -#include <octave/unwind-prot.h> -%} - -%insert(runtime) "swigrun.swg"; -%insert(runtime) "swigerrors.swg"; -%insert(runtime) "octrun.swg"; - -%insert(initbeforefunc) "swiginit.swg" - -%insert(initbeforefunc) %{ - -static bool SWIG_init_user(octave_swig_type* module_ns); - -SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { - bool retn; - { -#if OCTAVE_API_VERSION_NUMBER < 38 - unwind_protect::begin_frame("SWIG_Octave_LoadModule"); - unwind_protect_int(error_state); - unwind_protect_int(warning_state); - unwind_protect_bool(discard_error_messages); - unwind_protect_bool(discard_warning_messages); -#else - unwind_protect frame; - frame.protect_var(error_state); - frame.protect_var(warning_state); - frame.protect_var(discard_error_messages); - frame.protect_var(discard_warning_messages); -#endif - error_state = 0; - warning_state = 0; - discard_error_messages = true; - discard_warning_messages = true; - feval(name, octave_value_list(), 0); - retn = (error_state == 0); -#if OCTAVE_API_VERSION_NUMBER < 38 - unwind_protect::run_frame("SWIG_Octave_LoadModule"); -#endif - } - if (!retn) { - error(SWIG_name_d ": could not load module `%s'", name.c_str()); - } - return retn; -} - -SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) { - bool retn; - { -#if OCTAVE_API_VERSION_NUMBER < 38 - unwind_protect::begin_frame("SWIG_Octave_InstallFunction"); - unwind_protect_int(error_state); - unwind_protect_int(warning_state); - unwind_protect_bool(discard_error_messages); - unwind_protect_bool(discard_warning_messages); -#else - unwind_protect frame; - frame.protect_var(error_state); - frame.protect_var(warning_state); - frame.protect_var(discard_error_messages); - frame.protect_var(discard_warning_messages); -#endif - error_state = 0; - warning_state = 0; - discard_error_messages = true; - discard_warning_messages = true; - octave_value_list args; - args.append(name); - args.append(octloadfcn->fcn_file_name()); - error_state = 0; - feval("autoload", args, 0); - retn = (error_state == 0); -#if OCTAVE_API_VERSION_NUMBER < 38 - unwind_protect::run_frame("SWIG_Octave_InstallFunction"); -#endif - } - if (!retn) { - error(SWIG_name_d ": could not load function `%s'", name.c_str()); - } - return retn; -} - -static const char *const subclass_usage = "-*- texinfo -*- \n\ -@deftypefn {Loadable Function} {} subclass()\n\ -@deftypefnx{Loadable Function} {} subclass(@var{swigclass}, @var{name}, @var{fcn}, @dots{})\n\ -Subclass a C++ class from within Octave, and provide implementations of its virtual methods.\n\ -\n\ -See the SWIG manual for usage examples.\n\ -@end deftypefn"; - -DEFUN_DLD( subclass, args, nargout, subclass_usage ) { - octave_swig_type *top = new octave_swig_type; - for (int j = 0; j < args.length(); ++j) { - if (args(j).type_id() == octave_swig_ref::static_type_id()) { - octave_swig_ref *osr = static_cast < octave_swig_ref *>(args(j).internal_rep()); - octave_swig_type *ost = osr->get_ptr(); - if (!ost->is_owned()) { - error("subclass: cannot subclass object not constructed on octave side"); - return octave_value_list(); - } - top->merge(*ost); - } else if (args(j).is_function_handle()) { - top->assign(args(j).fcn_handle_value()->fcn_name(), args(j)); - } else if (args(j).is_string()) { - if (j + 1 >= args.length()) { - error("subclass: member assignments must be of string,value form"); - return octave_value_list(); - } - top->assign(args(j).string_value(), args(j + 1)); - ++j; - } else { - error("subclass: invalid arguments to subclass()"); - return octave_value_list(); - } - } - return octave_value(Swig::swig_value_ref(top)); -} - -static const char *const swig_type_usage = "-*- texinfo -*- \n\ -@deftypefn {Loadable Function} {} swig_type(@var{swigref})\n\ -Return the underlying C/C++ type name of a SWIG-wrapped object.\n\ -@end deftypefn"; - -DEFUN_DLD( swig_type, args, nargout, swig_type_usage ) { - if (args.length() != 1) { - error("swig_type: must be called with only a single object"); - return octave_value_list(); - } - octave_swig_type *ost = Swig::swig_value_deref(args(0)); - if (!ost) { - error("swig_type: object is not a swig_ref"); - return octave_value_list(); - } - return octave_value(ost->swig_type_name()); -} - -static const char *const swig_typequery_usage = "-*- texinfo -*- \n\ -@deftypefn {Loadable Function} {} swig_typequery(@var{string})\n\ -Return @var{string} if it is a recognised SWIG-wrapped C/C++ type name;\n\ -otherwise return `<unknown>'.\n\ -@end deftypefn"; - -DEFUN_DLD( swig_typequery, args, nargout, swig_typequery_usage ) { - if (args.length() != 1 || !args(0).is_string()) { - error("swig_typequery: must be called with single string argument"); - return octave_value_list(); - } - swig_module_info *module = SWIG_GetModule(0); - swig_type_info *type = SWIG_TypeQueryModule(module, module, args(0).string_value().c_str()); - if (!type) - return octave_value("<unknown>"); - return octave_value(type->name); -} - -static const char *const swig_this_usage = "-*- texinfo -*- \n\ -@deftypefn {Loadable Function} {} swig_this(@var{swigref})\n\ -Return the underlying C/C++ pointer of a SWIG-wrapped object.\n\ -@end deftypefn"; - -DEFUN_DLD( swig_this, args, nargout, swig_this_usage ) { - if (args.length() != 1) { - error("swig_this: must be called with only a single object"); - return octave_value_list(); - } - if (args(0).is_matrix_type() && args(0).rows() == 0 && args(0).columns() == 0) - return octave_value(octave_uint64(0)); - octave_swig_type *ost = Swig::swig_value_deref(args(0)); - if (!ost) { - error("swig_this: object is not a swig_ref"); - return octave_value_list(); - } - return octave_value(octave_uint64((unsigned long long) ost->swig_this())); -} - -static const char *const SWIG_name_usage = "-*- texinfo -*- \n\ -@deftypefn {Loadable Module} {} " SWIG_name_d "\n\ -Loads the SWIG-generated module `" SWIG_name_d "'.\n\ -@end deftypefn"; - -DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { - - static octave_swig_type* module_ns = 0; - - // workaround to prevent octave seg-faulting on exit: set Octave exit function - // octave_exit to _Exit, which exits immediately without trying to cleanup memory. - // definitely affects version 3.2.*, not sure about 3.3.*, seems to be fixed in - // version 3.4.* and above. can be turned off with macro definition. -#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK -#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45 - octave_exit = ::_Exit; -#endif -#endif - - // check for no input and output args - if (args.length() != 0 || nargout != 0) { - print_usage(); - return octave_value_list(); - } - - // create module on first function call - if (!module_ns) { - - // workaround bug in octave where installing global variable of custom type and then - // exiting without explicitly clearing the variable causes octave to segfault. -#if OCTAVE_API_VERSION_NUMBER > 36 - octave_value_list eval_args; - eval_args.append("base"); - eval_args.append("function __swig_atexit__; " - " if mislocked() " - " clear -all; " - " else " - " mlock(); " - " endif; " - "endfunction; " - "__swig_atexit__; " - "atexit(\"__swig_atexit__\", false); " - "atexit(\"__swig_atexit__\")"); - feval("evalin", eval_args, 0); -#endif - - octave_swig_ref::register_type(); - octave_swig_packed::register_type(); - SWIG_InitializeModule(0); - SWIG_PropagateClientData(); - - octave_function *me = octave_call_stack::current(); - - if (!SWIG_Octave_InstallFunction(me, "swig_type")) { - return octave_value_list(); - } - if (!SWIG_Octave_InstallFunction(me, "swig_typequery")) { - return octave_value_list(); - } - if (!SWIG_Octave_InstallFunction(me, "swig_this")) { - return octave_value_list(); - } - if (!SWIG_Octave_InstallFunction(me, "subclass")) { - return octave_value_list(); - } - - octave_swig_type* cvar_ns=0; - if (std::string(SWIG_global_name) != ".") { - cvar_ns=new octave_swig_type; - for (int j=0;swig_globals[j].name;++j) - if (swig_globals[j].get_method) - cvar_ns->assign(swig_globals[j].name,&swig_globals[j]); - } - - module_ns=new octave_swig_type(0, 0, 0, true); - if (std::string(SWIG_global_name) != ".") { - module_ns->assign(SWIG_global_name,Swig::swig_value_ref(cvar_ns)); - } - else { - for (int j=0;swig_globals[j].name;++j) - if (swig_globals[j].get_method) - module_ns->assign(swig_globals[j].name,&swig_globals[j]); - } - for (int j=0;swig_globals[j].name;++j) - if (swig_globals[j].method) - module_ns->assign(swig_globals[j].name,&swig_globals[j]); - - // * need better solution here; swig_type -> octave_class mapping is - // * really n-to-1, in some cases such as template partial spec, etc. - // * see failing tests. - for (int j=0;swig_types[j];++j) - if (swig_types[j]->clientdata) { - swig_octave_class* c=(swig_octave_class*)swig_types[j]->clientdata; - module_ns->assign(c->name, - Swig::swig_value_ref - (new octave_swig_type(0,swig_types[j]))); - } - - if (!SWIG_init_user(module_ns)) { - delete module_ns; - module_ns=0; - return octave_value_list(); - } - - SWIG_InstallOps(octave_swig_ref::static_type_id()); - - octave_swig_type::swig_member_const_iterator mb; - for (mb = module_ns->swig_members_begin(); mb != module_ns->swig_members_end(); ++mb) { - if (mb->second.first && mb->second.first->method) { - if (!SWIG_Octave_InstallFunction(me, mb->first)) { - return octave_value_list(); - } - } - } - -#if OCTAVE_API_VERSION_NUMBER < 37 - mlock(me->name()); -#else - mlock(); -#endif - - } - - octave_swig_type::swig_member_const_iterator mb; - for (mb = module_ns->swig_members_begin(); mb != module_ns->swig_members_end(); ++mb) { - if (mb->second.second.is_defined()) { - SWIG_Octave_SetGlobalValue(mb->first, mb->second.second); - SWIG_Octave_LinkGlobalValue(mb->first); - } - } - - SWIG_Octave_SetGlobalValue(SWIG_name_d, module_ns->as_value()); - SWIG_Octave_LinkGlobalValue(SWIG_name_d); - - return octave_value_list(); - -} - -%}
diff --git a/share/swig/2.0.11/octave/std_carray.i b/share/swig/2.0.11/octave/std_carray.i deleted file mode 100644 index 9e2338a..0000000 --- a/share/swig/2.0.11/octave/std_carray.i +++ /dev/null
@@ -1,56 +0,0 @@ -%include <pycontainer.swg> - -/* -%fragment("StdCarrayTraits","header",fragment="StdSequenceTraits") -{ -namespace swig { - template <class T, size_t S> - struct traits_asptr<std::carray<T, S> > { - static int asptr(PyObject *obj, std::carray<T, S> **array) { - return traits_asptr_stdseq<std::carray<T, S> >::asptr(obj, array); - } - }; -} -} - -%warnfilter(SWIGWARN_IGNORE_OPERATOR_INDEX) std::carray::operator[]; - -%extend std::carray { - %fragment(SWIG_Traits_frag(std::carray<_Type, _Size >), "header", - fragment="SwigPyIterator_T", - fragment=SWIG_Traits_frag(_Type), - fragment="StdCarrayTraits") { - namespace swig { - template <> struct traits<std::carray<_Type, _Size > > { - typedef pointer_category category; - static const char* type_name() { - return "std::carray<" #_Type "," #_Size " >"; - } - }; - } - } - - %typemaps_asptr(SWIG_TYPECHECK_VECTOR, swig::asptr, - SWIG_Traits_frag(std::carray<_Type, _Size >), - std::carray<_Type, _Size >); - - %typemap(out,noblock=1) iterator, const_iterator { - $result = SWIG_NewPointerObj(swig::make_output_iterator((const $type &)$1), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - } - - inline size_t __len__() const { return self->size(); } - - inline const _Type& __getitem__(size_t i) const { return (*self)[i]; } - - inline void __setitem__(size_t i, const _Type& v) { (*self)[i] = v; } - - - swig::SwigPyIterator* __iter__(PyObject **PYTHON_SELF) { - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -} - -%include <std/std_carray.swg> -*/ -
diff --git a/share/swig/2.0.11/php/director.swg b/share/swig/2.0.11/php/director.swg deleted file mode 100644 index 90f6a74..0000000 --- a/share/swig/2.0.11/php/director.swg +++ /dev/null
@@ -1,197 +0,0 @@ -/* ----------------------------------------------------------------------------- - * director.swg - * - * This file contains support for director classes that proxy - * method calls from C++ to PHP extensions. - * ----------------------------------------------------------------------------- */ - -#ifndef SWIG_DIRECTOR_PHP_HEADER_ -#define SWIG_DIRECTOR_PHP_HEADER_ - -#ifdef __cplusplus - -#include <string> -#include <map> - -/* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif - -namespace Swig { - /* memory handler */ - struct GCItem - { - virtual ~GCItem() {} - - virtual int get_own() const - { - return 0; - } - }; - - struct GCItem_var - { - GCItem_var(GCItem *item = 0) : _item(item) - { - } - - GCItem_var& operator=(GCItem *item) - { - GCItem *tmp = _item; - _item = item; - delete tmp; - return *this; - } - - ~GCItem_var() - { - delete _item; - } - - GCItem * operator->() const - { - return _item; - } - - private: - GCItem *_item; - }; - - struct GCItem_Object : GCItem - { - GCItem_Object(int own) : _own(own) - { - } - - virtual ~GCItem_Object() - { - } - - int get_own() const - { - return _own; - } - - private: - int _own; - }; - - template <typename Type> - struct GCItem_T : GCItem - { - GCItem_T(Type *ptr) : _ptr(ptr) - { - } - - virtual ~GCItem_T() - { - delete _ptr; - } - - private: - Type *_ptr; - }; - - class Director { - protected: - zval *swig_self; - typedef std::map<void*, GCItem_var> swig_ownership_map; - mutable swig_ownership_map swig_owner; -#ifdef ZTS - // Store the ZTS context so it's available when C++ calls back to PHP. - void *** swig_zts_ctx; -#endif - public: - Director(zval* self TSRMLS_DC) : swig_self(self) { - TSRMLS_SET_CTX(swig_zts_ctx); - } - - bool swig_is_overridden_method(char *cname, char *lc_fname) { - TSRMLS_FETCH_FROM_CTX(swig_zts_ctx); - zend_class_entry **ce; - zend_function *mptr; - int name_len = strlen(lc_fname); - - if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) { - return false; - } - if (zend_hash_find(&(*ce)->function_table, lc_fname, name_len + 1, (void**) &mptr) != SUCCESS) { - return false; - } - // common.scope points to the declaring class - return strcmp(mptr->common.scope->name, cname); - } - - template <typename Type> - void swig_acquire_ownership(Type *vptr) const - { - if (vptr) { - swig_owner[vptr] = new GCItem_T<Type>(vptr); - } - } - }; - - /* base class for director exceptions */ - class DirectorException { - protected: - std::string swig_msg; - public: - DirectorException(int code, const char *hdr, const char* msg TSRMLS_DC) - : swig_msg(hdr) - { - if (strlen(msg)) { - swig_msg += " "; - swig_msg += msg; - } - SWIG_ErrorCode() = code; - SWIG_ErrorMsg() = swig_msg.c_str(); - } - - static void raise(int code, const char *hdr, const char* msg TSRMLS_DC) - { - throw DirectorException(code, hdr, msg TSRMLS_CC); - } - }; - - /* attempt to call a pure virtual method via a director method */ - class DirectorPureVirtualException : public Swig::DirectorException - { - public: - DirectorPureVirtualException(const char* msg TSRMLS_DC) - : DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC) - { - } - - static void raise(const char *msg TSRMLS_DC) - { - throw DirectorPureVirtualException(msg TSRMLS_CC); - } - }; - /* any php exception that occurs during a director method call */ - class DirectorMethodException : public Swig::DirectorException - { - public: - DirectorMethodException(const char* msg TSRMLS_DC) - : DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC) - { - } - - static void raise(const char *msg TSRMLS_DC) - { - throw DirectorMethodException(msg TSRMLS_CC); - } - }; -} - -// DirectorMethodException() is documented to be callable with no parameters -// so use a macro to insert TSRMLS_CC so any ZTS context gets passed. -#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC) - -#endif /* __cplusplus */ - -#endif
diff --git a/share/swig/2.0.11/php/phpkw.swg b/share/swig/2.0.11/php/phpkw.swg deleted file mode 100644 index c557669..0000000 --- a/share/swig/2.0.11/php/phpkw.swg +++ /dev/null
@@ -1,616 +0,0 @@ -/* ----------------------------------------------------------------------------- - * phpkw.swg - * ----------------------------------------------------------------------------- */ - -#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x` - -#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, class renamed as 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x` - -#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP",sourcefmt="%(lower)s") `x` -#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in PHP") "::" `x` -#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renamed as 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x` - -/* - From - - http://aspn.activestate.com/ASPN/docs/PHP/reserved.html - http://php.net/manual/en/reserved.keywords.php - - and reviewed by Olly Betts. - - Further updates from the PHP manual on php.net. -*/ - -/* We classify these as kw since PHP will not run if used globally. */ -/* "You cannot use any of the following words as constants, class names, - * function or method names. Using them as variable names is generally OK, but - * could lead to confusion." - */ -/* case insensitive */ -PHPKW(__halt_compiler); -PHPKW(abstract); -PHPKW(and); -PHPKW(array); -PHPKW(as); -PHPKW(break); -PHPKW(case); -PHPKW(catch); -PHPKW(class); -PHPKW(clone); -PHPKW(const); -PHPKW(continue); -PHPKW(declare); -PHPKW(default); -PHPKW(die); // "Language construct" -PHPKW(do); -PHPKW(echo); // "Language construct" -PHPKW(else); -PHPKW(elseif); -PHPKW(empty); // "Language construct" -PHPKW(enddeclare); -PHPKW(endfor); -PHPKW(endforeach); -PHPKW(endif); -PHPKW(endswitch); -PHPKW(endwhile); -PHPKW(eval); // "Language construct" -PHPKW(exit); // "Language construct" -PHPKW(extends); -PHPKW(final); -PHPKW(for); -PHPKW(foreach); -PHPKW(function); -PHPKW(global); -PHPKW(goto); // As of PHP5.3 -PHPKW(if); -PHPKW(implements); -PHPKW(include); // "Language construct" -PHPKW(include_once); // "Language construct" -PHPKW(instanceof); -PHPKW(interface); -PHPKW(isset); // "Language construct" -PHPKW(list); // "Language construct" -PHPKW(namespace); // As of PHP5.3 -PHPKW(new); -PHPKW(or); -PHPKW(print); // "Language construct" -PHPKW(private); -PHPKW(protected); -PHPKW(public); -PHPKW(require); // "Language construct" -PHPKW(require_once); // "Language construct" -PHPKW(return); // "Language construct" -PHPKW(static); -PHPKW(switch); -PHPKW(throw); -PHPKW(try); -PHPKW(unset); // "Language construct" -PHPKW(use); -PHPKW(var); -PHPKW(while); -PHPKW(xor); -// Compile-time constants -PHPKW(__CLASS__); -PHPKW(__DIR__); // As of PHP5.3 -PHPKW(__FILE__); -PHPKW(__FUNCTION__); -PHPKW(__METHOD__); -PHPKW(__NAMESPACE__); // As of PHP5.3 -PHPKW(__LINE__); - -/* We classify these as built-in names since they conflict, but PHP still runs */ - -/* Type 1: case insensitive */ -PHPBN1(__sleep); -PHPBN1(__wakeup); -PHPBN1(not); -PHPBN1(parent); -PHPBN1(virtual); -PHPBN1(NULL); -PHPBN1(TRUE); -PHPBN1(FALSE); - -/* Type 2: case sensitive */ -/* "Core Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */ -PHPBN2(E_ALL); -PHPBN2(E_ERROR); -PHPBN2(E_PARSE); -PHPBN2(E_WARNING); -PHPBN2(E_NOTICE); -PHPBN2(E_CORE_ERROR); -PHPBN2(E_CORE_WARNING); -PHPBN2(E_COMPILE_ERROR); -PHPBN2(E_COMPILE_WARNING); -PHPBN2(E_USER_ERROR); -PHPBN2(E_USER_WARNING); -PHPBN2(E_USER_NOTICE); -PHPBN2(E_DEPRECATED); // As of PHP 5.3 -PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3 -PHPBN2(PHP_OS); -PHPBN2(PHP_VERSION); -PHPBN2(PHP_SAPI); -PHPBN2(PHP_EOL); -PHPBN2(PHP_INT_MAX); -PHPBN2(PHP_INT_SIZE); -PHPBN2(DEFAULT_INCLUDE_PATH); -PHPBN2(PEAR_INSTALL_DIR); -PHPBN2(PEAR_EXTENSION_DIR); -PHPBN2(PHP_EXTENSION_DIR); -PHPBN2(PHP_PREFIX); -PHPBN2(PHP_BINDIR); -PHPBN2(PHP_LIBDIR); -PHPBN2(PHP_DATADIR); -PHPBN2(PHP_SYSCONFDIR); -PHPBN2(PHP_LOCALSTATEDIR); -PHPBN2(PHP_CONFIG_FILE_PATH); -PHPBN2(PHP_CONFIG_FILE_SCAN_DIR); -PHPBN2(PHP_SHLIB_SUFFIX); -PHPBN2(PHP_OUTPUT_HANDLER_START); -PHPBN2(PHP_OUTPUT_HANDLER_CONT); -PHPBN2(PHP_OUTPUT_HANDLER_END); -PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3 -/* These don't actually seem to be set (tested on Linux, I guess they're - * Windows only?) */ -PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_NT_SERVER); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_NT_WORKSTATION); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_BUILD); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_MAJOR); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_MINOR); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_PLATFORM); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3 -PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3 -/* "Standard Predefined Constants" from http://uk2.php.net/manual/en/reserved.constants.php */ -PHPBN2(EXTR_OVERWRITE); -PHPBN2(EXTR_SKIP); -PHPBN2(EXTR_PREFIX_SAME); -PHPBN2(EXTR_PREFIX_ALL); -PHPBN2(EXTR_PREFIX_INVALID); -PHPBN2(EXTR_PREFIX_IF_EXISTS); -PHPBN2(EXTR_IF_EXISTS); -PHPBN2(SORT_ASC); -PHPBN2(SORT_DESC); -PHPBN2(SORT_REGULAR); -PHPBN2(SORT_NUMERIC); -PHPBN2(SORT_STRING); -PHPBN2(CASE_LOWER); -PHPBN2(CASE_UPPER); -PHPBN2(COUNT_NORMAL); -PHPBN2(COUNT_RECURSIVE); -PHPBN2(ASSERT_ACTIVE); -PHPBN2(ASSERT_CALLBACK); -PHPBN2(ASSERT_BAIL); -PHPBN2(ASSERT_WARNING); -PHPBN2(ASSERT_QUIET_EVAL); -PHPBN2(CONNECTION_ABORTED); -PHPBN2(CONNECTION_NORMAL); -PHPBN2(CONNECTION_TIMEOUT); -PHPBN2(INI_USER); -PHPBN2(INI_PERDIR); -PHPBN2(INI_SYSTEM); -PHPBN2(INI_ALL); -PHPBN2(INI_SCANNER_NORMAL); // As of PHP 5.3 -PHPBN2(INI_SCANNER_RAW); // As of PHP 5.3 -PHPBN2(M_E); -PHPBN2(M_LOG2E); -PHPBN2(M_LOG10E); -PHPBN2(M_LN2); -PHPBN2(M_LN10); -PHPBN2(M_PI); -PHPBN2(M_PI_2); -PHPBN2(M_PI_4); -PHPBN2(M_1_PI); -PHPBN2(M_2_PI); -PHPBN2(M_2_SQRTPI); -PHPBN2(M_SQRT2); -PHPBN2(M_SQRT1_2); -PHPBN2(M_EULER); // As of PHP 5.2 -PHPBN2(M_LNPI); // As of PHP 5.2 -PHPBN2(M_SQRT3); // As of PHP 5.2 -PHPBN2(M_SQRTPI); // As of PHP 5.2 -PHPBN2(CRYPT_SALT_LENGTH); -PHPBN2(CRYPT_STD_DES); -PHPBN2(CRYPT_EXT_DES); -PHPBN2(CRYPT_MD5); -PHPBN2(CRYPT_BLOWFISH); -PHPBN2(DIRECTORY_SEPARATOR); -PHPBN2(SEEK_SET); -PHPBN2(SEEK_CUR); -PHPBN2(SEEK_END); -PHPBN2(LOCK_SH); -PHPBN2(LOCK_EX); -PHPBN2(LOCK_UN); -PHPBN2(LOCK_NB); -PHPBN2(HTML_SPECIALCHARS); -PHPBN2(HTML_ENTITIES); -PHPBN2(ENT_COMPAT); -PHPBN2(ENT_QUOTES); -PHPBN2(ENT_NOQUOTES); -PHPBN2(INFO_GENERAL); -PHPBN2(INFO_CREDITS); -PHPBN2(INFO_CONFIGURATION); -PHPBN2(INFO_MODULES); -PHPBN2(INFO_ENVIRONMENT); -PHPBN2(INFO_VARIABLES); -PHPBN2(INFO_LICENSE); -PHPBN2(INFO_ALL); -PHPBN2(CREDITS_GROUP); -PHPBN2(CREDITS_GENERAL); -PHPBN2(CREDITS_SAPI); -PHPBN2(CREDITS_MODULES); -PHPBN2(CREDITS_DOCS); -PHPBN2(CREDITS_FULLPAGE); -PHPBN2(CREDITS_QA); -PHPBN2(CREDITS_ALL); -PHPBN2(STR_PAD_LEFT); -PHPBN2(STR_PAD_RIGHT); -PHPBN2(STR_PAD_BOTH); -PHPBN2(PATHINFO_DIRNAME); -PHPBN2(PATHINFO_BASENAME); -PHPBN2(PATHINFO_EXTENSION); -PHPBN2(PATHINFO_FILENAME); // As of PHP 5.2 -PHPBN2(PATH_SEPARATOR); -PHPBN2(CHAR_MAX); -PHPBN2(LC_CTYPE); -PHPBN2(LC_NUMERIC); -PHPBN2(LC_TIME); -PHPBN2(LC_COLLATE); -PHPBN2(LC_MONETARY); -PHPBN2(LC_ALL); -PHPBN2(LC_MESSAGES); -PHPBN2(ABDAY_1); -PHPBN2(ABDAY_2); -PHPBN2(ABDAY_3); -PHPBN2(ABDAY_4); -PHPBN2(ABDAY_5); -PHPBN2(ABDAY_6); -PHPBN2(ABDAY_7); -PHPBN2(DAY_1); -PHPBN2(DAY_2); -PHPBN2(DAY_3); -PHPBN2(DAY_4); -PHPBN2(DAY_5); -PHPBN2(DAY_6); -PHPBN2(DAY_7); -PHPBN2(ABMON_1); -PHPBN2(ABMON_2); -PHPBN2(ABMON_3); -PHPBN2(ABMON_4); -PHPBN2(ABMON_5); -PHPBN2(ABMON_6); -PHPBN2(ABMON_7); -PHPBN2(ABMON_8); -PHPBN2(ABMON_9); -PHPBN2(ABMON_10); -PHPBN2(ABMON_11); -PHPBN2(ABMON_12); -PHPBN2(MON_1); -PHPBN2(MON_2); -PHPBN2(MON_3); -PHPBN2(MON_4); -PHPBN2(MON_5); -PHPBN2(MON_6); -PHPBN2(MON_7); -PHPBN2(MON_8); -PHPBN2(MON_9); -PHPBN2(MON_10); -PHPBN2(MON_11); -PHPBN2(MON_12); -PHPBN2(AM_STR); -PHPBN2(PM_STR); -PHPBN2(D_T_FMT); -PHPBN2(D_FMT); -PHPBN2(T_FMT); -PHPBN2(T_FMT_AMPM); -PHPBN2(ERA); -PHPBN2(ERA_YEAR); -PHPBN2(ERA_D_T_FMT); -PHPBN2(ERA_D_FMT); -PHPBN2(ERA_T_FMT); -PHPBN2(ALT_DIGITS); -PHPBN2(INT_CURR_SYMBOL); -PHPBN2(CURRENCY_SYMBOL); -PHPBN2(CRNCYSTR); -PHPBN2(MON_DECIMAL_POINT); -PHPBN2(MON_THOUSANDS_SEP); -PHPBN2(MON_GROUPING); -PHPBN2(POSITIVE_SIGN); -PHPBN2(NEGATIVE_SIGN); -PHPBN2(INT_FRAC_DIGITS); -PHPBN2(FRAC_DIGITS); -PHPBN2(P_CS_PRECEDES); -PHPBN2(P_SEP_BY_SPACE); -PHPBN2(N_CS_PRECEDES); -PHPBN2(N_SEP_BY_SPACE); -PHPBN2(P_SIGN_POSN); -PHPBN2(N_SIGN_POSN); -PHPBN2(DECIMAL_POINT); -PHPBN2(RADIXCHAR); -PHPBN2(THOUSANDS_SEP); -PHPBN2(THOUSEP); -PHPBN2(GROUPING); -PHPBN2(YESEXPR); -PHPBN2(NOEXPR); -PHPBN2(YESSTR); -PHPBN2(NOSTR); -PHPBN2(CODESET); -PHPBN2(LOG_EMERG); -PHPBN2(LOG_ALERT); -PHPBN2(LOG_CRIT); -PHPBN2(LOG_ERR); -PHPBN2(LOG_WARNING); -PHPBN2(LOG_NOTICE); -PHPBN2(LOG_INFO); -PHPBN2(LOG_DEBUG); -PHPBN2(LOG_KERN); -PHPBN2(LOG_USER); -PHPBN2(LOG_MAIL); -PHPBN2(LOG_DAEMON); -PHPBN2(LOG_AUTH); -PHPBN2(LOG_SYSLOG); -PHPBN2(LOG_LPR); -PHPBN2(LOG_NEWS); -PHPBN2(LOG_UUCP); -PHPBN2(LOG_CRON); -PHPBN2(LOG_AUTHPRIV); -PHPBN2(LOG_LOCAL0); -PHPBN2(LOG_LOCAL1); -PHPBN2(LOG_LOCAL2); -PHPBN2(LOG_LOCAL3); -PHPBN2(LOG_LOCAL4); -PHPBN2(LOG_LOCAL5); -PHPBN2(LOG_LOCAL6); -PHPBN2(LOG_LOCAL7); -PHPBN2(LOG_PID); -PHPBN2(LOG_CONS); -PHPBN2(LOG_ODELAY); -PHPBN2(LOG_NDELAY); -PHPBN2(LOG_NOWAIT); -PHPBN2(LOG_PERROR); - -/* Added in PHP5 */ -PHPBN2(E_STRICT); -PHPBN2(__COMPILER_HALT_OFFSET__); - -/* Added in PHP 5.2 */ -PHPBN2(PREG_BACKTRACK_LIMIT_ERROR); -PHPBN2(PREG_BAD_UTF8_ERROR); -PHPBN2(PREG_INTERNAL_ERROR); -PHPBN2(PREG_NO_ERROR); -PHPBN2(PREG_RECURSION_LIMIT_ERROR); -PHPBN2(UPLOAD_ERR_EXTENSION); -PHPBN2(STREAM_SHUT_RD); -PHPBN2(STREAM_SHUT_WR); -PHPBN2(STREAM_SHUT_RDWR); -PHPBN2(CURLE_FILESIZE_EXCEEDED); -PHPBN2(CURLE_FTP_SSL_FAILED); -PHPBN2(CURLE_LDAP_INVALID_URL); -PHPBN2(CURLFTPAUTH_DEFAULT); -PHPBN2(CURLFTPAUTH_SSL); -PHPBN2(CURLFTPAUTH_TLS); -PHPBN2(CURLFTPSSL_ALL); -PHPBN2(CURLFTPSSL_CONTROL); -PHPBN2(CURLFTPSSL_NONE); -PHPBN2(CURLFTPSSL_TRY); -PHPBN2(CURLOPT_FTP_SSL); -PHPBN2(CURLOPT_FTPSSLAUTH); -PHPBN2(CURLOPT_TCP_NODELAY); // Added in PHP 5.2.1 -PHPBN2(CURLOPT_TIMEOUT_MS); // Added in PHP 5.2.3 -PHPBN2(CURLOPT_CONNECTTIMEOUT_MS); // Added in PHP 5.2.3 -PHPBN2(GMP_VERSION); // Added in PHP 5.2.2 -PHPBN2(SWFTEXTFIELD_USEFONT); -PHPBN2(SWFTEXTFIELD_AUTOSIZE); -PHPBN2(SWF_SOUND_NOT_COMPRESSED); -PHPBN2(SWF_SOUND_ADPCM_COMPRESSED); -PHPBN2(SWF_SOUND_MP3_COMPRESSED); -PHPBN2(SWF_SOUND_NOT_COMPRESSED_LE); -PHPBN2(SWF_SOUND_NELLY_COMPRESSED); -PHPBN2(SWF_SOUND_5KHZ); -PHPBN2(SWF_SOUND_11KHZ); -PHPBN2(SWF_SOUND_22KHZ); -PHPBN2(SWF_SOUND_44KHZ); -PHPBN2(SWF_SOUND_8BITS); -PHPBN2(SWF_SOUND_16BITS); -PHPBN2(SWF_SOUND_MONO); -PHPBN2(SWF_SOUND_STEREO); -PHPBN2(OPENSSL_VERSION_NUMBER); -PHPBN2(SNMP_OID_OUTPUT_FULL); -PHPBN2(SNMP_OID_OUTPUT_NUMERIC); -PHPBN2(MSG_EAGAIN); -PHPBN2(MSG_ENOMSG); - -/* Added in PHP 5.3 */ -PHPBN2(CURLOPT_PROGRESSFUNCTION); -PHPBN2(IMG_FILTER_PIXELATE); -PHPBN2(JSON_ERROR_CTRL_CHAR); -PHPBN2(JSON_ERROR_DEPTH); -PHPBN2(JSON_ERROR_NONE); -PHPBN2(JSON_ERROR_STATE_MISMATCH); -PHPBN2(JSON_ERROR_SYNTAX); -PHPBN2(JSON_FORCE_OBJECT); -PHPBN2(JSON_HEX_TAG); -PHPBN2(JSON_HEX_AMP); -PHPBN2(JSON_HEX_APOS); -PHPBN2(JSON_HEX_QUOT); -PHPBN2(LDAP_OPT_NETWORK_TIMEOUT); -PHPBN2(LIBXML_LOADED_VERSION); -PHPBN2(PREG_BAD_UTF8_OFFSET_ERROR); -PHPBN2(BUS_ADRALN); -PHPBN2(BUS_ADRERR); -PHPBN2(BUS_OBJERR); -PHPBN2(CLD_CONTIUNED); -PHPBN2(CLD_DUMPED); -PHPBN2(CLD_EXITED); -PHPBN2(CLD_KILLED); -PHPBN2(CLD_STOPPED); -PHPBN2(CLD_TRAPPED); -PHPBN2(FPE_FLTDIV); -PHPBN2(FPE_FLTINV); -PHPBN2(FPE_FLTOVF); -PHPBN2(FPE_FLTRES); -PHPBN2(FPE_FLTSUB); -PHPBN2(FPE_FLTUND); -PHPBN2(FPE_INTDIV); -PHPBN2(FPE_INTOVF); -PHPBN2(ILL_BADSTK); -PHPBN2(ILL_COPROC); -PHPBN2(ILL_ILLADR); -PHPBN2(ILL_ILLOPC); -PHPBN2(ILL_ILLOPN); -PHPBN2(ILL_ILLTRP); -PHPBN2(ILL_PRVOPC); -PHPBN2(ILL_PRVREG); -PHPBN2(POLL_ERR); -PHPBN2(POLL_HUP); -PHPBN2(POLL_IN); -PHPBN2(POLL_MSG); -PHPBN2(POLL_OUT); -PHPBN2(POLL_PRI); -PHPBN2(SEGV_ACCERR); -PHPBN2(SEGV_MAPERR); -PHPBN2(SI_ASYNCIO); -PHPBN2(SI_KERNEL); -PHPBN2(SI_MESGQ); -PHPBN2(SI_NOINFO); -PHPBN2(SI_QUEUE); -PHPBN2(SI_SIGIO); -PHPBN2(SI_TIMER); -PHPBN2(SI_TKILL); -PHPBN2(SI_USER); -PHPBN2(SIG_BLOCK); -PHPBN2(SIG_SETMASK); -PHPBN2(SIG_UNBLOCK); -PHPBN2(TRAP_BRKPT); -PHPBN2(TRAP_TRACE); - -/* Class names reserved by PHP */ -/* case insensitive */ -PHPCN(stdclass); -PHPCN(__php_incomplete_class); -PHPCN(directory); -/* Added in PHP5 (this list apparently depends which extensions you load by default). */ -PHPCN(parent); -PHPCN(self); -PHPCN(exception); -PHPCN(php_user_filter); -PHPCN(errorexception); -PHPCN(xmlwriter); -PHPCN(libxmlerror); -PHPCN(simplexmlelement); -PHPCN(soapclient); -PHPCN(soapvar); -PHPCN(soapserver); -PHPCN(soapfault); -PHPCN(soapparam); -PHPCN(soapheader); -PHPCN(recursiveiteratoriterator); -PHPCN(filteriterator); -PHPCN(recursivefilteriterator); -PHPCN(parentiterator); -PHPCN(limititerator); -PHPCN(cachingiterator); -PHPCN(recursivecachingiterator); -PHPCN(iteratoriterator); -PHPCN(norewinditerator); -PHPCN(appenditerator); -PHPCN(infiniteiterator); -PHPCN(emptyiterator); -PHPCN(arrayobject); -PHPCN(arrayiterator); -PHPCN(recursivearrayiterator); -PHPCN(splfileinfo); -PHPCN(directoryiterator); -PHPCN(recursivedirectoryiterator); -PHPCN(splfileobject); -PHPCN(spltempfileobject); -PHPCN(simplexmliterator); -PHPCN(logicexception); -PHPCN(badfunctioncallexception); -PHPCN(badmethodcallexception); -PHPCN(domainexception); -PHPCN(invalidargumentexception); -PHPCN(lengthexception); -PHPCN(outofrangeexception); -PHPCN(runtimeexception); -PHPCN(outofboundsexception); -PHPCN(overflowexception); -PHPCN(rangeexception); -PHPCN(underflowexception); -PHPCN(unexpectedvalueexception); -PHPCN(splobjectstorage); -PHPCN(reflectionexception); -PHPCN(reflection); -PHPCN(reflectionfunction); -PHPCN(reflectionparameter); -PHPCN(reflectionmethod); -PHPCN(reflectionclass); -PHPCN(reflectionobject); -PHPCN(reflectionproperty); -PHPCN(reflectionextension); -PHPCN(domexception); -PHPCN(domstringlist); -PHPCN(domnamelist); -PHPCN(domimplementationlist); -PHPCN(domimplementationsource); -PHPCN(domimplementation); -PHPCN(domnode); -PHPCN(domnamespacenode); -PHPCN(domdocumentfragment); -PHPCN(domdocument); -PHPCN(domnodelist); -PHPCN(domnamednodemap); -PHPCN(domcharacterdata); -PHPCN(domattr); -PHPCN(domelement); -PHPCN(domtext); -PHPCN(domcomment); -PHPCN(domtypeinfo); -PHPCN(domuserdatahandler); -PHPCN(domdomerror); -PHPCN(domerrorhandler); -PHPCN(domlocator); -PHPCN(domconfiguration); -PHPCN(domcdatasection); -PHPCN(domdocumenttype); -PHPCN(domnotation); -PHPCN(domentity); -PHPCN(domentityreference); -PHPCN(domprocessinginstruction); -PHPCN(domstringextend); -PHPCN(domxpath); -PHPCN(xmlreader); -PHPCN(sqlitedatabase); -PHPCN(sqliteresult); -PHPCN(sqliteunbuffered); -PHPCN(sqliteexception); -PHPCN(datetime); - -/* Built-in PHP functions (incomplete). */ -PHPFN(cos); -PHPFN(sin); -PHPFN(tan); -PHPFN(acos); -PHPFN(asin); -PHPFN(atan); -PHPFN(atan2); -PHPFN(cosh); -PHPFN(sinh); -PHPFN(tanh); -PHPFN(exp); -PHPFN(log); -PHPFN(log10); -PHPFN(pow); -PHPFN(sqrt); -PHPFN(ceil); -PHPFN(floor); -PHPFN(fmod); -PHPFN(min); -PHPFN(max); - -#undef PHPKW -#undef PHPBN1 -#undef PHPBN2 -#undef PHPCN -#undef PHPFN
diff --git a/share/swig/2.0.11/python/builtin.swg b/share/swig/2.0.11/python/builtin.swg deleted file mode 100644 index 28c557a..0000000 --- a/share/swig/2.0.11/python/builtin.swg +++ /dev/null
@@ -1,514 +0,0 @@ -#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a) { \ - return wrapper(a, NULL); \ -} - -#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \ -SWIGINTERN void \ -wrapper##_closure(PyObject *a) { \ - SwigPyObject *sobj; \ - sobj = (SwigPyObject *)a; \ - if (sobj->own) { \ - PyObject *o = wrapper(a, NULL); \ - Py_XDECREF(o); \ - } \ - if (PyType_IS_GC(a->ob_type)) { \ - PyObject_GC_Del(a); \ - } else { \ - PyObject_Del(a); \ - } \ -} - -#define SWIGPY_INQUIRY_CLOSURE(wrapper) \ -SWIGINTERN int \ -wrapper##_closure(PyObject *a) { \ - PyObject *pyresult; \ - int result; \ - pyresult = wrapper(a, NULL); \ - result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; \ - Py_XDECREF(pyresult); \ - return result; \ -} - -#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a, PyObject *b) { \ - PyObject *tuple, *result; \ - tuple = PyTuple_New(1); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, b); \ - Py_XINCREF(b); \ - result = wrapper(a, tuple); \ - Py_DECREF(tuple); \ - return result; \ -} - -typedef ternaryfunc ternarycallfunc; - -#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \ - PyObject *tuple, *result; \ - tuple = PyTuple_New(2); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, b); \ - PyTuple_SET_ITEM(tuple, 1, c); \ - Py_XINCREF(b); \ - Py_XINCREF(c); \ - result = wrapper(a, tuple); \ - Py_DECREF(tuple); \ - return result; \ -} - -#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *callable_object, PyObject *args, PyObject *) { \ - return wrapper(callable_object, args); \ -} - -#define SWIGPY_LENFUNC_CLOSURE(wrapper) \ -SWIGINTERN Py_ssize_t \ -wrapper##_closure(PyObject *a) { \ - PyObject *resultobj; \ - Py_ssize_t result; \ - resultobj = wrapper(a, NULL); \ - result = PyNumber_AsSsize_t(resultobj, NULL); \ - Py_DECREF(resultobj); \ - return result; \ -} - -#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \ - PyObject *tuple, *result; \ - tuple = PyTuple_New(2); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ - PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \ - result = wrapper(a, tuple); \ - Py_DECREF(tuple); \ - return result; \ -} - -#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \ -SWIGINTERN int \ -wrapper##_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \ - PyObject *tuple, *resultobj; \ - int result; \ - tuple = PyTuple_New(d ? 3 : 2); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ - PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); \ - if (d) { \ - PyTuple_SET_ITEM(tuple, 2, d); \ - Py_INCREF(d); \ - } \ - resultobj = wrapper(a, tuple); \ - result = resultobj ? 0 : -1; \ - Py_DECREF(tuple); \ - Py_XDECREF(resultobj); \ - return result; \ -} - -#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a, Py_ssize_t b) { \ - PyObject *tuple, *result; \ - tuple = PyTuple_New(1); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ - result = wrapper(a, tuple); \ - Py_DECREF(tuple); \ - return result; \ -} - -#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a, Py_ssize_t b) { \ - PyObject *arg, *result; \ - arg = _PyLong_FromSsize_t(b); \ - result = wrapper(a, arg); \ - Py_DECREF(arg); \ - return result; \ -} - -#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \ -SWIGINTERN int \ -wrapper##_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \ - PyObject *tuple, *resultobj; \ - int result; \ - tuple = PyTuple_New(2); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); \ - PyTuple_SET_ITEM(tuple, 1, c); \ - Py_XINCREF(c); \ - resultobj = wrapper(a, tuple); \ - result = resultobj ? 0 : -1; \ - Py_XDECREF(resultobj); \ - Py_DECREF(tuple); \ - return result; \ -} - -#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \ -SWIGINTERN int \ -wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \ - PyObject *tuple, *resultobj; \ - int result; \ - tuple = PyTuple_New(c ? 2 : 1); \ - assert(tuple); \ - PyTuple_SET_ITEM(tuple, 0, b); \ - Py_XINCREF(b); \ - if (c) { \ - PyTuple_SET_ITEM(tuple, 1, c); \ - Py_XINCREF(c); \ - } \ - resultobj = wrapper(a, tuple); \ - result = resultobj ? 0 : -1; \ - Py_XDECREF(resultobj); \ - Py_DECREF(tuple); \ - return result; \ -} - -#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a) { \ - return wrapper(a, NULL); \ -} - -#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \ -SWIGINTERN long \ -wrapper##_closure(PyObject *a) { \ - PyObject *pyresult; \ - long result; \ - pyresult = wrapper(a, NULL); \ - if (!pyresult || !PyLong_Check(pyresult)) \ - return -1; \ - result = PyLong_AsLong(pyresult); \ - Py_DECREF(pyresult); \ - return result; \ -} - -#define SWIGPY_ITERNEXT_CLOSURE(wrapper) \ -SWIGINTERN PyObject * \ -wrapper##_closure(PyObject *a) { \ - PyObject *result; \ - result = wrapper(a, NULL); \ - if (result && result == Py_None) { \ - Py_DECREF(result); \ - result = NULL; \ - } \ - return result; \ -} - -#ifdef __cplusplus -extern "C" { -#endif - -SWIGINTERN int -SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { - PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); - return -1; -} - -SWIGINTERN void -SwigPyBuiltin_BadDealloc(PyObject *pyobj) { - SwigPyObject *sobj; - sobj = (SwigPyObject *)pyobj; - if (sobj->own) { - PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", pyobj->ob_type->tp_name); - } -} - -typedef struct { - PyCFunction get; - PyCFunction set; -} SwigPyGetSet; - -SWIGINTERN PyObject * -SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) { - SwigPyGetSet *getset; - PyObject *tuple, *result; - if (!closure) - return SWIG_Py_Void(); - getset = (SwigPyGetSet *)closure; - if (!getset->get) - return SWIG_Py_Void(); - tuple = PyTuple_New(0); - assert(tuple); - result = (*getset->get)(obj, tuple); - Py_DECREF(tuple); - return result; -} - -SWIGINTERN PyObject * -SwigPyBuiltin_FunpackGetterClosure (PyObject *obj, void *closure) { - SwigPyGetSet *getset; - PyObject *result; - if (!closure) - return SWIG_Py_Void(); - getset = (SwigPyGetSet *)closure; - if (!getset->get) - return SWIG_Py_Void(); - result = (*getset->get)(obj, NULL); - return result; -} - -SWIGINTERN int -SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { - SwigPyGetSet *getset; - PyObject *tuple, *result; - if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); - return -1; - } - getset = (SwigPyGetSet *)closure; - if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); - return -1; - } - tuple = PyTuple_New(1); - assert(tuple); - PyTuple_SET_ITEM(tuple, 0, val); - Py_XINCREF(val); - result = (*getset->set)(obj, tuple); - Py_DECREF(tuple); - Py_XDECREF(result); - return result ? 0 : -1; -} - -SWIGINTERN int -SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) { - SwigPyGetSet *getset; - PyObject *result; - if (!closure) { - PyErr_Format(PyExc_TypeError, "Missing getset closure"); - return -1; - } - getset = (SwigPyGetSet *)closure; - if (!getset->set) { - PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); - return -1; - } - result = (*getset->set)(obj, val); - Py_XDECREF(result); - return result ? 0 : -1; -} - -SWIGINTERN void -SwigPyStaticVar_dealloc(PyDescrObject *descr) { - _PyObject_GC_UNTRACK(descr); - Py_XDECREF(PyDescr_TYPE(descr)); - Py_XDECREF(PyDescr_NAME(descr)); - PyObject_GC_Del(descr); -} - -SWIGINTERN PyObject * -SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { -#if PY_VERSION_HEX >= 0x03000000 - - return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); -#else - return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); -#endif -} - -SWIGINTERN int -SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) { - PyDescrObject *descr; - descr = (PyDescrObject *)self; - Py_VISIT((PyObject*) PyDescr_TYPE(descr)); - return 0; -} - -SWIGINTERN PyObject * -SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNUSEDPARM(type)) { - if (descr->d_getset->get != NULL) - return descr->d_getset->get(obj, descr->d_getset->closure); -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); -#else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); -#endif - return NULL; -} - -SWIGINTERN int -SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) { - if (descr->d_getset->set != NULL) - return descr->d_getset->set(obj, value, descr->d_getset->closure); -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); -#else - PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); -#endif - return -1; -} - -SWIGINTERN int -SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) { - PyObject *attribute; - descrsetfunc local_set; - attribute = _PyType_Lookup(type, name); - if (attribute != NULL) { - /* Implement descriptor functionality, if any */ - local_set = attribute->ob_type->tp_descr_set; - if (local_set != NULL) - return local_set(attribute, (PyObject *)type, value); -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); -#else - PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name)); -#endif - } else { -#if PY_VERSION_HEX >= 0x03000000 - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); -#else - PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); -#endif - } - - return -1; -} - -SWIGINTERN PyTypeObject* -SwigPyStaticVar_Type(void) { - static PyTypeObject staticvar_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) -#else - PyObject_HEAD_INIT(&PyType_Type) - 0, -#endif - "swig_static_var_getset_descriptor", - sizeof(PyGetSetDescrObject), - 0, - (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)SwigPyStaticVar_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ - 0, /* tp_doc */ - SwigPyStaticVar_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */ - (descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; - staticvar_type = tmp; - type_init = 1; -#if PY_VERSION_HEX < 0x02020000 - staticvar_type.ob_type = &PyType_Type; -#else - if (PyType_Ready(&staticvar_type) < 0) - return NULL; -#endif - } - return &staticvar_type; -} - -SWIGINTERN PyGetSetDescrObject * -SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) { - - PyGetSetDescrObject *descr; - descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0); - assert(descr); - Py_XINCREF(type); - PyDescr_TYPE(descr) = type; - PyDescr_NAME(descr) = PyString_InternFromString(getset->name); - descr->d_getset = getset; - if (PyDescr_NAME(descr) == NULL) { - Py_DECREF(descr); - descr = NULL; - } - return descr; -} - -SWIGINTERN void -SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { - int base_count = 0; - PyTypeObject **b; - PyObject *tuple; - int i; - - if (!bases[0]) { - bases[0] = SwigPyObject_type(); - bases[1] = NULL; - } - type->tp_base = bases[0]; - Py_INCREF((PyObject *)bases[0]); - for (b = bases; *b != NULL; ++b) - ++base_count; - tuple = PyTuple_New(base_count); - for (i = 0; i < base_count; ++i) { - PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]); - Py_INCREF((PyObject *)bases[i]); - } - type->tp_bases = tuple; -} - -SWIGINTERN PyObject * -SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { - PyObject *result; - result = (PyObject *)SWIG_Python_GetSwigThis(self); - Py_XINCREF(result); - return result; -} - -SWIGINTERN void -SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) -{ -#if PY_VERSION_HEX >= 0x03000000 - type->ob_base.ob_base.ob_type = metatype; -#else - type->ob_type = metatype; -#endif -} - -#ifdef __cplusplus -} -#endif -
diff --git a/share/swig/2.0.11/python/carrays.i b/share/swig/2.0.11/python/carrays.i deleted file mode 100644 index e578c80..0000000 --- a/share/swig/2.0.11/python/carrays.i +++ /dev/null
@@ -1,53 +0,0 @@ -%define %array_class(TYPE,NAME) -#if defined(SWIGPYTHON_BUILTIN) - %feature("python:slot", "sq_item", functype="ssizeargfunc") NAME::__getitem__; - %feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__; - -%inline %{ -typedef struct { - TYPE *el; -} NAME; -%} - -%extend NAME { - - NAME(size_t nelements) { - NAME *arr = %new_instance(NAME); - arr->el = %new_array(nelements, TYPE); - return arr; - } - - ~NAME() { - %delete_array(self->el); - %delete(self); - } - - TYPE __getitem__(size_t index) { - return self->el[index]; - } - - void __setitem__(size_t index, TYPE value) { - self->el[index] = value; - } - - TYPE * cast() { - return self->el; - } - - static NAME *frompointer(TYPE *t) { - return %reinterpret_cast(t, NAME *); - } -}; - -%types(NAME = TYPE); - -#else - %array_class_wrap(TYPE,NAME,__getitem__,__setitem__) -#endif -%enddef - -%include <typemaps/carrays.swg> - - - -
diff --git a/share/swig/2.0.11/python/embed15.i b/share/swig/2.0.11/python/embed15.i deleted file mode 100644 index 3c419b9..0000000 --- a/share/swig/2.0.11/python/embed15.i +++ /dev/null
@@ -1,115 +0,0 @@ -/* ----------------------------------------------------------------------------- - * embed15.i - * - * SWIG file embedding the Python interpreter in something else. - * This file is based on Python-1.5. It will not work with - * earlier versions. - * - * This file makes it possible to extend Python and all of its - * built-in functions without having to hack its setup script. - * ----------------------------------------------------------------------------- */ - -#ifdef AUTODOC -%subsection "embed.i" -%text %{ -This module provides support for building a new version of the -Python executable. This will be necessary on systems that do -not support shared libraries and may be necessary with C++ -extensions. This file contains everything you need to build -a new version of Python from include files and libraries normally -installed with the Python language. - -This module will automatically grab all of the Python modules -present in your current Python executable (including any special -purpose modules you have enabled such as Tkinter). Thus, you -may need to provide additional link libraries when compiling. - -This library file only works with Python 1.5. A version -compatible with Python 1.4 is available as embed14.i and -a Python1.3 version is available as embed13.i. As far as -I know, this module is C++ safe. -%} -#else -%echo "embed.i : Using Python 1.5" -#endif - -%wrapper %{ - -#include <Python.h> - -#ifdef __cplusplus -extern "C" -#endif -void SWIG_init(); /* Forward reference */ - -#define _PyImport_Inittab swig_inittab - -/* Grab Python's inittab[] structure */ - -#ifdef __cplusplus -extern "C" { -#endif -#include <config.c> - -#undef _PyImport_Inittab - -/* Now define our own version of it. - Hopefully someone does not have more than 1000 built-in modules */ - -struct _inittab SWIG_Import_Inittab[1000]; - -static int swig_num_modules = 0; - -/* Function for adding modules to Python */ - -static void swig_add_module(char *name, void (*initfunc)()) { - SWIG_Import_Inittab[swig_num_modules].name = name; - SWIG_Import_Inittab[swig_num_modules].initfunc = initfunc; - swig_num_modules++; - SWIG_Import_Inittab[swig_num_modules].name = (char *) 0; - SWIG_Import_Inittab[swig_num_modules].initfunc = 0; -} - -/* Function to add all of Python's build in modules to our interpreter */ - -static void swig_add_builtin() { - int i = 0; - while (swig_inittab[i].name) { - swig_add_module(swig_inittab[i].name, swig_inittab[i].initfunc); - i++; - } -#ifdef SWIGMODINIT - SWIGMODINIT -#endif - /* Add SWIG builtin function */ - swig_add_module(SWIG_name, SWIG_init); -} - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -extern int Py_Main(int, char **); - -#ifdef __cplusplus -} -#endif - -extern struct _inittab *PyImport_Inittab; - -int -main(int argc, char **argv) { - swig_add_builtin(); - PyImport_Inittab = SWIG_Import_Inittab; - return Py_Main(argc,argv); -} - -%} - - - -
diff --git a/share/swig/2.0.11/r/ropers.swg b/share/swig/2.0.11/r/ropers.swg deleted file mode 100644 index c02f7b2..0000000 --- a/share/swig/2.0.11/r/ropers.swg +++ /dev/null
@@ -1,70 +0,0 @@ -#ifdef __cplusplus - -// These are auto-supported by the Perl-module -%rename(__plusplus__) *::operator++; -%rename(__minmin__) *::operator--; -%rename(__add__) *::operator+; -%rename(__sub__) *::operator-; -%rename(__neg__) *::operator-(); -%rename(__neg__) *::operator-() const; -%rename(__mul__) *::operator*; -%rename(__div__) *::operator/; -%rename(__eq__) *::operator==; -%rename(__ne__) *::operator!=; -%rename(__mod__) *::operator%; -%rename(__gt__) *::operator>; -%rename(__lt__) *::operator<; -%rename(__not__) *::operator!; - -// These are renamed, but no 'use overload...' is added -%rename(__lshift__) *::operator<<; -%rename(__rshift__) *::operator>>; -%rename(__and__) *::operator&; -%rename(__or__) *::operator|; -%rename(__xor__) *::operator^; -%rename(__invert__) *::operator~; -%rename(__le__) *::operator<=; -%rename(__ge__) *::operator>=; -%rename(__call__) *::operator(); -%rename(__getitem__) *::operator[]; - -%rename(__seteq__) *::operator=; - - -%rename(__land__) operator&&; -%rename(__lor__) operator||; -%rename(__plusplus__) *::operator++; -%rename(__minusminus__) *::operator--; -%rename(__arrowstar__) *::operator->*; -%rename(__index__) *::operator[]; - -%rename(Equal) operator =; -%rename(PlusEqual) operator +=; -%rename(MinusEqual) operator -=; -%rename(MultiplyEqual) operator *=; -%rename(DivideEqual) operator /=; -%rename(PercentEqual) operator %=; -%rename(Plus) operator +; -%rename(Minus) operator -; -%rename(Multiply) operator *; -%rename(Divide) operator /; -%rename(Percent) operator %; -%rename(Not) operator !; -%rename(IndexIntoConst) operator[](unsigned idx) const; -%rename(IndexInto) operator[](unsigned idx); -%rename(Functor) operator (); -%rename(EqualEqual) operator ==; -%rename(NotEqual) operator !=; -%rename(LessThan) operator <; -%rename(LessThanEqual) operator <=; -%rename(GreaterThan) operator >; -%rename(GreaterThanEqual) operator >=; -%rename(And) operator &&; -%rename(Or) operator ||; -%rename(PlusPlusPrefix) operator++(); -%rename(PlusPlusPostfix) operator++(int); -%rename(MinusMinusPrefix) operator--(); -%rename(MinusMinusPostfix) operator--(int); - - -#endif
diff --git a/share/swig/2.0.11/r/std_vector.i b/share/swig/2.0.11/r/std_vector.i deleted file mode 100644 index 836c95b..0000000 --- a/share/swig/2.0.11/r/std_vector.i +++ /dev/null
@@ -1,608 +0,0 @@ -// R specific swig components -/* - Vectors -*/ - -%fragment("StdVectorTraits","header",fragment="StdSequenceTraits") -%{ - namespace swig { - // vectors of doubles - template <> - struct traits_from_ptr<std::vector<double> > { - static SEXP from (std::vector<double > *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(REALSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - NUMERIC_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; - // vectors of floats - template <> - struct traits_from_ptr<std::vector<float> > { - static SEXP from (std::vector<float > *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(REALSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - NUMERIC_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; - // vectors of unsigned int - template <> - struct traits_from_ptr<std::vector<unsigned int> > { - static SEXP from (std::vector<unsigned int > *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(INTSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - INTEGER_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; - // vectors of int - template <> - struct traits_from_ptr<std::vector<int> > { - static SEXP from (std::vector<int > *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(INTSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - INTEGER_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - } - }; - - // vectors of bool - template <> - struct traits_from_ptr<std::vector<bool> > { - static SEXP from (std::vector<bool> *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(LGLSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - LOGICAL_POINTER(result)[pos] = ((*val)[pos]); - } - UNPROTECT(1); - return(result); - //return SWIG_R_NewPointerObj(val, type_info< std::vector<T > >(), owner); - } - }; - // vectors of strings - template <> - struct traits_from_ptr<std::vector<std::basic_string<char> > > { - static SEXP from (std::vector<std::basic_string<char> > *val, int owner = 0) { - SEXP result; - PROTECT(result = Rf_allocVector(STRSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - CHARACTER_POINTER(result)[pos] = Rf_mkChar(((*val)[pos]).c_str()); - } - UNPROTECT(1); - return(result); - //return SWIG_R_NewPointerObj(val, type_info< std::vector<T > >(), owner); - } - }; - - // catch all that does everything with vectors - template <typename T> - struct traits_from_ptr< std::vector< T > > { - static SEXP from (std::vector< T > *val, int owner = 0) { - return SWIG_R_NewPointerObj(val, type_info< std::vector< T > >(), owner); - } - }; - - template <> - struct traits_asptr < std::vector<double> > { - static int asptr(SEXP obj, std::vector<double> **val) { - std::vector<double> *p; - // not sure how to check the size of the SEXP obj is correct - unsigned int sexpsz = Rf_length(obj); - p = new std::vector<double>(sexpsz); - double *S = NUMERIC_POINTER(obj); - for (unsigned pos = 0; pos < p->size(); pos++) - { - (*p)[pos] = static_cast<double>(S[pos]); - } - int res = SWIG_OK; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector<float> > { - static int asptr(SEXP obj, std::vector<float> **val) { - std::vector<float> *p; - // not sure how to check the size of the SEXP obj is correct - unsigned int sexpsz = Rf_length(obj); - p = new std::vector<float>(sexpsz); - double *S = NUMERIC_POINTER(obj); - for (unsigned pos = 0; pos < p->size(); pos++) - { - (*p)[pos] = static_cast<double>(S[pos]); - } - int res = SWIG_OK; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector<unsigned int> > { - static int asptr(SEXP obj, std::vector<unsigned int> **val) { - std::vector<unsigned int> *p; - unsigned int sexpsz = Rf_length(obj); - p = new std::vector<unsigned int>(sexpsz); - SEXP coerced; - PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); - int *S = INTEGER_POINTER(coerced); - for (unsigned pos = 0; pos < p->size(); pos++) - { - (*p)[pos] = static_cast<unsigned int>(S[pos]); - } - int res = SWIG_OK; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - UNPROTECT(1); - return res; - } - }; - - template <> - struct traits_asptr < std::vector<int> > { - static int asptr(SEXP obj, std::vector<int> **val) { - std::vector<int> *p; - // not sure how to check the size of the SEXP obj is correct - int sexpsz = Rf_length(obj); - p = new std::vector<int>(sexpsz); - SEXP coerced; - PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); - int *S = INTEGER_POINTER(coerced); - for (unsigned pos = 0; pos < p->size(); pos++) - { - (*p)[pos] = static_cast<int>(S[pos]); - } - int res = SWIG_OK; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - UNPROTECT(1); - return res; - } - }; - - template <> - struct traits_asptr < std::vector<bool> > { - static int asptr(SEXP obj, std::vector<bool> **val) { - std::vector<bool> *p; - // not sure how to check the size of the SEXP obj is correct - int sexpsz = Rf_length(obj); - p = new std::vector<bool>(sexpsz); - SEXP coerced; - PROTECT(coerced = Rf_coerceVector(obj, LGLSXP)); - int *S = LOGICAL_POINTER(coerced); - for (unsigned pos = 0; pos < p->size(); pos++) - { - (*p)[pos] = static_cast<bool>(S[pos]); - } - int res = SWIG_OK; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - UNPROTECT(1); - return res; - } - }; - - // catchall for R to vector conversion - template <typename T> - struct traits_asptr < std::vector<T> > { - static int asptr(SEXP obj, std::vector<T> **val) { - std::vector<T> *p; - Rprintf("my asptr\n"); - int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0); - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - // now for vectors of vectors. These will be represented as lists of vectors on the - // catch all that does everything with vectors - template <> - struct traits_from_ptr<std::vector<std::vector<unsigned int> > > { - static SEXP from (std::vector< std::vector<unsigned int > > *val, int owner = 0) { - SEXP result; - // allocate the R list - PROTECT(result = Rf_allocVector(VECSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - // allocate the R vector - SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); - // Fill the R vector - for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) - { - INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); - } - } - UNPROTECT(1); - return(result); - } - }; - - template <> - struct traits_from_ptr<std::vector<std::vector<int> > > { - static SEXP from (std::vector< std::vector<int > > *val, int owner = 0) { - SEXP result; - // allocate the R list - PROTECT(result = Rf_allocVector(VECSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - // allocate the R vector - SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); - // Fill the R vector - for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) - { - INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); - } - } - UNPROTECT(1); - return(result); - } - }; - - template <> - struct traits_from_ptr<std::vector<std::vector<float> > > { - static SEXP from (std::vector< std::vector<float > > *val, int owner = 0) { - SEXP result; - // allocate the R list - PROTECT(result = Rf_allocVector(VECSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - // allocate the R vector - SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); - // Fill the R vector - for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) - { - NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); - } - } - UNPROTECT(1); - return(result); - } - }; - - template <> - struct traits_from_ptr<std::vector<std::vector<double> > > { - static SEXP from (std::vector< std::vector<double > > *val, int owner = 0) { - SEXP result; - // allocate the R list - PROTECT(result = Rf_allocVector(VECSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - // allocate the R vector - SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); - // Fill the R vector - for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) - { - NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); - } - } - UNPROTECT(1); - return(result); - } - }; - - template <> - struct traits_from_ptr<std::vector<std::vector<bool> > > { - static SEXP from (std::vector< std::vector<bool> > *val, int owner = 0) { - SEXP result; - // allocate the R list - PROTECT(result = Rf_allocVector(VECSXP, val->size())); - for (unsigned pos = 0; pos < val->size(); pos++) - { - // allocate the R vector - SET_VECTOR_ELT(result, pos, Rf_allocVector(LGLSXP, val->at(pos).size())); - // Fill the R vector - for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) - { - LOGICAL_POINTER(VECTOR_ELT(result, pos))[vpos] = (val->at(pos).at(vpos)); - } - } - UNPROTECT(1); - return(result); - } - }; - - template <typename T> - struct traits_from_ptr< std::vector < std::vector< T > > > { - static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { - return SWIG_R_NewPointerObj(val, type_info< std::vector < std::vector< T > > >(), owner); - } - }; - - // R side - template <> - struct traits_asptr < std::vector< std::vector<unsigned int> > > { - static int asptr(SEXP obj, std::vector< std::vector<unsigned int> > **val) { - std::vector <std::vector<unsigned int> > *p; - // this is the length of the list - unsigned int sexpsz = Rf_length(obj); - p = new std::vector< std::vector<unsigned int> > (sexpsz); - - for (unsigned listpos = 0; listpos < sexpsz; ++listpos) - { - unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); - for (unsigned vpos = 0; vpos < vecsize; ++vpos) - { - (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); - } - } - - int res = SWIG_OK; - - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector< std::vector< int> > > { - static int asptr(SEXP obj, std::vector< std::vector< int> > **val) { - std::vector <std::vector< int> > *p; - // this is the length of the list - unsigned int sexpsz = Rf_length(obj); - p = new std::vector< std::vector< int> > (sexpsz); - - for (unsigned listpos = 0; listpos < sexpsz; ++listpos) - { - unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); - for (unsigned vpos = 0; vpos < vecsize; ++vpos) - { - (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); - } - } - - int res = SWIG_OK; - - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector< std::vector< float> > > { - static int asptr(SEXP obj, std::vector< std::vector< float> > **val) { - std::vector <std::vector< float> > *p; - // this is the length of the list - unsigned int sexpsz = Rf_length(obj); - p = new std::vector< std::vector< float> > (sexpsz); - - for (unsigned listpos = 0; listpos < sexpsz; ++listpos) - { - unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); - for (unsigned vpos = 0; vpos < vecsize; ++vpos) - { - (*p)[listpos].push_back(static_cast<float>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); - } - } - - int res = SWIG_OK; - - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector< std::vector< double> > > { - static int asptr(SEXP obj, std::vector< std::vector< double> > **val) { - std::vector <std::vector< double> > *p; - // this is the length of the list - unsigned int sexpsz = Rf_length(obj); - p = new std::vector< std::vector< double> > (sexpsz); - - for (unsigned listpos = 0; listpos < sexpsz; ++listpos) - { - unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); - for (unsigned vpos = 0; vpos < vecsize; ++vpos) - { - (*p)[listpos].push_back(static_cast<double>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); - } - } - - int res = SWIG_OK; - - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <> - struct traits_asptr < std::vector< std::vector< bool > > > { - static int asptr(SEXP obj, std::vector< std::vector< bool> > **val) { - std::vector <std::vector< bool > > *p; - // this is the length of the list - unsigned int sexpsz = Rf_length(obj); - p = new std::vector< std::vector< bool > > (sexpsz); - - for (unsigned listpos = 0; listpos < sexpsz; ++listpos) - { - unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); - for (unsigned vpos = 0; vpos < vecsize; ++vpos) - { - (*p)[listpos].push_back(static_cast<bool>(LOGICAL_POINTER(VECTOR_ELT(obj, listpos))[vpos])); - } - } - - int res = SWIG_OK; - - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - // catchall - template <typename T> - struct traits_asptr < std::vector< std::vector<T> > > { - static int asptr(SEXP obj, std::vector< std::vector<T> > **val) { - std::vector< std::vector<T> > *p; - Rprintf("vector of vectors - unsupported content\n"); - int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0); - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - } -%} - -#define %swig_vector_methods(Type...) %swig_sequence_methods(Type) -#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type); - -%define %traits_type_name(Type...) -%fragment(SWIG_Traits_frag(Type), "header", - fragment="StdTraits",fragment="StdVectorTraits") { - namespace swig { - template <> struct traits< Type > { - typedef pointer_category category; - static const char* type_name() { - return #Type; - } - }; - } - } -%enddef - -%include <std/std_vector.i> - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<double>) -%traits_type_name(std::vector<double>) -%typemap("rtypecheck") std::vector<double>, std::vector<double> const, std::vector<double> const& - %{ is.numeric($arg) %} -%typemap("rtype") std::vector<double> "numeric" -%typemap("scoercein") std::vector<double>, std::vector<double> const, std::vector<double> const& ""; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<float>) -%traits_type_name(std::vector<float>) -%typemap("rtypecheck") std::vector<float>, std::vector<float> const, std::vector<float> const& - %{ is.numeric($arg) %} -%typemap("rtype") std::vector<float> "numeric" -%typemap("scoercein") std::vector<double>, std::vector<float> const, std::vector<float> const& ""; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<bool>); -%traits_type_name(std::vector<bool>); -%typemap("rtypecheck") std::vector<bool> , std::vector<bool> const, std::vector<bool> const& - %{ is.logical($arg) %} -%typemap("rtype") std::vector<bool> "logical" -%typemap("scoercein") std::vector<bool> , std::vector<bool> const, std::vector<bool> const& "$input = as.logical($input);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<int>); -%traits_type_name(std::vector<int>); -%typemap("rtypecheck") std::vector<int> , std::vector<int> const, std::vector<int> const& - %{ is.integer($arg) || is.numeric($arg) %} -%typemap("rtype") std::vector<int> "integer" -%typemap("scoercein") std::vector<int> , std::vector<int> const, std::vector<int> const& "$input = as.integer($input);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned int>); -%traits_type_name(std::vector<unsigned int>); -%typemap("rtypecheck") std::vector<unsigned int>, std::vector<unsigned int> const, std::vector<unsigned int> const& -%{ is.integer($arg) || is.numeric($arg) %} -%typemap("rtype") std::vector<unsigned int> "integer" -%typemap("scoercein") std::vector<unsigned int>, std::vector<unsigned int> const, std::vector<unsigned int> const& "$input = as.integer($input);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<unsigned int> >); -%traits_type_name(std::vector< std::vector<unsigned int> >); -%typemap("rtypecheck") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > const, std::vector<std::vector<unsigned int> >const& - %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} -%typemap("rtype") std::vector<std::vector<unsigned int> > "list" -%typemap("scoercein") std::vector< std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > const, std::vector<std::vector<unsigned int> >const& "$input = lapply($input, as.integer);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<int> >); -%traits_type_name(std::vector< std::vector<int> >); -%typemap("rtypecheck") std::vector<std::vector<int> >, std::vector<std::vector<int> > const, std::vector<std::vector<int> >const& - %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} -%typemap("rtype") std::vector<std::vector<int> > "list" -%typemap("scoercein") std::vector< std::vector<int> >, std::vector<std::vector<int> > const, std::vector<std::vector<int> >const& "$input = lapply($input, as.integer);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<float> >); -%traits_type_name(std::vector< std::vector<float> >); -%typemap("rtypecheck") std::vector<std::vector<float> >, std::vector<std::vector<float> > const, std::vector<std::vector<float> >const& - %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} -%typemap("rtype") std::vector<std::vector<float> > "list" -%typemap("scoercein") std::vector< std::vector<float> >, std::vector<std::vector<float> > const, std::vector<std::vector<float> >const& "$input = lapply($input, as.numeric);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<double> >); -%traits_type_name(std::vector< std::vector<double> >); -%typemap("rtypecheck") std::vector<std::vector<double> >, std::vector<std::vector<double> > const, std::vector<std::vector<double> >const& - %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} -%typemap("rtype") std::vector<std::vector<double> > "list" -%typemap("scoercein") std::vector< std::vector<double> >, std::vector<std::vector<double> > const, std::vector<std::vector<double> >const& - "$input = lapply($input, as.numeric);"; - -%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<bool> >); -%traits_type_name(std::vector< std::vector<bool> >); -%typemap("rtypecheck") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > const, std::vector<std::vector<bool> >const& - %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} -%typemap("rtype") std::vector<std::vector<bool> > "list" -%typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > const, std::vector<std::vector<bool> >const& "$input = lapply($input, as.logical);"; - -// we don't want these to be given R classes as they -// have already been turned into R vectors. -%typemap(scoerceout) std::vector<double>, - std::vector<double> *, - std::vector<double> &, - std::vector<bool>, - std::vector<bool> *, - std::vector<bool> &, - std::vector<unsigned int>, - std::vector<unsigned int> *, - std::vector<unsigned int> &, - // vectors of vectors - std::vector< std::vector<unsigned int> >, - std::vector< std::vector<unsigned int> >*, - std::vector< std::vector<unsigned int> >&, - std::vector< std::vector<int> >, - std::vector< std::vector<int> >*, - std::vector< std::vector<int> >&, - std::vector< std::vector<float> >, - std::vector< std::vector<float> >*, - std::vector< std::vector<float> >&, - std::vector< std::vector<double> >, - std::vector< std::vector<double> >*, - std::vector< std::vector<double> >&, - std::vector< std::vector<bool> >, - std::vector< std::vector<bool> >*, - std::vector< std::vector<bool> >& - - - %{ %}
diff --git a/share/swig/2.0.11/ruby/rubytracking.swg b/share/swig/2.0.11/ruby/rubytracking.swg deleted file mode 100644 index 0a36f4a..0000000 --- a/share/swig/2.0.11/ruby/rubytracking.swg +++ /dev/null
@@ -1,157 +0,0 @@ -/* ----------------------------------------------------------------------------- - * rubytracking.swg - * - * This file contains support for tracking mappings from - * Ruby objects to C++ objects. This functionality is needed - * to implement mark functions for Ruby's mark and sweep - * garbage collector. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Ruby 1.8 actually assumes the first case. */ -#if SIZEOF_VOIDP == SIZEOF_LONG -# define SWIG2NUM(v) LONG2NUM((unsigned long)v) -# define NUM2SWIG(x) (unsigned long)NUM2LONG(x) -#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG -# define SWIG2NUM(v) LL2NUM((unsigned long long)v) -# define NUM2SWIG(x) (unsigned long long)NUM2LL(x) -#else -# error sizeof(void*) is not the same as long or long long -#endif - - -/* Global Ruby hash table to store Trackings from C/C++ - structs to Ruby Objects. -*/ -static VALUE swig_ruby_trackings = Qnil; - -/* Global variable that stores a reference to the ruby - hash table delete function. */ -static ID swig_ruby_hash_delete; - -/* Setup a Ruby hash table to store Trackings */ -SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { - /* Create a ruby hash table to store Trackings from C++ - objects to Ruby objects. */ - - /* Try to see if some other .so has already created a - tracking hash table, which we keep hidden in an instance var - in the SWIG module. - This is done to allow multiple DSOs to share the same - tracking table. - */ - ID trackings_id = rb_intern( "@__trackings__" ); - VALUE verbose = rb_gv_get("VERBOSE"); - rb_gv_set("VERBOSE", Qfalse); - swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id ); - rb_gv_set("VERBOSE", verbose); - - /* No, it hasn't. Create one ourselves */ - if ( swig_ruby_trackings == Qnil ) - { - swig_ruby_trackings = rb_hash_new(); - rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings ); - } - - /* Now store a reference to the hash table delete function - so that we only have to look it up once.*/ - swig_ruby_hash_delete = rb_intern("delete"); -} - -/* Get a Ruby number to reference a pointer */ -SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) { - /* We cast the pointer to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the pointer to a Ruby number */ - return SWIG2NUM(ptr); -} - -/* Get a Ruby number to reference an object */ -SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) { - /* We cast the object to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the Object to a Ruby number */ - return SWIG2NUM(object); -} - -/* Get a Ruby object from a previously stored reference */ -SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) { - /* The provided Ruby number object is a reference - to the Ruby object we want.*/ - - /* Convert the Ruby number to a Ruby object */ - return NUM2SWIG(reference); -} - -/* Add a Tracking from a C/C++ struct to a Ruby object */ -SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { - /* In a Ruby hash table we store the pointer and - the associated Ruby object. The trick here is - that we cannot store the Ruby object directly - if - we do then it cannot be garbage collected. So - instead we typecast it as a unsigned long and - convert it to a Ruby number object.*/ - - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Get a reference to the Ruby object as a Ruby number */ - VALUE value = SWIG_RubyObjectToReference(object); - - /* Store the mapping to the global hash table. */ - rb_hash_aset(swig_ruby_trackings, key, value); -} - -/* Get the Ruby object that owns the specified C/C++ struct */ -SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Now lookup the value stored in the global hash table */ - VALUE value = rb_hash_aref(swig_ruby_trackings, key); - - if (value == Qnil) { - /* No object exists - return nil. */ - return Qnil; - } - else { - /* Convert this value to Ruby object */ - return SWIG_RubyReferenceToObject(value); - } -} - -/* Remove a Tracking from a C/C++ struct to a Ruby object. It - is very important to remove objects once they are destroyed - since the same memory address may be reused later to create - a new object. */ -SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Delete the object from the hash table by calling Ruby's - do this we need to call the Hash.delete method.*/ - rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key); -} - -/* This is a helper method that unlinks a Ruby object from its - underlying C++ object. This is needed if the lifetime of the - Ruby object is longer than the C++ object */ -SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { - VALUE object = SWIG_RubyInstanceFor(ptr); - - if (object != Qnil) { - DATA_PTR(object) = 0; - } -} - - -#ifdef __cplusplus -} -#endif
diff --git a/share/swig/2.0.11/std/std_container.i b/share/swig/2.0.11/std/std_container.i deleted file mode 100644 index 73d0c6a..0000000 --- a/share/swig/2.0.11/std/std_container.i +++ /dev/null
@@ -1,109 +0,0 @@ -%include <std_common.i> -%include <exception.i> -%include <std_alloc.i> - -%{ -#include <algorithm> -%} - -// Common container methods - -%define %std_container_methods(container...) - container(); - container(const container&); - - bool empty() const; - size_type size() const; - void clear(); - - void swap(container& v); - - allocator_type get_allocator() const; - - #ifdef SWIG_EXPORT_ITERATOR_METHODS - class iterator; - class reverse_iterator; - class const_iterator; - class const_reverse_iterator; - - iterator begin(); - iterator end(); - reverse_iterator rbegin(); - reverse_iterator rend(); - #endif - -%enddef - -// Common sequence - -%define %std_sequence_methods_common(sequence) - - %std_container_methods(%arg(sequence)); - - sequence(size_type size); - void pop_back(); - - void resize(size_type new_size); - - #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator erase(iterator pos); - iterator erase(iterator first, iterator last); - #endif - -%enddef - - -%define %std_sequence_methods(sequence) - - %std_sequence_methods_common(%arg(sequence)); - - sequence(size_type size, const value_type& value); - void push_back(const value_type& x); - - const value_type& front() const; - const value_type& back() const; - - void assign(size_type n, const value_type& x); - - void resize(size_type new_size, const value_type& x); - - #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator insert(iterator pos, const value_type& x); - void insert(iterator pos, size_type n, const value_type& x); - #endif - -%enddef - -%define %std_sequence_methods_val(sequence...) - - %std_sequence_methods_common(%arg(sequence)); - - sequence(size_type size, value_type value); - void push_back(value_type x); - - value_type front() const; - value_type back() const; - - void assign(size_type n, value_type x); - - void resize(size_type new_size, value_type x); - - #ifdef SWIG_EXPORT_ITERATOR_METHODS - iterator insert(iterator pos, value_type x); - void insert(iterator pos, size_type n, value_type x); - #endif - -%enddef - - -// -// Ignore member methods for Type with no default constructor -// -%define %std_nodefconst_type(Type...) -%feature("ignore") std::vector<Type >::vector(size_type size); -%feature("ignore") std::vector<Type >::resize(size_type size); -%feature("ignore") std::deque<Type >::deque(size_type size); -%feature("ignore") std::deque<Type >::resize(size_type size); -%feature("ignore") std::list<Type >::list(size_type size); -%feature("ignore") std::list<Type >::resize(size_type size); -%enddef
diff --git a/share/swig/2.0.11/typemaps/traits.swg b/share/swig/2.0.11/typemaps/traits.swg deleted file mode 100644 index b39eb39..0000000 --- a/share/swig/2.0.11/typemaps/traits.swg +++ /dev/null
@@ -1,307 +0,0 @@ -// -// Use the following macro with modern STL implementations -// -//#define SWIG_STD_MODERN_STL -// -// Use this to deactive the previous definition, when using gcc-2.95 -// or similar old compilers. -// -//#define SWIG_STD_NOMODERN_STL - -// Here, we identify compilers we now have problems with STL. -%{ -#if defined(__GNUC__) -# if __GNUC__ == 2 && __GNUC_MINOR <= 96 -# define SWIG_STD_NOMODERN_STL -# endif -#endif -%} - -// -// Common code for supporting the STD C++ namespace -// - -%{ -#include <string> -#include <stdexcept> -%} - -%fragment("Traits","header") -{ -namespace swig { - /* - type categories - */ - struct pointer_category { }; - struct value_category { }; - - /* - General traits that provides type_name and type_info - */ - template <class Type> struct traits { }; - - template <class Type> - inline const char* type_name() { - return traits<Type>::type_name(); - } - - template <class Type> - struct traits_info { - static swig_type_info *type_query(std::string name) { - name += " *"; - return SWIG_TypeQuery(name.c_str()); - } - static swig_type_info *type_info() { - static swig_type_info *info = type_query(type_name<Type>()); - return info; - } - }; - - template <class Type> - inline swig_type_info *type_info() { - return traits_info<Type>::type_info(); - } - - /* - Partial specialization for pointers - */ - template <class Type> struct traits <Type *> { - typedef pointer_category category; - static std::string make_ptr_name(const char* name) { - std::string ptrname = name; - ptrname += " *"; - return ptrname; - } - static const char* type_name() { - static std::string name = make_ptr_name(swig::type_name<Type>()); - return name.c_str(); - } - }; - - - template <class Type, class Category = typename traits<Type>::category > - struct traits_check { }; - - /* - Traits that provides the from method for an unknown type - */ - template <int flags, class Type> struct traits_from_ptr { - static SWIG_Object from SWIG_FROM_DECL_ARGS(Type *val) { - return SWIG_NewPointerObj(val, type_info<Type>(), flags); - } - }; - - template <class Type> struct traits_from { - static SWIG_Object from SWIG_FROM_DECL_ARGS(const Type& val) { - return traits_from_ptr<SWIG_POINTER_OWN, Type>::from(new Type(val)); - } - }; - - template <class Type> struct traits_from<Type *> { - static SWIG_Object from SWIG_FROM_DECL_ARGS(Type* val) { - return traits_from_ptr<0, Type>::from(val); - } - }; - - template <class Type> - inline SWIG_Object from SWIG_FROM_DECL_ARGS(const Type& val) { - return traits_from<Type>::from(val); - } - - /* - Traits that provides the asptr/asval method for an unknown type - */ - template <class Type> - struct traits_asptr { - static int asptr SWIG_AS_DECL_ARGS (SWIG_Object obj, Type **val) { - Type *p; - int res = SWIG_ConvertPtr(obj, %as_voidptrptr(&p), type_info<Type>(), 0); - if (SWIG_IsOK(res) && val) *val = p; - return res; - } - }; - - template <class Type> - inline int asptr SWIG_AS_DECL_ARGS(SWIG_Object obj, Type **vptr) { - return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, vptr); - } - - template <class Type> - struct traits_asval { - static int asval SWIG_AS_DECL_ARGS(SWIG_Object obj, Type *val) { - if (val) { - Type *p = 0; - int res = traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, &p); - if (SWIG_IsOK(res) && p) { - *val = *p; - if (SWIG_IsNewObj(res)) { - %delete(p); - res = SWIG_DelNewMask(res); - } - } - return res; - } else { - return traits_asptr<Type>::asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0)); - } - } - }; - - template <class Type> - inline int asval SWIG_AS_DECL_ARGS (SWIG_Object obj, Type *val) { - return traits_asval<Type>::asval SWIG_AS_CALL_ARGS(obj, val); - } - - /* - Traits that provides the check method for an unknown type - */ -#define SWIG_CHECK_DECL_ARGS(obj) SWIG_AS_DECL_ARGS(obj, void * = 0) -#define SWIG_CHECK_CALL_ARGS(obj) SWIG_AS_CALL_ARGS(obj, 0) - - template <class Type> - struct traits_checkval { - static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) { - if (obj) { - int res = asval SWIG_AS_CALL_ARGS(obj, (Type *)(0)); - return SWIG_CheckState(res); - } else { - return 0; - } - } - }; - - template <class Type> - struct traits_checkptr { - static int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) { - if (obj) { - int res = asptr SWIG_AS_CALL_ARGS(obj, (Type **)(0)); - return SWIG_CheckState(res); - } else { - return 0; - } - } - }; - - template <class Type> - struct traits_check<Type, value_category> : traits_checkval<Type> { - }; - - template <class Type> - struct traits_check<Type, pointer_category> : traits_checkptr<Type> { - }; - - template <class Type> - inline int check SWIG_CHECK_DECL_ARGS(SWIG_Object obj) { - return traits_check<Type>::check SWIG_CHECK_CALL_ARGS(obj); - } - -} -} - -/* - Generate the traits for an unknown SWIGTYPE -*/ - -%define %traits_swigtype(Type...) -%fragment(SWIG_Traits_frag(Type),"header",fragment="Traits") { - namespace swig { - template <> struct traits<Type > { - typedef pointer_category category; - static const char* type_name() { return #Type; } - }; - } -} -%enddef - - -/* - Generate the traits for a 'value' type, such as 'double', - for which the SWIG_AsVal and SWIG_From methods are already defined. -*/ - -%define %traits_value(Type...) -%fragment(SWIG_Traits_frag(Type),"header", - fragment=SWIG_AsVal_frag(Type), - fragment=SWIG_From_frag(Type), - fragment="Traits") { -namespace swig { - template <> struct traits<Type > { - typedef value_category category; - static const char* type_name() { return #Type; } - }; - - template <> struct traits_asval<Type > { - typedef Type value_type; - static int asval SWIG_AS_DECL_ARGS (SWIG_Object obj, value_type *val) { - return SWIG_AsVal(Type)(obj, val); - } - }; - - template <> struct traits_from<Type > { - typedef Type value_type; - static SWIG_Object from SWIG_FROM_DECL_ARGS (const value_type& val) { - return SWIG_From(Type)(val); - } - }; -} -} -%enddef - -/* - Generate the traits for a 'pointer' type, such as 'std::string', - for which the SWIG_AsPtr and SWIG_From methods are already defined. -*/ - -%define %traits_pointer(Type...) -%fragment(SWIG_Traits_frag(Type),"header", - fragment=SWIG_AsVal_frag(Type), - fragment=SWIG_From_frag(Type), - fragment="Traits") { -namespace swig { - template <> struct traits<Type > { - typedef pointer_category category; - static const char* type_name() { return #Type; } - }; - - template <> struct traits_asptr<Type > { - typedef Type value_type; - static int asptr SWIG_AS_DECL_ARGS (SWIG_Object obj, value_type **val) { - return SWIG_AsPtr(Type)(obj, val); - } - }; - - template <> struct traits_from<Type > { - typedef Type value_type; - static SWIG_Object from SWIG_FROM_DECL_ARGS (const value_type& val) { - return SWIG_From(Type)(val); - } - }; -} -} -%enddef - -/* - Generate the typemaps for a class that has 'value' traits -*/ - -%define %typemap_traits_value(Code,Type...) - %typemaps_asvalfrom(%arg(Code), - %arg(swig::asval), - %arg(swig::from), - %arg(SWIG_Traits_frag(Type)), - %arg(SWIG_Traits_frag(Type)), - Type); -%enddef - -/* - Generate the typemaps for a class that has 'pointer' traits -*/ - -%define %typemap_traits_pointer(Code,Type...) - %typemaps_asptrfrom(%arg(Code), - %arg(swig::asptr), - %arg(swig::from), - %arg(SWIG_Traits_frag(Type)), - %arg(SWIG_Traits_frag(Type)), - Type); -%enddef -
diff --git a/share/swig/2.0.11/allegrocl/allegrocl.swg b/share/swig/3.0.12/allegrocl/allegrocl.swg similarity index 97% rename from share/swig/2.0.11/allegrocl/allegrocl.swg rename to share/swig/3.0.12/allegrocl/allegrocl.swg index f08f87c..152e5e6 100644 --- a/share/swig/2.0.11/allegrocl/allegrocl.swg +++ b/share/swig/3.0.12/allegrocl/allegrocl.swg
@@ -17,8 +17,7 @@ enum SWIGTYPE "(cl::setq ACL_ffresult $body)"; %typemap(lout) void "$body"; #ifdef __cplusplus -%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, - SWIGTYPE & +%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE && %{ (cl:let* ((address $body) (new-inst (cl:make-instance '$lclass :foreign-address address))) (cl:when (cl:and $owner (cl:not (cl:zerop address))) @@ -27,7 +26,7 @@ %typemap(lout) SWIGTYPE "(cl::let* ((address $body)\n (new-inst (cl::make-instance '$lclass :foreign-address address)))\n (cl::unless (cl::zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (cl::setq ACL_ffresult new-inst))"; #else -%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE +%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE %{ (cl:let* ((address $body) (new-inst (cl:make-instance '$lclass :foreign-address address))) (cl:setq ACL_ffresult new-inst)) %} @@ -67,6 +66,7 @@ %typemap(ffitype) void ":void"; %typemap(ffitype) enum SWIGTYPE ":int"; %typemap(ffitype) SWIGTYPE & "(* :void)"; +%typemap(ffitype) SWIGTYPE && "(* :void)"; /* const typemaps idea: marshall all primitive c types to their respective lisp types @@ -102,7 +102,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[], - SWIGTYPE[ANY], SWIGTYPE &, const SWIGTYPE "$1_ltype"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE &&, const SWIGTYPE "$1_ltype"; %typemap(ctype) SWIGTYPE "$&1_type"; %typemap(in) bool "$1 = (bool)$input;"; @@ -112,7 +112,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[], - SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; %typemap(in) SWIGTYPE "$1 = *$input;"; /* We don't need to do any actual C-side typechecking, but need to @@ -167,7 +167,7 @@ int, signed int, unsigned int, long, signed long, unsigned long, enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[], SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; @@ -192,7 +192,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; #ifdef __cplusplus %typemap(out) SWIGTYPE "$result = new $1_ltype($1);"; #else @@ -228,6 +228,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/allegrocl/inout_typemaps.i b/share/swig/3.0.12/allegrocl/inout_typemaps.i similarity index 100% rename from share/swig/2.0.11/allegrocl/inout_typemaps.i rename to share/swig/3.0.12/allegrocl/inout_typemaps.i
diff --git a/share/swig/2.0.11/allegrocl/longlongs.i b/share/swig/3.0.12/allegrocl/longlongs.i similarity index 100% rename from share/swig/2.0.11/allegrocl/longlongs.i rename to share/swig/3.0.12/allegrocl/longlongs.i
diff --git a/share/swig/2.0.11/allegrocl/std_list.i b/share/swig/3.0.12/allegrocl/std_list.i similarity index 100% rename from share/swig/2.0.11/allegrocl/std_list.i rename to share/swig/3.0.12/allegrocl/std_list.i
diff --git a/share/swig/2.0.11/allegrocl/std_string.i b/share/swig/3.0.12/allegrocl/std_string.i similarity index 100% rename from share/swig/2.0.11/allegrocl/std_string.i rename to share/swig/3.0.12/allegrocl/std_string.i
diff --git a/share/swig/2.0.11/allegrocl/typemaps.i b/share/swig/3.0.12/allegrocl/typemaps.i similarity index 100% rename from share/swig/2.0.11/allegrocl/typemaps.i rename to share/swig/3.0.12/allegrocl/typemaps.i
diff --git a/share/swig/2.0.11/allkw.swg b/share/swig/3.0.12/allkw.swg similarity index 71% rename from share/swig/2.0.11/allkw.swg rename to share/swig/3.0.12/allkw.swg index 2e0dad6..b941319 100644 --- a/share/swig/2.0.11/allkw.swg +++ b/share/swig/3.0.12/allkw.swg
@@ -4,14 +4,14 @@ /* Include all the known keyword warnings. Very useful for adding test - files to the test-suite, or check if your own library is ok for all + files to the test-suite, or checking if your own library is ok for all the swig supported languages. Use as swig -Wallkw ... - If you add a new language, remember to create a separete languagekw.swg + If you add a new language, remember to create a separate languagekw.swg file, and add it here. */ @@ -19,14 +19,18 @@ %include <chicken/chickenkw.swg> %include <csharp/csharpkw.swg> %include <d/dkw.swg> +%include <go/gokw.swg> %include <java/javakw.swg> +%include <lua/luakw.swg> +%include <ocaml/ocamlkw.swg> +%include <perl5/perlkw.swg> +%include <php5/phpkw.swg> %include <php/phpkw.swg> %include <pike/pikekw.swg> %include <python/pythonkw.swg> -%include <ocaml/ocamlkw.swg> +%include <r/rkw.swg> %include <ruby/rubykw.swg> %include <tcl/tclkw.swg> -%include <perl5/perlkw.swg> #endif //__Lib_allkw_swg__
diff --git a/share/swig/2.0.11/attribute.i b/share/swig/3.0.12/attribute.i similarity index 100% rename from share/swig/2.0.11/attribute.i rename to share/swig/3.0.12/attribute.i
diff --git a/share/swig/2.0.11/carrays.i b/share/swig/3.0.12/carrays.i similarity index 97% rename from share/swig/2.0.11/carrays.i rename to share/swig/3.0.12/carrays.i index f125105..3a9c3cf 100644 --- a/share/swig/2.0.11/carrays.i +++ b/share/swig/3.0.12/carrays.i
@@ -22,7 +22,7 @@ %{ static TYPE *new_##NAME(int nelements) { %} #ifdef __cplusplus -%{ return new TYPE[nelements]; %} +%{ return new TYPE[nelements](); %} #else %{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %} #endif @@ -81,7 +81,7 @@ #ifdef __cplusplus NAME(int nelements) { - return new TYPE[nelements]; + return new TYPE[nelements](); } ~NAME() { delete [] self;
diff --git a/share/swig/2.0.11/cdata.i b/share/swig/3.0.12/cdata.i similarity index 67% rename from share/swig/2.0.11/cdata.i rename to share/swig/3.0.12/cdata.i index 22a6d9d..3ac693c 100644 --- a/share/swig/2.0.11/cdata.i +++ b/share/swig/3.0.12/cdata.i
@@ -20,19 +20,57 @@ $result = scm_from_locale_stringn($1.data,$1.len); } %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); + #elif SWIGCHICKEN + %typemap(out) SWIGCDATA { C_word *string_space = C_alloc(C_SIZEOF_STRING($1.len)); $result = C_string(&string_space, $1.len, $1.data); } %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); -#elif SWIGPHP + +#elif SWIGPHP5 + %typemap(out) SWIGCDATA { ZVAL_STRINGL($result, $1.data, $1.len, 1); } %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); -#else -%echo "cdata.i module not supported." + +#elif SWIGPHP7 + +%typemap(out) SWIGCDATA { + ZVAL_STRINGL($result, $1.data, $1.len); +} +%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); + +#elif SWIGJAVA + +%apply (char *STRING, int LENGTH) { (const void *indata, int inlen) } +%typemap(jni) SWIGCDATA "jbyteArray" +%typemap(jtype) SWIGCDATA "byte[]" +%typemap(jstype) SWIGCDATA "byte[]" +%fragment("SWIG_JavaArrayOutCDATA", "header") { +static jbyteArray SWIG_JavaArrayOutCDATA(JNIEnv *jenv, char *result, jsize sz) { + jbyte *arr; + int i; + jbyteArray jresult = JCALL1(NewByteArray, jenv, sz); + if (!jresult) + return NULL; + arr = JCALL2(GetByteArrayElements, jenv, jresult, 0); + if (!arr) + return NULL; + for (i=0; i<sz; i++) + arr[i] = (jbyte)result[i]; + JCALL3(ReleaseByteArrayElements, jenv, jresult, arr, 0); + return jresult; +} +} +%typemap(out, fragment="SWIG_JavaArrayOutCDATA") SWIGCDATA +%{$result = SWIG_JavaArrayOutCDATA(jenv, (char *)$1.data, $1.len); %} +%typemap(javaout) SWIGCDATA { + return $jnicall; + } + #endif
diff --git a/share/swig/2.0.11/cffi/cffi.swg b/share/swig/3.0.12/cffi/cffi.swg similarity index 96% rename from share/swig/2.0.11/cffi/cffi.swg rename to share/swig/3.0.12/cffi/cffi.swg index 427a8dc..3ad767e 100644 --- a/share/swig/2.0.11/cffi/cffi.swg +++ b/share/swig/3.0.12/cffi/cffi.swg
@@ -67,7 +67,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$1_ltype"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1_ltype"; %typemap(ctype) SWIGTYPE "$&1_type"; %typemap(in) bool "$1 = (bool)$input;"; @@ -77,7 +77,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, void, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$1 = $input;"; %typemap(in) SWIGTYPE "$1 = *$input;"; %typemap(out) void ""; @@ -88,7 +88,7 @@ long, signed long, unsigned long, float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, - SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; + SWIGTYPE[ANY], SWIGTYPE &, SWIGTYPE && "$result = $1;"; #ifdef __cplusplus %typemap(out) SWIGTYPE "$result = new $1_type($1);"; #else @@ -109,7 +109,7 @@ int, signed int, unsigned int, long, signed long, unsigned long, enum SWIGTYPE { $1 = 1; }; -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[ANY], SWIGTYPE { $1 = 1; }; /* This maps C/C++ types to Lisp classes for overload dispatch */ @@ -132,6 +132,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/chicken/chicken.swg b/share/swig/3.0.12/chicken/chicken.swg similarity index 95% rename from share/swig/2.0.11/chicken/chicken.swg rename to share/swig/3.0.12/chicken/chicken.swg index 525c1a6..17f0d0a 100644 --- a/share/swig/2.0.11/chicken/chicken.swg +++ b/share/swig/3.0.12/chicken/chicken.swg
@@ -149,6 +149,7 @@ /* enum SWIGTYPE */ %apply int { enum SWIGTYPE }; %apply const int& { const enum SWIGTYPE& }; +%apply const int& { const enum SWIGTYPE&& }; %typemap(varin) enum SWIGTYPE { @@ -178,7 +179,7 @@ %typemap(freearg) char * "if ($1 != NULL) { free ($1); }" /* Pointers, references, and arrays */ -%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE & { +%typemap(in,closcode="(slot-ref $input 'swig-this)") SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, SWIGTYPE && { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, $disown); } @@ -199,6 +200,10 @@ $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin,closcode="(slot-ref $input 'swig-this)") SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [] { SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, "Type error"); } @@ -216,7 +221,7 @@ $1 = SWIG_MustGetPtr($input, NULL, 1, 0); } -%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); $result = SWIG_NewPointerObj($1, $descriptor, $owner); } @@ -237,6 +242,11 @@ $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); + $result = SWIG_NewPointerObj((void *) &$varname, $1_descriptor, 0); +} + /* special typemaps for class pointers */ %typemap(in) SWIGTYPE (CLASS::*) { char err_msg[256]; @@ -531,7 +541,7 @@ %typemap(constcode) char * "static const char *$result = $value;" -%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] +%typemap(constcode) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "static const void *$result = (void*) $value;" /* ------------------------------------------------------------ @@ -607,7 +617,7 @@ $1 = C_swig_is_string ($input); } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; $1 = !SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0); } @@ -628,6 +638,17 @@ } } +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && +{ + void *ptr = 0; + if (SWIG_ConvertPtr($input, &ptr, $descriptor, 0)) { + /* error */ + $1 = 0; + } else { + $1 = (ptr != 0); + } +} + %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { void *ptr = 0; @@ -673,6 +694,12 @@ SWIG_Chicken_ThrowException(ptr); } +%typemap(throws) SWIGTYPE && { + C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER); + C_word ptr = SWIG_NewPointerObj((void *)&($1),$descriptor,0); + SWIG_Chicken_ThrowException(ptr); +} + /* ------------------------------------------------------------ * ANSI C typemaps * ------------------------------------------------------------ */ @@ -685,6 +712,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/chicken/chickenkw.swg b/share/swig/3.0.12/chicken/chickenkw.swg similarity index 100% rename from share/swig/2.0.11/chicken/chickenkw.swg rename to share/swig/3.0.12/chicken/chickenkw.swg
diff --git a/share/swig/2.0.11/chicken/chickenrun.swg b/share/swig/3.0.12/chicken/chickenrun.swg similarity index 98% rename from share/swig/2.0.11/chicken/chickenrun.swg rename to share/swig/3.0.12/chicken/chickenrun.swg index 07db419..f134001 100644 --- a/share/swig/2.0.11/chicken/chickenrun.swg +++ b/share/swig/3.0.12/chicken/chickenrun.swg
@@ -313,7 +313,7 @@ swig_module_info *ret = 0; C_word sym; - /* lookup the type pointer... it is stored in it's own symbol table */ + /* lookup the type pointer... it is stored in its own symbol table */ C_SYMBOL_TABLE *stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION); if (stable != NULL) { sym = SWIG_Chicken_LookupSymbol(chicken_runtimevar_name, stable); @@ -333,7 +333,7 @@ C_word pointer; static C_word *space = 0; - /* type pointer is stored in it's own symbol table */ + /* type pointer is stored in its own symbol table */ stable = C_find_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION); if (stable == NULL) { stable = C_new_symbol_table("swig_runtime_data" SWIG_RUNTIME_VERSION, 16);
diff --git a/share/swig/2.0.11/chicken/multi-generic.scm b/share/swig/3.0.12/chicken/multi-generic.scm similarity index 100% rename from share/swig/2.0.11/chicken/multi-generic.scm rename to share/swig/3.0.12/chicken/multi-generic.scm
diff --git a/share/swig/2.0.11/chicken/std_string.i b/share/swig/3.0.12/chicken/std_string.i similarity index 100% rename from share/swig/2.0.11/chicken/std_string.i rename to share/swig/3.0.12/chicken/std_string.i
diff --git a/share/swig/2.0.11/chicken/swigclosprefix.scm b/share/swig/3.0.12/chicken/swigclosprefix.scm similarity index 100% rename from share/swig/2.0.11/chicken/swigclosprefix.scm rename to share/swig/3.0.12/chicken/swigclosprefix.scm
diff --git a/share/swig/2.0.11/chicken/tinyclos-multi-generic.patch b/share/swig/3.0.12/chicken/tinyclos-multi-generic.patch similarity index 100% rename from share/swig/2.0.11/chicken/tinyclos-multi-generic.patch rename to share/swig/3.0.12/chicken/tinyclos-multi-generic.patch
diff --git a/share/swig/2.0.11/chicken/typemaps.i b/share/swig/3.0.12/chicken/typemaps.i similarity index 100% rename from share/swig/2.0.11/chicken/typemaps.i rename to share/swig/3.0.12/chicken/typemaps.i
diff --git a/share/swig/2.0.11/clisp/clisp.swg b/share/swig/3.0.12/clisp/clisp.swg similarity index 100% rename from share/swig/2.0.11/clisp/clisp.swg rename to share/swig/3.0.12/clisp/clisp.swg
diff --git a/share/swig/2.0.11/cmalloc.i b/share/swig/3.0.12/cmalloc.i similarity index 100% rename from share/swig/2.0.11/cmalloc.i rename to share/swig/3.0.12/cmalloc.i
diff --git a/share/swig/2.0.11/constraints.i b/share/swig/3.0.12/constraints.i similarity index 100% rename from share/swig/2.0.11/constraints.i rename to share/swig/3.0.12/constraints.i
diff --git a/share/swig/2.0.11/cpointer.i b/share/swig/3.0.12/cpointer.i similarity index 100% rename from share/swig/2.0.11/cpointer.i rename to share/swig/3.0.12/cpointer.i
diff --git a/share/swig/2.0.11/csharp/arrays_csharp.i b/share/swig/3.0.12/csharp/arrays_csharp.i similarity index 83% rename from share/swig/2.0.11/csharp/arrays_csharp.i rename to share/swig/3.0.12/csharp/arrays_csharp.i index 513330e..237067a 100644 --- a/share/swig/2.0.11/csharp/arrays_csharp.i +++ b/share/swig/3.0.12/csharp/arrays_csharp.i
@@ -57,7 +57,7 @@ %typemap(ctype) CTYPE INPUT[] "CTYPE*" %typemap(cstype) CTYPE INPUT[] "CSTYPE[]" -%typemap(imtype, inattributes="[In, MarshalAs(UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INPUT[] "CSTYPE[]" %typemap(csin) CTYPE INPUT[] "$csinput" %typemap(in) CTYPE INPUT[] "$1 = $input;" @@ -68,7 +68,7 @@ %typemap(ctype) CTYPE OUTPUT[] "CTYPE*" %typemap(cstype) CTYPE OUTPUT[] "CSTYPE[]" -%typemap(imtype, inattributes="[Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE OUTPUT[] "CSTYPE[]" %typemap(csin) CTYPE OUTPUT[] "$csinput" %typemap(in) CTYPE OUTPUT[] "$1 = $input;" @@ -79,7 +79,7 @@ %typemap(ctype) CTYPE INOUT[] "CTYPE*" %typemap(cstype) CTYPE INOUT[] "CSTYPE[]" -%typemap(imtype, inattributes="[In, Out, MarshalAs(UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.Out, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE INOUT[] "CSTYPE[]" %typemap(csin) CTYPE INOUT[] "$csinput" %typemap(in) CTYPE INOUT[] "$1 = $input;" @@ -103,17 +103,18 @@ CSHARP_ARRAYS(unsigned long long, ulong) CSHARP_ARRAYS(float, float) CSHARP_ARRAYS(double, double) +CSHARP_ARRAYS(bool, bool) %define CSHARP_ARRAYS_FIXED( CTYPE, CSTYPE ) %typemap(ctype) CTYPE FIXED[] "CTYPE*" -%typemap(imtype) CTYPE FIXED[] "IntPtr" +%typemap(imtype) CTYPE FIXED[] "global::System.IntPtr" %typemap(cstype) CTYPE FIXED[] "CSTYPE[]" %typemap(csin, pre= " fixed ( CSTYPE* swig_ptrTo_$csinput = $csinput ) {", terminator=" }") - CTYPE FIXED[] "(IntPtr)swig_ptrTo_$csinput" + CTYPE FIXED[] "(global::System.IntPtr)swig_ptrTo_$csinput" %typemap(in) CTYPE FIXED[] "$1 = $input;" %typemap(freearg) CTYPE FIXED[] "" @@ -134,4 +135,5 @@ CSHARP_ARRAYS_FIXED(unsigned long long, ulong) CSHARP_ARRAYS_FIXED(float, float) CSHARP_ARRAYS_FIXED(double, double) +CSHARP_ARRAYS_FIXED(bool, bool)
diff --git a/share/swig/2.0.11/csharp/boost_intrusive_ptr.i b/share/swig/3.0.12/csharp/boost_intrusive_ptr.i similarity index 73% rename from share/swig/2.0.11/csharp/boost_intrusive_ptr.i rename to share/swig/3.0.12/csharp/boost_intrusive_ptr.i index 09a1647..d0a048d 100644 --- a/share/swig/2.0.11/csharp/boost_intrusive_ptr.i +++ b/share/swig/3.0.12/csharp/boost_intrusive_ptr.i
@@ -1,511 +1,510 @@ -// Users can provide their own SWIG_INTRUSIVE_PTR_TYPEMAPS or SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP macros before including this file to change the -// visibility of the constructor and getCPtr method if desired to public if using multiple modules. -#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS -#define SWIG_INTRUSIVE_PTR_TYPEMAPS(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE) -#endif -#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP -#define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(internal, internal, CONST, TYPE) -#endif - -%include <intrusive_ptr.i> - -// Language specific macro implementing all the customisations for handling the smart pointer -%define SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...) - -// %naturalvar is as documented for member variables -%naturalvar TYPE; -%naturalvar SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >; - -// destructor wrapper customisation -%feature("unref") TYPE "(void)arg1; delete smartarg1;" - -// Typemap customisations... - -%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - // plain value - argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0; - if (!argp) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); - return $null; - } - $1 = *argp; -%} -%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ - //plain value(out) - $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); - intrusive_ptr_add_ref(resultp); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); -%} - -%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - // plain pointer - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input; - $1 = (TYPE *)(smartarg ? smartarg->get() : 0); -%} -%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE * %{ - //plain pointer(out) - #if ($owner) - if ($1) { - intrusive_ptr_add_ref($1); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } - #else - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; - #endif -%} - -%typemap(in, canthrow=1) CONST TYPE & (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - // plain reference - $1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); - if(!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0); - return $null; - } -%} -%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{ - //plain reference(out) - #if ($owner) - if ($1) { - intrusive_ptr_add_ref($1); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } - #else - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; - #endif -%} - -%typemap(in) TYPE *CONST& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - // plain pointer by reference - temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); - $1 = &temp; -%} -%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{ - // plain pointer by reference(out) - #if ($owner) - if (*$1) { - intrusive_ptr_add_ref(*$1); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1, SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } - #else - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_0); - #endif -%} - -%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ - // intrusive_ptr by value - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; - if (smartarg) { - $1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); - } -%} -%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{ - if ($1) { - intrusive_ptr_add_ref($1.get()); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1.get(), SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } -%} - -%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{ - // shared_ptr by value - smartarg = *($&1_ltype*)&$input; - if (smartarg) $1 = *smartarg; -%} -%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{ - *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; -%} - -%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ - // intrusive_ptr by reference - if ( $input ) { - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; - temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); - $1 = &temp; - } else { - $1 = &tempnull; - } -%} -%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{ - delete &($1); - if ($self) { - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * temp = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input); - $1 = *temp; - } -%} -%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{ - if (*$1) { - intrusive_ptr_add_ref($1->get()); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } -%} - -%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ - // intrusive_ptr by pointer - if ( $input ) { - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; - temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); - $1 = &temp; - } else { - $1 = &tempnull; - } -%} -%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{ - delete $1; - if ($self) $1 = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input); -%} -%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{ - if ($1 && *$1) { - intrusive_ptr_add_ref($1->get()); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } - if ($owner) delete $1; -%} - -%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& (SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > temp, $*1_ltype tempp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ - // intrusive_ptr by pointer reference - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; - if ($input) { - temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); - } - tempp = &temp; - $1 = &tempp; -%} -%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{ - if ($self) $1 = *$input; -%} -%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{ - if (*$1 && **$1) { - intrusive_ptr_add_ref((*$1)->get()); - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >((*$1)->get(), SWIG_intrusive_deleter< CONST TYPE >()); - } else { - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; - } -%} - -// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug -%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ -#error "typemaps for $1_type not available" -%} -%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ -#error "typemaps for $1_type not available" -%} - - -%typemap (ctype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *" -%typemap (imtype, out="IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "HandleRef" -%typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)" -%typemap(csin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, - SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)" - -%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{ - get { - $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode - return ret; - } %} -%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >& %{ - get { - $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode - return ret; - } %} -%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >* %{ - get { - $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode - return ret; - } %} - - -%typemap(csout, excode=SWIGEXCODE) CONST TYPE { - $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) CONST TYPE & { - $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } -%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode - return ret; - } - -// Base proxy classes -%typemap(csbody) TYPE %{ - private HandleRef swigCPtr; - private bool swigCMemOwnBase; - - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwnBase = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); - } - - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -%} - -// Derived proxy classes -%typemap(csbody_derived) TYPE %{ - private HandleRef swigCPtr; - private bool swigCMemOwnDerived; - - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { - swigCMemOwnDerived = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); - } - - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -%} - -%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { - lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { - if (swigCMemOwnBase) { - swigCMemOwnBase = false; - $imcall; - } - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - GC.SuppressFinalize(this); - } - } - -%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { - lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { - if (swigCMemOwnDerived) { - swigCMemOwnDerived = false; - $imcall; - } - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - GC.SuppressFinalize(this); - base.Dispose(); - } - } - -// CONST version needed ???? also for C# -%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef" -%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef" - - -%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; -%template() SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >; -%enddef - - -///////////////////////////////////////////////////////////////////// - - -%include <shared_ptr.i> - -%define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...) - -%naturalvar TYPE; -%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; - -// destructor mods -%feature("unref") TYPE "(void)arg1; delete smartarg1;" - - -// plain value -%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{ - argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0; - if (!argp) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); - return $null; - } - $1 = *argp; %} -%typemap(out) CONST TYPE -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} - -// plain pointer -%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ - smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input; - $1 = (TYPE *)(smartarg ? smartarg->get() : 0); %} -%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{ - *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0; -%} - -// plain reference -%typemap(in, canthrow=1) CONST TYPE & %{ - $1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); - if (!$1) { - SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0); - return $null; - } %} -%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %} - -// plain pointer by reference -%typemap(in) TYPE *CONST& ($*1_ltype temp = 0) -%{ temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); - $1 = &temp; %} -%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& -%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %} - -%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{ - // shared_ptr by value - smartarg = *($&1_ltype*)&$input; - if (smartarg) $1 = *smartarg; -%} -%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{ - *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; -%} - -// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug -%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ -#error "typemaps for $1_type not available" -%} -%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ -#error "typemaps for $1_type not available" -%} - - -%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *" -%typemap (imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *" -%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)" -%typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)" -%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { - IntPtr cPtr = $imcall; - return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); - } - -%typemap(csout, excode=SWIGEXCODE) CONST TYPE { - return new $typemap(cstype, TYPE)($imcall, true); - } -%typemap(csout, excode=SWIGEXCODE) CONST TYPE & { - return new $typemap(cstype, TYPE)($imcall, true); - } -%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { - IntPtr cPtr = $imcall; - return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); - } -%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { - IntPtr cPtr = $imcall; - return (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); - } - -// Base proxy classes -%typemap(csbody) TYPE %{ - private HandleRef swigCPtr; - private bool swigCMemOwnBase; - - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { - swigCMemOwnBase = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); - } - - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -%} - -// Derived proxy classes -%typemap(csbody_derived) TYPE %{ - private HandleRef swigCPtr; - private bool swigCMemOwnDerived; - - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { - swigCMemOwnDerived = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); - } - - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -%} - -%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { - lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { - if (swigCMemOwnBase) { - swigCMemOwnBase = false; - $imcall; - } - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - GC.SuppressFinalize(this); - } - } - -%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { - lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { - if (swigCMemOwnDerived) { - swigCMemOwnDerived = false; - $imcall; - } - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - GC.SuppressFinalize(this); - base.Dispose(); - } - } - - -// CONST version needed ???? also for C# -%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "HandleRef" -%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "HandleRef" - - -%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; -%enddef - +// Users can provide their own SWIG_INTRUSIVE_PTR_TYPEMAPS or SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP macros before including this file to change the +// visibility of the constructor and getCPtr method if desired to public if using multiple modules. +#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS +#define SWIG_INTRUSIVE_PTR_TYPEMAPS(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE) +#endif +#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP +#define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(internal, internal, CONST, TYPE) +#endif + +%include <intrusive_ptr.i> + +// Language specific macro implementing all the customisations for handling the smart pointer +%define SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...) + +// %naturalvar is as documented for member variables +%naturalvar TYPE; +%naturalvar SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >; + +// destructor wrapper customisation +%feature("unref") TYPE "(void)arg1; delete smartarg1;" + +// Typemap customisations... + +%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{ + // plain value + argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0; + if (!argp) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); + return $null; + } + $1 = *argp; +%} +%typemap(out, fragment="SWIG_intrusive_deleter") CONST TYPE %{ + //plain value(out) + $1_ltype* resultp = new $1_ltype(($1_ltype &)$1); + intrusive_ptr_add_ref(resultp); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(resultp, SWIG_intrusive_deleter< CONST TYPE >()); +%} + +%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ + // plain pointer + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input; + $1 = (TYPE *)(smartarg ? smartarg->get() : 0); +%} +%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE * %{ + //plain pointer(out) + #if ($owner) + if ($1) { + intrusive_ptr_add_ref($1); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } + #else + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; + #endif +%} + +%typemap(in, canthrow=1) CONST TYPE & %{ + // plain reference + $1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); + if(!$1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0); + return $null; + } +%} +%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") CONST TYPE & %{ + //plain reference(out) + #if ($owner) + if ($1) { + intrusive_ptr_add_ref($1); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1, SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } + #else + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_0) : 0; + #endif +%} + +%typemap(in) TYPE *CONST& ($*1_ltype temp = 0) %{ + // plain pointer by reference + temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); + $1 = &temp; +%} +%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{ + // plain pointer by reference(out) + #if ($owner) + if (*$1) { + intrusive_ptr_add_ref(*$1); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1, SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } + #else + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_0); + #endif +%} + +%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ + // intrusive_ptr by value + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; + if (smartarg) { + $1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); + } +%} +%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{ + if ($1) { + intrusive_ptr_add_ref($1.get()); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1.get(), SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } +%} + +%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{ + // shared_ptr by value + smartarg = *($&1_ltype*)&$input; + if (smartarg) $1 = *smartarg; +%} +%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{ + *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; +%} + +%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ + // intrusive_ptr by reference + if ( $input ) { + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; + temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); + $1 = &temp; + } else { + $1 = &tempnull; + } +%} +%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{ + delete &($1); + if ($self) { + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * temp = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input); + $1 = *temp; + } +%} +%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{ + if (*$1) { + intrusive_ptr_add_ref($1->get()); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } +%} + +%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ + // intrusive_ptr by pointer + if ( $input ) { + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; + temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); + $1 = &temp; + } else { + $1 = &tempnull; + } +%} +%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{ + delete $1; + if ($self) $1 = new SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(*$input); +%} +%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{ + if ($1 && *$1) { + intrusive_ptr_add_ref($1->get()); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1->get(), SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } + if ($owner) delete $1; +%} + +%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& (SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > temp, $*1_ltype tempp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{ + // intrusive_ptr by pointer reference + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input; + if ($input) { + temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true); + } + tempp = &temp; + $1 = &tempp; +%} +%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{ + if ($self) $1 = *$input; +%} +%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& %{ + if (*$1 && **$1) { + intrusive_ptr_add_ref((*$1)->get()); + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >((*$1)->get(), SWIG_intrusive_deleter< CONST TYPE >()); + } else { + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0; + } +%} + +// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug +%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ +#error "typemaps for $1_type not available" +%} +%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ +#error "typemaps for $1_type not available" +%} + + +%typemap (ctype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "void *" +%typemap (imtype, out="global::System.IntPtr") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef" +%typemap (cstype) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE)" +%typemap(csin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > &, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *, + SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)" + +%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > *& { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{ + get { + $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode + return ret; + } %} +%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >& %{ + get { + $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode + return ret; + } %} +%typemap(csvarout, excode=SWIGEXCODE2) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >* %{ + get { + $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode + return ret; + } %} + + +%typemap(csout, excode=SWIGEXCODE) CONST TYPE { + $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) CONST TYPE & { + $typemap(cstype, TYPE) ret = new $typemap(cstype, TYPE)($imcall, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } + +// Base proxy classes +%typemap(csbody) TYPE %{ + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private bool swigCMemOwnBase; + + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwnBase = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +%} + +// Derived proxy classes +%typemap(csbody_derived) TYPE %{ + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private bool swigCMemOwnDerived; + + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { + swigCMemOwnDerived = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +%} + +%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwnBase) { + swigCMemOwnBase = false; + $imcall; + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + +%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwnDerived) { + swigCMemOwnDerived = false; + $imcall; + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + base.Dispose(); + } + } + +// CONST version needed ???? also for C# +%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef" +%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef" + + +%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; +%template() SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >; +%enddef + + +///////////////////////////////////////////////////////////////////// + + +%include <shared_ptr.i> + +%define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...) + +%naturalvar TYPE; +%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; + +// destructor mods +%feature("unref") TYPE "(void)arg1; delete smartarg1;" + + +// plain value +%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{ + argp = (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0; + if (!argp) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0); + return $null; + } + $1 = *argp; %} +%typemap(out) CONST TYPE +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %} + +// plain pointer +%typemap(in) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{ + smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input; + $1 = (TYPE *)(smartarg ? smartarg->get() : 0); %} +%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{ + *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0; +%} + +// plain reference +%typemap(in, canthrow=1) CONST TYPE & %{ + $1 = ($1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); + if (!$1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0); + return $null; + } %} +%typemap(out, fragment="SWIG_null_deleter") CONST TYPE & +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %} + +// plain pointer by reference +%typemap(in) TYPE *CONST& ($*1_ltype temp = 0) +%{ temp = ($*1_ltype)((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0); + $1 = &temp; %} +%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& +%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %} + +%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{ + // shared_ptr by value + smartarg = *($&1_ltype*)&$input; + if (smartarg) $1 = *smartarg; +%} +%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > ANY_TYPE_SWIGSharedPtrUpcast %{ + *($&1_ltype*)&$result = $1 ? new $1_ltype($1) : 0; +%} + +// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug +%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ +#error "typemaps for $1_type not available" +%} +%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{ +#error "typemaps for $1_type not available" +%} + + +%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *" +%typemap (imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "void *" +%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE)" +%typemap (csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > "$typemap(cstype, TYPE).getCPtr($csinput)" +%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { + global::System.IntPtr cPtr = $imcall; + return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); + } + +%typemap(csout, excode=SWIGEXCODE) CONST TYPE { + return new $typemap(cstype, TYPE)($imcall, true); + } +%typemap(csout, excode=SWIGEXCODE) CONST TYPE & { + return new $typemap(cstype, TYPE)($imcall, true); + } +%typemap(csout, excode=SWIGEXCODE) CONST TYPE * { + global::System.IntPtr cPtr = $imcall; + return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); + } +%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { + global::System.IntPtr cPtr = $imcall; + return (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true); + } + +// Base proxy classes +%typemap(csbody) TYPE %{ + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private bool swigCMemOwnBase; + + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwnBase = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +%} + +// Derived proxy classes +%typemap(csbody_derived) TYPE %{ + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private bool swigCMemOwnDerived; + + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { + swigCMemOwnDerived = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } +%} + +%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwnBase) { + swigCMemOwnBase = false; + $imcall; + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + +%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { + lock(this) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { + if (swigCMemOwnDerived) { + swigCMemOwnDerived = false; + $imcall; + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + base.Dispose(); + } + } + + +// CONST version needed ???? also for C# +%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef" +%typemap(imtype, nopgcpp="1") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "global::System.Runtime.InteropServices.HandleRef" + + +%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; +%enddef
diff --git a/share/swig/2.0.11/csharp/boost_shared_ptr.i b/share/swig/3.0.12/csharp/boost_shared_ptr.i similarity index 72% rename from share/swig/2.0.11/csharp/boost_shared_ptr.i rename to share/swig/3.0.12/csharp/boost_shared_ptr.i index 5e6f664..2b65bf2 100644 --- a/share/swig/2.0.11/csharp/boost_shared_ptr.i +++ b/share/swig/3.0.12/csharp/boost_shared_ptr.i
@@ -95,10 +95,10 @@ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *" -%typemap (imtype, out="IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, +%typemap (imtype, out="global::System.IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "HandleRef" + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "global::System.Runtime.InteropServices.HandleRef" %typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, @@ -110,23 +110,23 @@ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(cstype, TYPE).getCPtr($csinput)" %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } @@ -140,13 +140,13 @@ return ret; } %typemap(csout, excode=SWIGEXCODE) CONST TYPE * { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %typemap(csout, excode=SWIGEXCODE) TYPE *CONST& { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } @@ -157,78 +157,78 @@ } %} %typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{ get { - IntPtr cPtr = $imcall; - $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode return ret; } %} %typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{ get { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %} %typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{ get { - IntPtr cPtr = $imcall; - $typemap(cstype, TYPE) ret = (cPtr == IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + global::System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == global::System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } %} // Proxy classes (base classes, ie, not derived classes) %typemap(csbody) TYPE %{ - private HandleRef swigCPtr; + private global::System.Runtime.InteropServices.HandleRef swigCPtr; private bool swigCMemOwnBase; - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwnBase = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } %} // Derived proxy classes %typemap(csbody_derived) TYPE %{ - private HandleRef swigCPtr; + private global::System.Runtime.InteropServices.HandleRef swigCPtr; private bool swigCMemOwnDerived; - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) { swigCMemOwnDerived = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } %} %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE { lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwnBase) { swigCMemOwnBase = false; $imcall; } - swigCPtr = new HandleRef(null, IntPtr.Zero); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - GC.SuppressFinalize(this); + global::System.GC.SuppressFinalize(this); } } %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE { lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwnDerived) { swigCMemOwnDerived = false; $imcall; } - swigCPtr = new HandleRef(null, IntPtr.Zero); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - GC.SuppressFinalize(this); + global::System.GC.SuppressFinalize(this); base.Dispose(); } }
diff --git a/share/swig/2.0.11/csharp/csharp.swg b/share/swig/3.0.12/csharp/csharp.swg similarity index 82% rename from share/swig/2.0.11/csharp/csharp.swg rename to share/swig/3.0.12/csharp/csharp.swg index c0b896e..8dc2ba8 100644 --- a/share/swig/2.0.11/csharp/csharp.swg +++ b/share/swig/3.0.12/csharp/csharp.swg
@@ -11,16 +11,34 @@ * The imtype typemap contains the C# type used in the intermediary class. * The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */ +/* SWIG 3 no longer inserts using directives into generated C# code. For backwards compatibility, the SWIG2_CSHARP + macro can be defined to have SWIG 3 generate using directives similar to those generated by SWIG 2. */ +#ifdef SWIG2_CSHARP + +%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing global::System;\nusing global::System.Runtime.InteropServices;\n" + +%pragma(csharp) moduleimports=%{ +using global::System; +using global::System.Runtime.InteropServices; +%} + +%pragma(csharp) imclassimports=%{ +using global::System; +using global::System.Runtime.InteropServices; +%} + +#endif + /* Fragments */ %fragment("SWIG_PackData", "header") { /* Pack binary data into a string */ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } @@ -31,11 +49,11 @@ %fragment("SWIG_UnPackData", "header") { /* Unpack binary data from a string */ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) @@ -110,21 +128,25 @@ /* Non primitive types */ %typemap(ctype) SWIGTYPE "void *" -%typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE "global::System.Runtime.InteropServices.HandleRef" %typemap(cstype) SWIGTYPE "$&csclassname" %typemap(ctype) SWIGTYPE [] "void *" -%typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE [] "global::System.Runtime.InteropServices.HandleRef" %typemap(cstype) SWIGTYPE [] "$csclassname" %typemap(ctype) SWIGTYPE * "void *" -%typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE * "global::System.Runtime.InteropServices.HandleRef" %typemap(cstype) SWIGTYPE * "$csclassname" %typemap(ctype) SWIGTYPE & "void *" -%typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE & "global::System.Runtime.InteropServices.HandleRef" %typemap(cstype) SWIGTYPE & "$csclassname" +%typemap(ctype) SWIGTYPE && "void *" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE && "global::System.Runtime.InteropServices.HandleRef" +%typemap(cstype) SWIGTYPE && "$csclassname" + /* pointer to a class member */ %typemap(ctype) SWIGTYPE (CLASS::*) "char *" %typemap(imtype) SWIGTYPE (CLASS::*) "string" @@ -181,7 +203,7 @@ %typemap(directorin) int "$input = $1;" %typemap(directorin) unsigned int "$input = $1;" %typemap(directorin) long "$input = $1;" -%typemap(directorin) unsigned long "$input = $1;" +%typemap(directorin) unsigned long "$input = (unsigned long)$1;" %typemap(directorin) long long "$input = $1;" %typemap(directorin) unsigned long long "$input = $1;" %typemap(directorin) float "$input = $1;" @@ -387,8 +409,8 @@ #endif %typemap(directorin) SWIGTYPE -%{ $input = (void *)&$1; %} -%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, false)" +%{ $input = (void *)new $1_ltype((const $1_ltype &)$1); %} +%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, true)" %typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle" /* Generic pointers and references */ @@ -401,6 +423,11 @@ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); return $null; } %} +%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input; + if (!$1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0); + return $null; + } %} %typemap(out) SWIGTYPE * %{ $result = (void *)$1; %} %typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{ char buf[128]; @@ -409,6 +436,7 @@ $result = SWIG_csharp_string_callback(buf); %} %typemap(out) SWIGTYPE & %{ $result = (void *)$1; %} +%typemap(out) SWIGTYPE && %{ $result = (void *)$1; %} %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE * %{ $result = ($1_ltype)$input; %} @@ -426,12 +454,21 @@ return $null; } $result = ($1_ltype)$input; %} +%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE && +%{ if (!$input) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0); + return $null; + } + $result = ($1_ltype)$input; %} %typemap(directorin) SWIGTYPE & %{ $input = ($1_ltype) &$1; %} +%typemap(directorin) SWIGTYPE && +%{ $input = ($1_ltype) &$1; %} -%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == IntPtr.Zero) ? null : new $csclassname($iminput, false)" +%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == global::System.IntPtr.Zero) ? null : new $csclassname($iminput, false)" %typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)" -%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle" +%typemap(csdirectorin) SWIGTYPE && "new $csclassname($iminput, false)" +%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$csclassname.getCPtr($cscall).Handle" /* Default array handling */ %typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %} @@ -526,6 +563,7 @@ SWIGTYPE, SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const&, SWIGTYPE [], SWIGTYPE (CLASS::*) @@ -544,7 +582,7 @@ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg); return $null; %} -%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY] +%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [ANY] %{ (void)$1; SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown"); return $null; %} @@ -575,7 +613,7 @@ "$csinput" %typemap(csin) char *, char *&, char[ANY], char[] "$csinput" %typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)" -%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)" +%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)" %typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)" /* The csout typemap is used for converting function return types from the return type @@ -658,9 +696,13 @@ $csclassname ret = new $csclassname($imcall, $owner);$excode return ret; } +%typemap(csout, excode=SWIGEXCODE) SWIGTYPE && { + $csclassname ret = new $csclassname($imcall, $owner);$excode + return ret; + } %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] { - IntPtr cPtr = $imcall; - $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode + global::System.IntPtr cPtr = $imcall; + $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode return ret; } %typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) { @@ -671,7 +713,7 @@ /* Properties */ -%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ +%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ set { $imcall;$excode } %} @@ -772,10 +814,15 @@ $csclassname ret = new $csclassname($imcall, $owner);$excode return ret; } %} +%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE && %{ + get { + $csclassname ret = new $csclassname($imcall, $owner);$excode + return ret; + } %} %typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{ get { - IntPtr cPtr = $imcall; - $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode + global::System.IntPtr cPtr = $imcall; + $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode return ret; } %} @@ -788,12 +835,12 @@ /* Pointer reference typemaps */ %typemap(ctype) SWIGTYPE *const& "void *" -%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE *const& "global::System.Runtime.InteropServices.HandleRef" %typemap(cstype) SWIGTYPE *const& "$*csclassname" %typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)" %typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& { - IntPtr cPtr = $imcall; - $*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode + global::System.IntPtr cPtr = $imcall; + $*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode return ret; } %typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0) @@ -802,27 +849,27 @@ %typemap(out) SWIGTYPE *const& %{ $result = (void *)*$1; %} -/* Marshal C/C++ pointer to IntPtr */ +/* Marshal C/C++ pointer to global::System.IntPtr */ %typemap(ctype) void *VOID_INT_PTR "void *" -%typemap(imtype) void *VOID_INT_PTR "IntPtr" -%typemap(cstype) void *VOID_INT_PTR "IntPtr" +%typemap(imtype) void *VOID_INT_PTR "global::System.IntPtr" +%typemap(cstype) void *VOID_INT_PTR "global::System.IntPtr" %typemap(in) void *VOID_INT_PTR %{ $1 = ($1_ltype)$input; %} %typemap(out) void *VOID_INT_PTR %{ $result = (void *)$1; %} %typemap(csin) void *VOID_INT_PTR "$csinput" %typemap(csout, excode=SWIGEXCODE) void *VOID_INT_PTR { - IntPtr ret = $imcall;$excode + global::System.IntPtr ret = $imcall;$excode return ret; } - +%typemap(csdirectorin) void *VOID_INT_PTR "$iminput" +%typemap(csdirectorout) void *VOID_INT_PTR "$cscall" /* Typemaps used for the generation of proxy and type wrapper class code */ -%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" -%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n" -%typemap(csinterfaces) SWIGTYPE "IDisposable" -%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" +%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(csinterfaces) SWIGTYPE "global::System.IDisposable" +%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" // csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users. @@ -830,48 +877,48 @@ %define SWIG_CSBODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) // Proxy classes (base classes, ie, not derived classes) %typemap(csbody) TYPE %{ - private HandleRef swigCPtr; + private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) { + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; - swigCPtr = new HandleRef(this, cPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } %} // Derived proxy classes %typemap(csbody_derived) TYPE %{ - private HandleRef swigCPtr; + private global::System.Runtime.InteropServices.HandleRef swigCPtr; - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) { - swigCPtr = new HandleRef(this, cPtr); + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } %} %enddef %define SWIG_CSBODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) // Typewrapper classes -%typemap(csbody) TYPE *, TYPE &, TYPE [] %{ - private HandleRef swigCPtr; +%typemap(csbody) TYPE *, TYPE &, TYPE &&, TYPE [] %{ + private global::System.Runtime.InteropServices.HandleRef swigCPtr; - PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool futureUse) { - swigCPtr = new HandleRef(this, cPtr); + PTRCTOR_VISIBILITY $csclassname(global::System.IntPtr cPtr, bool futureUse) { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } DEFAULTCTOR_VISIBILITY $csclassname() { - swigCPtr = new HandleRef(null, IntPtr.Zero); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + CPTR_VISIBILITY static global::System.Runtime.InteropServices.HandleRef getCPtr($csclassname obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } %} @@ -909,27 +956,27 @@ %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE { lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; $imcall; } - swigCPtr = new HandleRef(null, IntPtr.Zero); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - GC.SuppressFinalize(this); + global::System.GC.SuppressFinalize(this); } } %typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE { lock(this) { - if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; $imcall; } - swigCPtr = new HandleRef(null, IntPtr.Zero); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - GC.SuppressFinalize(this); + global::System.GC.SuppressFinalize(this); base.Dispose(); } } @@ -948,20 +995,11 @@ #define %csmethodmodifiers %feature("cs:methodmodifiers") #define %csnothrowexception %feature("except") #define %csattributes %feature("cs:attributes") +#define %proxycode %insert("proxycode") %pragma(csharp) imclassclassmodifiers="class" %pragma(csharp) moduleclassmodifiers="public class" -%pragma(csharp) moduleimports=%{ -using System; -using System.Runtime.InteropServices; -%} - -%pragma(csharp) imclassimports=%{ -using System; -using System.Runtime.InteropServices; -%} - /* Some ANSI C typemaps */ %apply unsigned long { size_t }; @@ -969,6 +1007,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } @@ -985,23 +1024,23 @@ /* // Alternative char * typemaps. %pragma(csharp) imclasscode=%{ - public class SWIGStringMarshal : IDisposable { - public readonly HandleRef swigCPtr; + public class SWIGStringMarshal : global::System.IDisposable { + public readonly global::System.Runtime.InteropServices.HandleRef swigCPtr; public SWIGStringMarshal(string str) { - swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str)); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, global::System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str)); } public virtual void Dispose() { - System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle); - GC.SuppressFinalize(this); + global::System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle); + global::System.GC.SuppressFinalize(this); } } %} -%typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef" +%typemap(imtype, out="global::System.IntPtr") char *, char[ANY], char[] "global::System.Runtime.InteropServices.HandleRef" %typemap(out) char *, char[ANY], char[] %{ $result = $1; %} %typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr" %typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] { - string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode + string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode return ret; } %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ @@ -1010,7 +1049,7 @@ } %} %typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ get { - string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode + string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode return ret; } %} */
diff --git a/share/swig/2.0.11/csharp/csharphead.swg b/share/swig/3.0.12/csharp/csharphead.swg similarity index 84% rename from share/swig/2.0.11/csharp/csharphead.swg rename to share/swig/3.0.12/csharp/csharphead.swg index a1c56a4..0b55635 100644 --- a/share/swig/2.0.11/csharp/csharphead.swg +++ b/share/swig/3.0.12/csharp/csharphead.swg
@@ -149,7 +149,7 @@ static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException); static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException); - [DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")] + [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")] public static extern void SWIGRegisterExceptionCallbacks_$module( ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, @@ -163,58 +163,58 @@ ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate); - [DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")] + [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")] public static extern void SWIGRegisterExceptionCallbacksArgument_$module( ExceptionArgumentDelegate argumentDelegate, ExceptionArgumentDelegate argumentNullDelegate, ExceptionArgumentDelegate argumentOutOfRangeDelegate); static void SetPendingApplicationException(string message) { - SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve())); } static void SetPendingArithmeticException(string message) { - SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve())); } static void SetPendingDivideByZeroException(string message) { - SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve())); } static void SetPendingIndexOutOfRangeException(string message) { - SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve())); } static void SetPendingInvalidCastException(string message) { - SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve())); } static void SetPendingInvalidOperationException(string message) { - SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve())); } static void SetPendingIOException(string message) { - SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve())); } static void SetPendingNullReferenceException(string message) { - SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve())); } static void SetPendingOutOfMemoryException(string message) { - SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve())); } static void SetPendingOverflowException(string message) { - SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve())); } static void SetPendingSystemException(string message) { - SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve())); } static void SetPendingArgumentException(string message, string paramName) { - SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve())); + SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve())); } static void SetPendingArgumentNullException(string message, string paramName) { - Exception e = SWIGPendingException.Retrieve(); + global::System.Exception e = SWIGPendingException.Retrieve(); if (e != null) message = message + " Inner Exception: " + e.Message; - SWIGPendingException.Set(new System.ArgumentNullException(paramName, message)); + SWIGPendingException.Set(new global::System.ArgumentNullException(paramName, message)); } static void SetPendingArgumentOutOfRangeException(string message, string paramName) { - Exception e = SWIGPendingException.Retrieve(); + global::System.Exception e = SWIGPendingException.Retrieve(); if (e != null) message = message + " Inner Exception: " + e.Message; - SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message)); + SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message)); } static SWIGExceptionHelper() { @@ -241,8 +241,8 @@ protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper(); public class SWIGPendingException { - [ThreadStatic] - private static Exception pendingException = null; + [global::System.ThreadStatic] + private static global::System.Exception pendingException = null; private static int numExceptionsPending = 0; public static bool Pending { @@ -255,17 +255,17 @@ } } - public static void Set(Exception e) { + public static void Set(global::System.Exception e) { if (pendingException != null) - throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e); + throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e); pendingException = e; lock(typeof($imclassname)) { numExceptionsPending++; } } - public static Exception Retrieve() { - Exception e = null; + public static global::System.Exception Retrieve() { + global::System.Exception e = null; if (numExceptionsPending > 0) { if (pendingException != null) { e = pendingException; @@ -294,7 +294,7 @@ public delegate string SWIGStringDelegate(string message); static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString); - [DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")] + [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")] public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate); static string CreateString(string cString) {
diff --git a/share/swig/2.0.11/csharp/csharpkw.swg b/share/swig/3.0.12/csharp/csharpkw.swg similarity index 87% rename from share/swig/2.0.11/csharp/csharpkw.swg rename to share/swig/3.0.12/csharp/csharpkw.swg index 9a6d979..824f618 100644 --- a/share/swig/2.0.11/csharp/csharpkw.swg +++ b/share/swig/3.0.12/csharp/csharpkw.swg
@@ -2,7 +2,9 @@ #define CSHARP_CSHARPKW_SWG_ /* Warnings for C# keywords */ -#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '_" `x` "'",rename="_%s") `x` +#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '" `x` "_'",rename="%s_") `x` + +#define CSHARPCLASSKW(x) %keywordwarn("'" `x` "' is a special method name used in the C# wrapper classes, class renamed to '" `x` "_'",%$isclass,rename="%s_") `x` /* from @@ -88,6 +90,7 @@ CSHARPKW(volatile); CSHARPKW(while); +CSHARPCLASSKW(delete); #undef CSHARPKW
diff --git a/share/swig/2.0.11/csharp/director.swg b/share/swig/3.0.12/csharp/director.swg similarity index 67% rename from share/swig/2.0.11/csharp/director.swg rename to share/swig/3.0.12/csharp/director.swg index 7768d8c..3438f2b 100644 --- a/share/swig/2.0.11/csharp/director.swg +++ b/share/swig/3.0.12/csharp/director.swg
@@ -1,16 +1,15 @@ /* ----------------------------------------------------------------------------- * director.swg * - * This file contains support for director classes so that C# proxy + * This file contains support for director classes so that C# proxy * methods can be called from C++. * ----------------------------------------------------------------------------- */ -#ifdef __cplusplus - #if defined(DEBUG_DIRECTOR_OWNED) #include <iostream> #endif #include <string> +#include <exception> namespace Swig { /* Director base class - not currently used in C# directors */ @@ -18,30 +17,30 @@ }; /* Base class for director exceptions */ - class DirectorException { + class DirectorException : public std::exception { protected: std::string swig_msg; public: - DirectorException(const char* msg) : swig_msg(msg) { + DirectorException(const char *msg) : swig_msg(msg) { } + DirectorException(const std::string &msg) : swig_msg(msg) { } - const std::string& what() const { - return swig_msg; + + virtual ~DirectorException() throw() { } - virtual ~DirectorException() { + + const char *what() const throw() { + return swig_msg.c_str(); } }; /* Pure virtual method exception */ - class DirectorPureVirtualException : public Swig::DirectorException { + class DirectorPureVirtualException : public DirectorException { public: - DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) { + DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) { } }; } -#endif /* __cplusplus */ - -
diff --git a/share/swig/2.0.11/csharp/enums.swg b/share/swig/3.0.12/csharp/enums.swg similarity index 91% rename from share/swig/2.0.11/csharp/enums.swg rename to share/swig/3.0.12/csharp/enums.swg index 70e483f..5cc2654 100644 --- a/share/swig/2.0.11/csharp/enums.swg +++ b/share/swig/3.0.12/csharp/enums.swg
@@ -13,12 +13,12 @@ %typemap(in) const enum SWIGTYPE & ($*1_ltype temp) %{ temp = ($*1_ltype)$input; $1 = &temp; %} -%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %} +%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %} %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE & %{ static $*1_ltype temp = ($*1_ltype)$input; $result = &temp; %} -%typemap(directorin) const enum SWIGTYPE & "$input = $1;" +%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;" %typemap(csdirectorin) const enum SWIGTYPE & "($*csclassname)$iminput" %typemap(csdirectorout) const enum SWIGTYPE & "(int)$cscall" @@ -48,10 +48,10 @@ %typemap(cstype) enum SWIGTYPE "$csclassname" %typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %} -%typemap(out) enum SWIGTYPE %{ $result = $1; %} +%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %} %typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %} -%typemap(directorin) enum SWIGTYPE "$input = $1;" +%typemap(directorin) enum SWIGTYPE "$input = (int)$1;" %typemap(csdirectorin) enum SWIGTYPE "($csclassname)$iminput" %typemap(csdirectorout) enum SWIGTYPE "(int)$cscall"
diff --git a/share/swig/2.0.11/csharp/enumsimple.swg b/share/swig/3.0.12/csharp/enumsimple.swg similarity index 91% rename from share/swig/2.0.11/csharp/enumsimple.swg rename to share/swig/3.0.12/csharp/enumsimple.swg index a193e75..24e4bcf 100644 --- a/share/swig/2.0.11/csharp/enumsimple.swg +++ b/share/swig/3.0.12/csharp/enumsimple.swg
@@ -15,12 +15,12 @@ %typemap(in) const enum SWIGTYPE & ($*1_ltype temp) %{ temp = ($*1_ltype)$input; $1 = &temp; %} -%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %} +%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %} %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE & %{ static $*1_ltype temp = ($*1_ltype)$input; $result = &temp; %} -%typemap(directorin) const enum SWIGTYPE & "$input = $1;" +%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;" %typemap(csdirectorin) const enum SWIGTYPE & "$iminput" %typemap(csdirectorout) const enum SWIGTYPE & "$cscall" @@ -50,10 +50,10 @@ %typemap(cstype) enum SWIGTYPE "int" %typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %} -%typemap(out) enum SWIGTYPE %{ $result = $1; %} +%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %} %typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %} -%typemap(directorin) enum SWIGTYPE "$input = $1;" +%typemap(directorin) enum SWIGTYPE "$input = (int)$1;" %typemap(csdirectorin) enum SWIGTYPE "$iminput" %typemap(csdirectorout) enum SWIGTYPE "$cscall"
diff --git a/share/swig/2.0.11/csharp/enumtypesafe.swg b/share/swig/3.0.12/csharp/enumtypesafe.swg similarity index 92% rename from share/swig/2.0.11/csharp/enumtypesafe.swg rename to share/swig/3.0.12/csharp/enumtypesafe.swg index ed483f0..fd68017 100644 --- a/share/swig/2.0.11/csharp/enumtypesafe.swg +++ b/share/swig/3.0.12/csharp/enumtypesafe.swg
@@ -14,12 +14,12 @@ %typemap(in) const enum SWIGTYPE & ($*1_ltype temp) %{ temp = ($*1_ltype)$input; $1 = &temp; %} -%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %} +%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %} %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE & %{ static $*1_ltype temp = ($*1_ltype)$input; $result = &temp; %} -%typemap(directorin) const enum SWIGTYPE & "$input = $1;" +%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;" %typemap(csdirectorin) const enum SWIGTYPE & "$*csclassname.swigToEnum($iminput)" %typemap(csdirectorout) const enum SWIGTYPE & "$cscall.swigValue" @@ -49,10 +49,10 @@ %typemap(cstype) enum SWIGTYPE "$csclassname" %typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %} -%typemap(out) enum SWIGTYPE %{ $result = $1; %} +%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %} %typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %} -%typemap(directorin) enum SWIGTYPE "$input = $1;" +%typemap(directorin) enum SWIGTYPE "$input = (int)$1;" %typemap(csdirectorin) enum SWIGTYPE "$csclassname.swigToEnum($iminput)" %typemap(csdirectorout) enum SWIGTYPE "$cscall.swigValue" @@ -97,7 +97,7 @@ for (int i = 0; i < swigValues.Length; i++) if (swigValues[i].swigValue == swigValue) return swigValues[i]; - throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue); + throw new global::System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue); } public override string ToString() {
diff --git a/share/swig/3.0.12/csharp/std_array.i b/share/swig/3.0.12/csharp/std_array.i new file mode 100644 index 0000000..61bb510 --- /dev/null +++ b/share/swig/3.0.12/csharp/std_array.i
@@ -0,0 +1,227 @@ +/* ----------------------------------------------------------------------------- + * std_array.i + * + * SWIG typemaps for std::array<T, N> + * C# implementation + * The C# wrapper is made to look and feel like a C# System.Collections.Generic.IReadOnlyList<> collection. + * ----------------------------------------------------------------------------- */ + +%{ +#include <algorithm> +#include <array> +#include <stdexcept> +%} + +%include <std_common.i> + + +%define SWIG_STD_ARRAY_INTERNAL(T, N) +%typemap(csinterfaces) std::array< T, N > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>\n"; +%proxycode %{ + public $csclassname(global::System.Collections.ICollection c) : this() { + if (c == null) + throw new global::System.ArgumentNullException("c"); + int end = global::System.Math.Min(this.Count, c.Count); + int i = 0; + foreach ($typemap(cstype, T) elem in c) { + if (i >= end) + break; + this[i++] = elem; + } + } + + public int Count { + get { + return (int)size(); + } + } + + public $typemap(cstype, T) this[int index] { + get { + return getitem(index); + } + set { + setitem(index, value); + } + } + + public bool IsEmpty { + get { + return empty(); + } + } + + public void CopyTo($typemap(cstype, T)[] array) + { + CopyTo(0, array, 0, this.Count); + } + + public void CopyTo($typemap(cstype, T)[] array, int arrayIndex) + { + CopyTo(0, array, arrayIndex, this.Count); + } + + public void CopyTo(int index, $typemap(cstype, T)[] array, int arrayIndex, int count) + { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (index < 0) + throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (count < 0) + throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (index+count > this.Count || arrayIndex+count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + for (int i=0; i<count; i++) + array.SetValue(getitemcopy(index+i), arrayIndex+i); + } + + global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, T)>.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + public $csclassnameEnumerator GetEnumerator() { + return new $csclassnameEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator + , global::System.Collections.Generic.IEnumerator<$typemap(cstype, T)> + { + private $csclassname collectionRef; + private int currentIndex; + private object currentObject; + private int currentSize; + + public $csclassnameEnumerator($csclassname collection) { + collectionRef = collection; + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public $typemap(cstype, T) Current { + get { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return ($typemap(cstype, T))currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current { + get { + return Current; + } + } + + public bool MoveNext() { + int size = collectionRef.Count; + bool moveOkay = (currentIndex+1 < size) && (size == currentSize); + if (moveOkay) { + currentIndex++; + currentObject = collectionRef[currentIndex]; + } else { + currentObject = null; + } + return moveOkay; + } + + public void Reset() { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() { + currentIndex = -1; + currentObject = null; + } + } +%} + + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + array(); + array(const array &other); + + size_type size() const; + bool empty() const; + + %rename(Fill) fill; + void fill(const value_type& val); + + %rename(Swap) swap; + void swap(array& other); + + %extend { + T getitemcopy(int index) throw (std::out_of_range) { + if (index>=0 && index<(int)$self->size()) + return (*$self)[index]; + else + throw std::out_of_range("index"); + } + const_reference getitem(int index) throw (std::out_of_range) { + if (index>=0 && index<(int)$self->size()) + return (*$self)[index]; + else + throw std::out_of_range("index"); + } + void setitem(int index, const_reference val) throw (std::out_of_range) { + if (index>=0 && index<(int)$self->size()) + (*$self)[index] = val; + else + throw std::out_of_range("index"); + } + void Reverse() { + std::reverse($self->begin(), $self->end()); + } + void Reverse(int index, int count) throw (std::out_of_range, std::invalid_argument) { + if (index < 0) + throw std::out_of_range("index"); + if (count < 0) + throw std::out_of_range("count"); + if (index >= (int)$self->size()+1 || index+count > (int)$self->size()) + throw std::invalid_argument("invalid range"); + std::reverse($self->begin()+index, $self->begin()+index+count); + } + } +%enddef + + +%csmethodmodifiers std::array::empty "private" +%csmethodmodifiers std::array::getitemcopy "private" +%csmethodmodifiers std::array::getitem "private" +%csmethodmodifiers std::array::setitem "private" +%csmethodmodifiers std::array::size "private" + +namespace std { + template<class T, size_t N> class array { + SWIG_STD_ARRAY_INTERNAL(T, N) + }; +}
diff --git a/share/swig/3.0.12/csharp/std_auto_ptr.i b/share/swig/3.0.12/csharp/std_auto_ptr.i new file mode 100644 index 0000000..d7e5f16 --- /dev/null +++ b/share/swig/3.0.12/csharp/std_auto_ptr.i
@@ -0,0 +1,25 @@ +/* + The typemaps here allow to handle functions returning std::auto_ptr<>, + which is the most common use of this type. If you have functions taking it + as parameter, these typemaps can't be used for them and you need to do + something else (e.g. use shared_ptr<> which SWIG supports fully). + */ + +%define %auto_ptr(TYPE) +%typemap (ctype) std::auto_ptr<TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr<TYPE > "HandleRef" +%typemap (cstype) std::auto_ptr<TYPE > "$typemap(cstype, TYPE)" +%typemap (out) std::auto_ptr<TYPE > %{ + $result = (void *)$1.release(); +%} +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr<TYPE > { + System.IntPtr cPtr = $imcall; + $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode + return ret; + } +%template() std::auto_ptr<TYPE >; +%enddef + +namespace std { + template <class T> class auto_ptr {}; +}
diff --git a/share/swig/2.0.11/csharp/std_common.i b/share/swig/3.0.12/csharp/std_common.i similarity index 100% rename from share/swig/2.0.11/csharp/std_common.i rename to share/swig/3.0.12/csharp/std_common.i
diff --git a/share/swig/2.0.11/csharp/std_deque.i b/share/swig/3.0.12/csharp/std_deque.i similarity index 100% rename from share/swig/2.0.11/csharp/std_deque.i rename to share/swig/3.0.12/csharp/std_deque.i
diff --git a/share/swig/2.0.11/csharp/std_except.i b/share/swig/3.0.12/csharp/std_except.i similarity index 92% rename from share/swig/2.0.11/csharp/std_except.i rename to share/swig/3.0.12/csharp/std_except.i index 27eb84b..c983bd0 100644 --- a/share/swig/2.0.11/csharp/std_except.i +++ b/share/swig/3.0.12/csharp/std_except.i
@@ -7,6 +7,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <typeinfo> #include <stdexcept> %} @@ -16,6 +17,7 @@ struct exception {}; } +%typemap(throws, canthrow=1) std::bad_cast "SWIG_CSharpSetPendingException(SWIG_CSharpInvalidCastException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
diff --git a/share/swig/2.0.11/csharp/std_map.i b/share/swig/3.0.12/csharp/std_map.i similarity index 65% rename from share/swig/2.0.11/csharp/std_map.i rename to share/swig/3.0.12/csharp/std_map.i index acd1906..90a8650 100644 --- a/share/swig/2.0.11/csharp/std_map.i +++ b/share/swig/3.0.12/csharp/std_map.i
@@ -11,9 +11,7 @@ * %template(MapIntDouble) std::map<int, double> * * Notes: - * 1) For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code. In this case - * the C# wrapper has only basic functionality. - * 2) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with + * 1) IEnumerable<> is implemented in the proxy class which is useful for using LINQ with * C++ std::map wrappers. * * Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents! @@ -28,8 +26,8 @@ /* K is the C++ key type, T is the C++ value type */ %define SWIG_STD_MAP_INTERNAL(K, T, C) -%typemap(csinterfaces) std::map< K, T, C > "IDisposable \n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n#endif\n"; -%typemap(cscode) std::map<K, T, C > %{ +%typemap(csinterfaces) std::map< K, T, C > "global::System.IDisposable \n , global::System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n"; +%proxycode %{ public $typemap(cstype, T) this[$typemap(cstype, K) key] { get { @@ -62,14 +60,12 @@ } } -#if !SWIG_DOTNET_1 - - public System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys { + public global::System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys { get { - System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new System.Collections.Generic.List<$typemap(cstype, K)>(); + global::System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new global::System.Collections.Generic.List<$typemap(cstype, K)>(); int size = this.Count; if (size > 0) { - IntPtr iter = create_iterator_begin(); + global::System.IntPtr iter = create_iterator_begin(); for (int i = 0; i < size; i++) { keys.Add(get_next_key(iter)); } @@ -79,21 +75,21 @@ } } - public System.Collections.Generic.ICollection<$typemap(cstype, T)> Values { + public global::System.Collections.Generic.ICollection<$typemap(cstype, T)> Values { get { - System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new System.Collections.Generic.List<$typemap(cstype, T)>(); - foreach (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) { + global::System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new global::System.Collections.Generic.List<$typemap(cstype, T)>(); + foreach (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) { vals.Add(pair.Value); } return vals; } } - public void Add(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + public void Add(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { Add(item.Key, item.Value); } - public bool Remove(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + public bool Remove(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { if (Contains(item)) { return Remove(item.Key); } else { @@ -101,7 +97,7 @@ } } - public bool Contains(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { + public bool Contains(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) { if (this[item.Key] == item.Value) { return true; } else { @@ -109,32 +105,32 @@ } } - public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) { + public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) { CopyTo(array, 0); } - public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) { + public void CopyTo(global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) { if (array == null) - throw new ArgumentNullException("array"); + throw new global::System.ArgumentNullException("array"); if (arrayIndex < 0) - throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); if (array.Rank > 1) - throw new ArgumentException("Multi dimensional array.", "array"); + throw new global::System.ArgumentException("Multi dimensional array.", "array"); if (arrayIndex+this.Count > array.Length) - throw new ArgumentException("Number of elements to copy is too large."); + throw new global::System.ArgumentException("Number of elements to copy is too large."); - System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys); + global::System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new global::System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys); for (int i = 0; i < keyList.Count; i++) { $typemap(cstype, K) currentKey = keyList[i]; - array.SetValue(new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i); + array.SetValue(new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i); } } - System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() { + global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> global::System.Collections.Generic.IEnumerable<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() { return new $csclassnameEnumerator(this); } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { return new $csclassnameEnumerator(this); } @@ -147,38 +143,38 @@ /// whenever the collection is modified. This has been done for changes in the size of the /// collection but not when one of the elements of the collection is modified as it is a bit /// tricky to detect unmanaged code that modifies the collection under our feet. - public sealed class $csclassnameEnumerator : System.Collections.IEnumerator, - System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> + public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator, + global::System.Collections.Generic.IEnumerator<global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> { private $csclassname collectionRef; - private System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection; + private global::System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection; private int currentIndex; private object currentObject; private int currentSize; public $csclassnameEnumerator($csclassname collection) { collectionRef = collection; - keyCollection = new System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys); + keyCollection = new global::System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys); currentIndex = -1; currentObject = null; currentSize = collectionRef.Count; } // Type-safe iterator Current - public System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current { + public global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current { get { if (currentIndex == -1) - throw new InvalidOperationException("Enumeration not started."); + throw new global::System.InvalidOperationException("Enumeration not started."); if (currentIndex > currentSize - 1) - throw new InvalidOperationException("Enumeration finished."); + throw new global::System.InvalidOperationException("Enumeration finished."); if (currentObject == null) - throw new InvalidOperationException("Collection modified."); - return (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject; + throw new global::System.InvalidOperationException("Collection modified."); + return (global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject; } } // Type-unsafe IEnumerator.Current - object System.Collections.IEnumerator.Current { + object global::System.Collections.IEnumerator.Current { get { return Current; } @@ -190,7 +186,7 @@ if (moveOkay) { currentIndex++; $typemap(cstype, K) currentKey = keyCollection[currentIndex]; - currentObject = new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]); + currentObject = new global::System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]); } else { currentObject = null; } @@ -201,7 +197,7 @@ currentIndex = -1; currentObject = null; if (collectionRef.Count != currentSize) { - throw new InvalidOperationException("Collection modified."); + throw new global::System.InvalidOperationException("Collection modified."); } } @@ -210,7 +206,6 @@ currentObject = null; } } -#endif %}
diff --git a/share/swig/2.0.11/csharp/std_pair.i b/share/swig/3.0.12/csharp/std_pair.i similarity index 100% rename from share/swig/2.0.11/csharp/std_pair.i rename to share/swig/3.0.12/csharp/std_pair.i
diff --git a/share/swig/2.0.11/csharp/std_shared_ptr.i b/share/swig/3.0.12/csharp/std_shared_ptr.i similarity index 100% rename from share/swig/2.0.11/csharp/std_shared_ptr.i rename to share/swig/3.0.12/csharp/std_shared_ptr.i
diff --git a/share/swig/2.0.11/csharp/std_string.i b/share/swig/3.0.12/csharp/std_string.i similarity index 100% rename from share/swig/2.0.11/csharp/std_string.i rename to share/swig/3.0.12/csharp/std_string.i
diff --git a/share/swig/2.0.11/csharp/std_vector.i b/share/swig/3.0.12/csharp/std_vector.i similarity index 85% rename from share/swig/2.0.11/csharp/std_vector.i rename to share/swig/3.0.12/csharp/std_vector.i index 5a21ad3..12220aa 100644 --- a/share/swig/2.0.11/csharp/std_vector.i +++ b/share/swig/3.0.12/csharp/std_vector.i
@@ -4,8 +4,6 @@ * SWIG typemaps for std::vector<T> * C# implementation * The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection. - * For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code; then the C# wrapper is - * made to look and feel like a typesafe C# System.Collections.ArrayList. * * Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with * C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality @@ -26,11 +24,11 @@ // MACRO for use within the std::vector class body %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE, CTYPE...) -%typemap(csinterfaces) std::vector< CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n"; -%typemap(cscode) std::vector< CTYPE > %{ - public $csclassname(System.Collections.ICollection c) : this() { +%typemap(csinterfaces) std::vector< CTYPE > "global::System.IDisposable, global::System.Collections.IEnumerable\n , global::System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n"; +%proxycode %{ + public $csclassname(global::System.Collections.ICollection c) : this() { if (c == null) - throw new ArgumentNullException("c"); + throw new global::System.ArgumentNullException("c"); foreach ($typemap(cstype, CTYPE) element in c) { this.Add(element); } @@ -63,7 +61,7 @@ } set { if (value < size()) - throw new ArgumentOutOfRangeException("Capacity"); + throw new global::System.ArgumentOutOfRangeException("Capacity"); reserve((uint)value); } } @@ -80,53 +78,39 @@ } } -#if SWIG_DOTNET_1 - public void CopyTo(System.Array array) -#else public void CopyTo($typemap(cstype, CTYPE)[] array) -#endif { CopyTo(0, array, 0, this.Count); } -#if SWIG_DOTNET_1 - public void CopyTo(System.Array array, int arrayIndex) -#else public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex) -#endif { CopyTo(0, array, arrayIndex, this.Count); } -#if SWIG_DOTNET_1 - public void CopyTo(int index, System.Array array, int arrayIndex, int count) -#else public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count) -#endif { if (array == null) - throw new ArgumentNullException("array"); + throw new global::System.ArgumentNullException("array"); if (index < 0) - throw new ArgumentOutOfRangeException("index", "Value is less than zero"); + throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero"); if (arrayIndex < 0) - throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); if (count < 0) - throw new ArgumentOutOfRangeException("count", "Value is less than zero"); + throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero"); if (array.Rank > 1) - throw new ArgumentException("Multi dimensional array.", "array"); + throw new global::System.ArgumentException("Multi dimensional array.", "array"); if (index+count > this.Count || arrayIndex+count > array.Length) - throw new ArgumentException("Number of elements to copy is too large."); + throw new global::System.ArgumentException("Number of elements to copy is too large."); for (int i=0; i<count; i++) array.SetValue(getitemcopy(index+i), arrayIndex+i); } -#if !SWIG_DOTNET_1 - System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() { + global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> global::System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() { return new $csclassnameEnumerator(this); } -#endif - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { return new $csclassnameEnumerator(this); } @@ -139,10 +123,8 @@ /// whenever the collection is modified. This has been done for changes in the size of the /// collection but not when one of the elements of the collection is modified as it is a bit /// tricky to detect unmanaged code that modifies the collection under our feet. - public sealed class $csclassnameEnumerator : System.Collections.IEnumerator -#if !SWIG_DOTNET_1 - , System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> -#endif + public sealed class $csclassnameEnumerator : global::System.Collections.IEnumerator + , global::System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> { private $csclassname collectionRef; private int currentIndex; @@ -160,17 +142,17 @@ public $typemap(cstype, CTYPE) Current { get { if (currentIndex == -1) - throw new InvalidOperationException("Enumeration not started."); + throw new global::System.InvalidOperationException("Enumeration not started."); if (currentIndex > currentSize - 1) - throw new InvalidOperationException("Enumeration finished."); + throw new global::System.InvalidOperationException("Enumeration finished."); if (currentObject == null) - throw new InvalidOperationException("Collection modified."); + throw new global::System.InvalidOperationException("Collection modified."); return ($typemap(cstype, CTYPE))currentObject; } } // Type-unsafe IEnumerator.Current - object System.Collections.IEnumerator.Current { + object global::System.Collections.IEnumerator.Current { get { return Current; } @@ -192,16 +174,14 @@ currentIndex = -1; currentObject = null; if (collectionRef.Count != currentSize) { - throw new InvalidOperationException("Collection modified."); + throw new global::System.InvalidOperationException("Collection modified."); } } -#if !SWIG_DOTNET_1 public void Dispose() { currentIndex = -1; currentObject = null; } -#endif } %} @@ -237,7 +217,7 @@ else throw std::out_of_range("index"); } - const_reference getitem(int index) throw (std::out_of_range) { + CONST_REFERENCE getitem(int index) throw (std::out_of_range) { if (index>=0 && index<(int)$self->size()) return (*$self)[index]; else @@ -418,4 +398,5 @@ SWIG_STD_VECTOR_ENHANCED(float) SWIG_STD_VECTOR_ENHANCED(double) SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include <std_string.i> +SWIG_STD_VECTOR_ENHANCED(std::wstring) // also requires a %include <std_wstring.i>
diff --git a/share/swig/2.0.11/csharp/std_wstring.i b/share/swig/3.0.12/csharp/std_wstring.i similarity index 90% rename from share/swig/2.0.11/csharp/std_wstring.i rename to share/swig/3.0.12/csharp/std_wstring.i index 9142d36..09bdaaa 100644 --- a/share/swig/2.0.11/csharp/std_wstring.i +++ b/share/swig/3.0.12/csharp/std_wstring.i
@@ -23,7 +23,7 @@ // wstring %typemap(ctype, out="void *") wstring "wchar_t *" -%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") wstring "string" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string" %typemap(cstype) wstring "string" %typemap(csdirectorin) wstring "$iminput" %typemap(csdirectorout) wstring "$cscall" @@ -60,7 +60,7 @@ // const wstring & %typemap(ctype, out="void *") const wstring & "wchar_t *" -%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") const wstring & "string" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") const wstring & "string" %typemap(cstype) const wstring & "string" %typemap(csdirectorin) const wstring & "$iminput"
diff --git a/share/swig/2.0.11/csharp/stl.i b/share/swig/3.0.12/csharp/stl.i similarity index 100% rename from share/swig/2.0.11/csharp/stl.i rename to share/swig/3.0.12/csharp/stl.i
diff --git a/share/swig/3.0.12/csharp/swiginterface.i b/share/swig/3.0.12/csharp/swiginterface.i new file mode 100644 index 0000000..e5bfd23 --- /dev/null +++ b/share/swig/3.0.12/csharp/swiginterface.i
@@ -0,0 +1,63 @@ +/* ----------------------------------------------------------------------------- + * swiginterface.i + * + * SWIG interface feature and typemaps implementation providing: + * %interface + * %interface_impl + * %interface_custom + * ----------------------------------------------------------------------------- */ + +%define INTERFACE_TYPEMAPS(CTYPE...) +%typemap(cstype) CTYPE "$&csinterfacename" +%typemap(cstype) CTYPE *, CTYPE [], CTYPE & "$csinterfacename" +%typemap(cstype) CTYPE *const& "$*csinterfacename" +%typemap(csin) CTYPE, CTYPE & "$csinput.GetInterfaceCPtr()" +%typemap(csin) CTYPE *, CTYPE *const&, CTYPE [] "$csinput == null ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : $csinput.GetInterfaceCPtr()" +%typemap(csout, excode=SWIGEXCODE) CTYPE { + $&csclassname ret = new $&csclassname($imcall, true);$excode + return ($&csinterfacename)ret; + } +%typemap(csout, excode=SWIGEXCODE) CTYPE & { + $csclassname ret = new $csclassname($imcall, $owner);$excode + return ($csinterfacename)ret; + } +%typemap(csout, excode=SWIGEXCODE) CTYPE *, CTYPE [] { + global::System.IntPtr cPtr = $imcall; + $csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode + return ($csinterfacename)ret; + } +%typemap(csout, excode=SWIGEXCODE) CTYPE *const& { + global::System.IntPtr cPtr = $imcall; + $*csclassname ret = (cPtr == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode + return ($*csinterfacename)ret; + } +%typemap(csdirectorin) CTYPE "($&csinterfacename)new $&csclassname($iminput, true)" +%typemap(csdirectorin) CTYPE & "($csinterfacename)new $csclassname($iminput, false)" +%typemap(csdirectorin) CTYPE *, CTYPE [] "($iminput == global::System.IntPtr.Zero) ? null : ($csinterfacename)new $csclassname($iminput, false)" +%typemap(csdirectorin) CTYPE *const& "($iminput == global::System.IntPtr.Zero) ? null : ($*csinterfacename)new $*csclassname($iminput, false)" +%typemap(csdirectorout) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "$cscall.GetInterfaceCPtr()" +%typemap(csinterfacecode, declaration=" [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n global::System.Runtime.InteropServices.HandleRef GetInterfaceCPtr();\n", cptrmethod="$interfacename_GetInterfaceCPtr") CTYPE %{ + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + global::System.Runtime.InteropServices.HandleRef $interfacename.GetInterfaceCPtr() { + return new global::System.Runtime.InteropServices.HandleRef(this, $imclassname.$csclazzname$interfacename_GetInterfaceCPtr(swigCPtr.Handle)); + } +%} +%enddef + +%define %interface(CTYPE...) +%feature("interface", name="%sSwigInterface") CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef + +%define %interface_impl(CTYPE...) +%rename("%sSwigImpl") CTYPE; +%feature("interface", name="%(rstrip:[SwigImpl])s") CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef + +%define %interface_custom(PROXY, INTERFACE, CTYPE...) +%rename(PROXY) CTYPE; +%feature("interface", name=INTERFACE) CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef +
diff --git a/share/swig/3.0.12/csharp/swigtype_inout.i b/share/swig/3.0.12/csharp/swigtype_inout.i new file mode 100644 index 0000000..e7312e8 --- /dev/null +++ b/share/swig/3.0.12/csharp/swigtype_inout.i
@@ -0,0 +1,34 @@ +/* ----------------------------------------------------------------------------- + * swigtype_inout.i + * + * Pointer pointer and pointer reference handling typemap library for non-primitive types + * + * These mappings provide support for input/output arguments and common + * uses for C/C++ pointer references and pointer to pointers. + * + * These are named typemaps (OUTPUT) and can be used like any named typemap. + * Alternatively they can be made the default by using %apply: + * %apply SWIGTYPE *& OUTPUT { SWIGTYPE *& } + * ----------------------------------------------------------------------------- */ + +/* + * OUTPUT typemaps. Example usage wrapping: + * + * void f(XXX *& x) { x = new XXX(111); } + * + * would be: + * + * XXX x = null; + * f(out x); + * // use x + * x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector + */ +%typemap(ctype) SWIGTYPE *& OUTPUT "void **" +%typemap(imtype, out="global::System.IntPtr") SWIGTYPE *& OUTPUT "out global::System.IntPtr" +%typemap(cstype) SWIGTYPE *& OUTPUT "out $*csclassname" +%typemap(csin, + pre=" global::System.IntPtr cPtr_$csinput = global::System.IntPtr.Zero;", + post=" $csinput = (cPtr_$csinput == global::System.IntPtr.Zero) ? null : new $*csclassname(cPtr_$csinput, true);", + cshin="out $csinput") SWIGTYPE *& OUTPUT "out cPtr_$csinput" +%typemap(in) SWIGTYPE *& OUTPUT %{ $1 = ($1_ltype)$input; %} +%typemap(freearg) SWIGTYPE *& OUTPUT ""
diff --git a/share/swig/2.0.11/csharp/typemaps.i b/share/swig/3.0.12/csharp/typemaps.i similarity index 97% rename from share/swig/2.0.11/csharp/typemaps.i rename to share/swig/3.0.12/csharp/typemaps.i index 79f5596..b6f9bdd 100644 --- a/share/swig/2.0.11/csharp/typemaps.i +++ b/share/swig/3.0.12/csharp/typemaps.i
@@ -55,7 +55,7 @@ %define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE) %typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE" -%typemap(imtype, out="IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE" +%typemap(imtype, out="global::System.IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE" %typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE" %typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput" @@ -135,7 +135,7 @@ %define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE) %typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *" -%typemap(imtype, out="IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE" +%typemap(imtype, out="global::System.IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE" %typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE" %typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput" @@ -224,7 +224,7 @@ %define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE) %typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *" -%typemap(imtype, out="IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE" +%typemap(imtype, out="global::System.IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE" %typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE" %typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"
diff --git a/share/swig/2.0.11/csharp/wchar.i b/share/swig/3.0.12/csharp/wchar.i similarity index 77% rename from share/swig/2.0.11/csharp/wchar.i rename to share/swig/3.0.12/csharp/wchar.i index 1d95edd..9361edf 100644 --- a/share/swig/2.0.11/csharp/wchar.i +++ b/share/swig/3.0.12/csharp/wchar.i
@@ -20,14 +20,14 @@ %pragma(csharp) imclasscode=%{ protected class SWIGWStringHelper { - public delegate string SWIGWStringDelegate(IntPtr message); + public delegate string SWIGWStringDelegate(global::System.IntPtr message); static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString); - [DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")] + [global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")] public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate); - static string CreateWString([MarshalAs(UnmanagedType.LPWStr)]IntPtr cString) { - return System.Runtime.InteropServices.Marshal.PtrToStringUni(cString); + static string CreateWString([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString) { + return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString); } static SWIGWStringHelper() { @@ -77,12 +77,12 @@ // wchar_t * %typemap(ctype) wchar_t * "wchar_t *" -%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]", out="IntPtr" ) wchar_t * "string" +%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]", out="global::System.IntPtr" ) wchar_t * "string" %typemap(cstype) wchar_t * "string" %typemap(csin) wchar_t * "$csinput" %typemap(csout, excode=SWIGEXCODE) wchar_t * { - string ret = System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode + string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode return ret; } %typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
diff --git a/share/swig/2.0.11/cstring.i b/share/swig/3.0.12/cstring.i similarity index 100% rename from share/swig/2.0.11/cstring.i rename to share/swig/3.0.12/cstring.i
diff --git a/share/swig/2.0.11/cwstring.i b/share/swig/3.0.12/cwstring.i similarity index 100% rename from share/swig/2.0.11/cwstring.i rename to share/swig/3.0.12/cwstring.i
diff --git a/share/swig/2.0.11/d/boost_shared_ptr.i b/share/swig/3.0.12/d/boost_shared_ptr.i similarity index 98% rename from share/swig/2.0.11/d/boost_shared_ptr.i rename to share/swig/3.0.12/d/boost_shared_ptr.i index bfa2aa6..5c17155 100644 --- a/share/swig/2.0.11/d/boost_shared_ptr.i +++ b/share/swig/3.0.12/d/boost_shared_ptr.i
@@ -152,7 +152,7 @@ swigCMemOwn = ownCObject; } -public static void* swigGetCPtr($dclassname obj) { +public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } %} @@ -167,7 +167,7 @@ swigCMemOwn = ownCObject; } -public static void* swigGetCPtr($dclassname obj) { +public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } %}
diff --git a/share/swig/2.0.11/d/carrays.i b/share/swig/3.0.12/d/carrays.i similarity index 96% rename from share/swig/2.0.11/d/carrays.i rename to share/swig/3.0.12/d/carrays.i index 37b59c8..f2803ea 100644 --- a/share/swig/2.0.11/d/carrays.i +++ b/share/swig/3.0.12/d/carrays.i
@@ -21,7 +21,7 @@ %{ static TYPE *new_##NAME(int nelements) { %} #ifdef __cplusplus -%{ return new TYPE[nelements]; %} +%{ return new TYPE[nelements](); %} #else %{ return (TYPE *) calloc(nelements,sizeof(TYPE)); %} #endif @@ -78,7 +78,7 @@ %extend NAME { #ifdef __cplusplus NAME(int nelements) { - return new TYPE[nelements]; + return new TYPE[nelements](); } ~NAME() { delete [] self;
diff --git a/share/swig/2.0.11/d/cpointer.i b/share/swig/3.0.12/d/cpointer.i similarity index 100% rename from share/swig/2.0.11/d/cpointer.i rename to share/swig/3.0.12/d/cpointer.i
diff --git a/share/swig/2.0.11/d/d.swg b/share/swig/3.0.12/d/d.swg similarity index 100% rename from share/swig/2.0.11/d/d.swg rename to share/swig/3.0.12/d/d.swg
diff --git a/share/swig/2.0.11/d/dclassgen.swg b/share/swig/3.0.12/d/dclassgen.swg similarity index 93% rename from share/swig/2.0.11/d/dclassgen.swg rename to share/swig/3.0.12/d/dclassgen.swg index ceaf507..68910b4 100644 --- a/share/swig/2.0.11/d/dclassgen.swg +++ b/share/swig/3.0.12/d/dclassgen.swg
@@ -72,7 +72,7 @@ swigCMemOwn = ownCObject; } -public static void* swigGetCPtr($dclassname obj) { +public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } @@ -88,7 +88,7 @@ swigCPtr = cObject; } -public static void* swigGetCPtr($dclassname obj) { +public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } @@ -111,7 +111,7 @@ swigCPtr = null; } -public static void* swigGetCPtr($dclassname obj) { +public static void* swigGetCPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; } @@ -134,7 +134,7 @@ swigCPtr = null; } -package static char* swigGetCMemberPtr($dclassname obj) { +package static char* swigGetCMemberPtr(typeof(this) obj) { return (obj is null) ? null : obj.swigCPtr; }
diff --git a/share/swig/2.0.11/d/ddirectives.swg b/share/swig/3.0.12/d/ddirectives.swg similarity index 88% rename from share/swig/2.0.11/d/ddirectives.swg rename to share/swig/3.0.12/d/ddirectives.swg index 6972a0c..145cf01 100644 --- a/share/swig/2.0.11/d/ddirectives.swg +++ b/share/swig/3.0.12/d/ddirectives.swg
@@ -8,3 +8,4 @@ #define %dconstvalue(value) %feature("d:constvalue",value) #define %dmethodmodifiers %feature("d:methodmodifiers") #define %dnothrowexception %feature("except") +#define %proxycode %insert("proxycode")
diff --git a/share/swig/2.0.11/d/denums.swg b/share/swig/3.0.12/d/denums.swg similarity index 87% rename from share/swig/2.0.11/d/denums.swg rename to share/swig/3.0.12/d/denums.swg index 5917da9..3f81246 100644 --- a/share/swig/2.0.11/d/denums.swg +++ b/share/swig/3.0.12/d/denums.swg
@@ -16,10 +16,10 @@ %typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE "" %typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %} -%typemap(out) enum SWIGTYPE %{ $result = $1; %} +%typemap(out) enum SWIGTYPE %{ $result = (int)$1; %} %typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %} -%typemap(directorin) enum SWIGTYPE "$input = $1;" +%typemap(directorin) enum SWIGTYPE "$input = (int)$1;" %typemap(ddirectorin) enum SWIGTYPE "cast($dclassname)$winput" %typemap(ddirectorout) enum SWIGTYPE "cast(int)$dcall" @@ -43,9 +43,9 @@ %typemap(in) const enum SWIGTYPE & ($*1_ltype temp) %{ temp = ($*1_ltype)$input; $1 = &temp; %} -%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %} +%typemap(out) const enum SWIGTYPE & %{ $result = (int)*$1; %} -%typemap(directorin) const enum SWIGTYPE & "$input = $1;" +%typemap(directorin) const enum SWIGTYPE & "$input = (int)$1;" %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE & %{ static $*1_ltype temp = ($*1_ltype)$input; $result = &temp; %}
diff --git a/share/swig/2.0.11/d/dexception.swg b/share/swig/3.0.12/d/dexception.swg similarity index 100% rename from share/swig/2.0.11/d/dexception.swg rename to share/swig/3.0.12/d/dexception.swg
diff --git a/share/swig/2.0.11/d/dhead.swg b/share/swig/3.0.12/d/dhead.swg similarity index 82% rename from share/swig/2.0.11/d/dhead.swg rename to share/swig/3.0.12/d/dhead.swg index 7a2f4fd..50e9c2e 100644 --- a/share/swig/2.0.11/d/dhead.swg +++ b/share/swig/3.0.12/d/dhead.swg
@@ -28,7 +28,7 @@ SWIG_DIllegalArgumentException, SWIG_DIllegalElementException, SWIG_DIOException, - SWIG_DNoSuchElementException, + SWIG_DNoSuchElementException } SWIG_DExceptionCodes; typedef void (* SWIG_DExceptionCallback_t)(const char *); @@ -93,31 +93,26 @@ static void setException(char* message) { auto exception = new object.Exception(tango.stdc.stringz.fromStringz(message).dup); - exception.next = SwigPendingException.retrieve(); SwigPendingException.set(exception); } static void setIllegalArgumentException(char* message) { auto exception = new tango.core.Exception.IllegalArgumentException(tango.stdc.stringz.fromStringz(message).dup); - exception.next = SwigPendingException.retrieve(); SwigPendingException.set(exception); } static void setIllegalElementException(char* message) { auto exception = new tango.core.Exception.IllegalElementException(tango.stdc.stringz.fromStringz(message).dup); - exception.next = SwigPendingException.retrieve(); SwigPendingException.set(exception); } static void setIOException(char* message) { auto exception = new tango.core.Exception.IOException(tango.stdc.stringz.fromStringz(message).dup); - exception.next = SwigPendingException.retrieve(); SwigPendingException.set(exception); } static void setNoSuchElementException(char* message) { auto exception = new tango.core.Exception.NoSuchElementException(tango.stdc.stringz.fromStringz(message).dup); - exception.next = SwigPendingException.retrieve(); SwigPendingException.set(exception); } } @@ -125,51 +120,31 @@ package class SwigPendingException { public: static this() { - m_sPendingCount = 0; m_sPendingException = new ThreadLocalData(null); } static bool isPending() { - bool pending = false; - if (m_sPendingCount > 0) { - if (m_sPendingException.val !is null) { - pending = true; - } - } - return pending; + return m_sPendingException.val !is null; } static void set(object.Exception e) { - if (m_sPendingException.val !is null) { - throw new object.Exception("FATAL: An earlier pending exception from C/C++ code " ~ - "was missed and thus not thrown (" ~ m_sPendingException.val.classinfo.name ~ - ": " ~ m_sPendingException.val.msg ~ ")!", e); + auto pending = m_sPendingException.val; + if (pending !is null) { + e.next = pending; + throw new object.Exception("FATAL: An earlier pending exception from C/C++ " ~ + "code was missed and thus not thrown (" ~ pending.classinfo.name ~ ": " ~ + pending.msg ~ ")!", e); } - m_sPendingException.val = e; - synchronized { - ++m_sPendingCount; - } } static object.Exception retrieve() { - object.Exception e = null; - if (m_sPendingCount > 0) { - if (m_sPendingException.val !is null) { - e = m_sPendingException.val; - m_sPendingException.val = null; - synchronized { - --m_sPendingCount; - } - } - } + auto e = m_sPendingException.val; + m_sPendingException.val = null; return e; } private: - // The pending exception counter is stored thread-global. - static int m_sPendingCount; - // The reference to the pending exception (if any) is stored thread-local. alias tango.core.Thread.ThreadLocal!(object.Exception) ThreadLocalData; static ThreadLocalData m_sPendingException; @@ -195,8 +170,7 @@ } static void setException(const char* message) { - auto exception = new object.Exception(std.conv.to!string(message).idup); - exception.next = SwigPendingException.retrieve(); + auto exception = new object.Exception(std.conv.to!string(message)); SwigPendingException.set(exception); } } @@ -204,51 +178,31 @@ package struct SwigPendingException { public: static this() { - m_sPendingCount = 0; m_sPendingException = null; } static bool isPending() { - bool pending = false; - if (m_sPendingCount > 0) { - if (m_sPendingException !is null) { - pending = true; - } - } - return pending; + return m_sPendingException !is null; } static void set(object.Exception e) { if (m_sPendingException !is null) { + e.next = m_sPendingException; throw new object.Exception("FATAL: An earlier pending exception from C/C++ code " ~ "was missed and thus not thrown (" ~ m_sPendingException.classinfo.name ~ ": " ~ m_sPendingException.msg ~ ")!", e); } m_sPendingException = e; - synchronized { - ++m_sPendingCount; - } } static object.Exception retrieve() { - object.Exception e = null; - if (m_sPendingCount > 0) { - if (m_sPendingException !is null) { - e = m_sPendingException; - m_sPendingException = null; - synchronized { - --m_sPendingCount; - } - } - } + auto e = m_sPendingException; + m_sPendingException = null; return e; } private: - // The pending exception counter is stored thread-global. - static shared int m_sPendingCount; - // The reference to the pending exception (if any) is stored thread-local. static object.Exception m_sPendingException; }
diff --git a/share/swig/2.0.11/d/director.swg b/share/swig/3.0.12/d/director.swg similarity index 66% rename from share/swig/2.0.11/d/director.swg rename to share/swig/3.0.12/d/director.swg index 9692e03..a7d9c76 100644 --- a/share/swig/2.0.11/d/director.swg +++ b/share/swig/3.0.12/d/director.swg
@@ -5,42 +5,41 @@ * methods can be called from C++. * ----------------------------------------------------------------------------- */ -#ifdef __cplusplus - #if defined(DEBUG_DIRECTOR_OWNED) #include <iostream> #endif #include <string> +#include <exception> namespace Swig { + // Director base class – not used in D directors. class Director { }; // Base class for director exceptions. - class DirectorException { + class DirectorException : public std::exception { protected: std::string swig_msg; public: - DirectorException(const char* msg) : swig_msg(msg) { - } DirectorException(const std::string &msg) : swig_msg(msg) { } - const std::string& what() const { - return swig_msg; + + virtual ~DirectorException() throw() { } - virtual ~DirectorException() { + + const char *what() const throw() { + return swig_msg.c_str(); } }; // Exception which is thrown when attempting to call a pure virtual method - // from D code thorugh the director layer. - class DirectorPureVirtualException : public Swig::DirectorException { + // from D code through the director layer. + class DirectorPureVirtualException : public DirectorException { public: - DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) { + DirectorPureVirtualException(const char *msg) : DirectorException(std::string("Attempted to invoke pure virtual method ") + msg) { } }; } -#endif /* __cplusplus */
diff --git a/share/swig/2.0.11/d/dkw.swg b/share/swig/3.0.12/d/dkw.swg similarity index 100% rename from share/swig/2.0.11/d/dkw.swg rename to share/swig/3.0.12/d/dkw.swg
diff --git a/share/swig/2.0.11/d/dmemberfunctionpointers.swg b/share/swig/3.0.12/d/dmemberfunctionpointers.swg similarity index 88% rename from share/swig/2.0.11/d/dmemberfunctionpointers.swg rename to share/swig/3.0.12/d/dmemberfunctionpointers.swg index c33ff38..c63eca2 100644 --- a/share/swig/2.0.11/d/dmemberfunctionpointers.swg +++ b/share/swig/3.0.12/d/dmemberfunctionpointers.swg
@@ -53,10 +53,10 @@ /* Pack binary data into a string */ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } @@ -67,11 +67,11 @@ %fragment("SWIG_UnPackData", "header") { /* Unpack binary data from a string */ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f'))
diff --git a/share/swig/2.0.11/d/doperators.swg b/share/swig/3.0.12/d/doperators.swg similarity index 100% rename from share/swig/2.0.11/d/doperators.swg rename to share/swig/3.0.12/d/doperators.swg
diff --git a/share/swig/2.0.11/d/dprimitives.swg b/share/swig/3.0.12/d/dprimitives.swg similarity index 100% rename from share/swig/2.0.11/d/dprimitives.swg rename to share/swig/3.0.12/d/dprimitives.swg
diff --git a/share/swig/2.0.11/d/dstrings.swg b/share/swig/3.0.12/d/dstrings.swg similarity index 100% rename from share/swig/2.0.11/d/dstrings.swg rename to share/swig/3.0.12/d/dstrings.swg
diff --git a/share/swig/2.0.11/d/dswigtype.swg b/share/swig/3.0.12/d/dswigtype.swg similarity index 97% rename from share/swig/2.0.11/d/dswigtype.swg rename to share/swig/3.0.12/d/dswigtype.swg index 41336dc..f91d6df 100644 --- a/share/swig/2.0.11/d/dswigtype.swg +++ b/share/swig/3.0.12/d/dswigtype.swg
@@ -57,7 +57,7 @@ #endif %typemap(directorin) SWIGTYPE - "$input = (void *)&$1;" + "$input = (void *)new $1_ltype((const $1_ltype &)$1);" %typemap(directorout) SWIGTYPE %{ if (!$input) { SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type"); @@ -65,7 +65,7 @@ } $result = *($&1_ltype)$input; %} -%typemap(ddirectorin) SWIGTYPE "new $&dclassname($winput, false)" +%typemap(ddirectorin) SWIGTYPE "new $&dclassname($winput, true)" %typemap(ddirectorout) SWIGTYPE "$&dclassname.swigGetCPtr($dcall)" %typemap(din) SWIGTYPE "$&dclassname.swigGetCPtr($dinput)"
diff --git a/share/swig/2.0.11/d/dvoid.swg b/share/swig/3.0.12/d/dvoid.swg similarity index 100% rename from share/swig/2.0.11/d/dvoid.swg rename to share/swig/3.0.12/d/dvoid.swg
diff --git a/share/swig/2.0.11/d/std_common.i b/share/swig/3.0.12/d/std_common.i similarity index 100% rename from share/swig/2.0.11/d/std_common.i rename to share/swig/3.0.12/d/std_common.i
diff --git a/share/swig/2.0.11/d/std_deque.i b/share/swig/3.0.12/d/std_deque.i similarity index 100% rename from share/swig/2.0.11/d/std_deque.i rename to share/swig/3.0.12/d/std_deque.i
diff --git a/share/swig/2.0.11/d/std_except.i b/share/swig/3.0.12/d/std_except.i similarity index 92% rename from share/swig/2.0.11/d/std_except.i rename to share/swig/3.0.12/d/std_except.i index 2b557e5..fbfd6c3 100644 --- a/share/swig/2.0.11/d/std_except.i +++ b/share/swig/3.0.12/d/std_except.i
@@ -7,6 +7,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <typeinfo> #include <stdexcept> %} @@ -16,6 +17,7 @@ struct exception {}; } +%typemap(throws, canthrow=1) std::bad_cast "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::bad_exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::domain_error "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;" %typemap(throws, canthrow=1) std::exception "SWIG_DSetPendingException(SWIG_DException, $1.what());\n return $null;"
diff --git a/share/swig/2.0.11/d/std_map.i b/share/swig/3.0.12/d/std_map.i similarity index 100% rename from share/swig/2.0.11/d/std_map.i rename to share/swig/3.0.12/d/std_map.i
diff --git a/share/swig/2.0.11/d/std_pair.i b/share/swig/3.0.12/d/std_pair.i similarity index 100% rename from share/swig/2.0.11/d/std_pair.i rename to share/swig/3.0.12/d/std_pair.i
diff --git a/share/swig/2.0.11/d/std_shared_ptr.i b/share/swig/3.0.12/d/std_shared_ptr.i similarity index 100% rename from share/swig/2.0.11/d/std_shared_ptr.i rename to share/swig/3.0.12/d/std_shared_ptr.i
diff --git a/share/swig/2.0.11/d/std_string.i b/share/swig/3.0.12/d/std_string.i similarity index 100% rename from share/swig/2.0.11/d/std_string.i rename to share/swig/3.0.12/d/std_string.i
diff --git a/share/swig/2.0.11/d/std_vector.i b/share/swig/3.0.12/d/std_vector.i similarity index 96% rename from share/swig/2.0.11/d/std_vector.i rename to share/swig/3.0.12/d/std_vector.i index b7d4e22..56f7188 100644 --- a/share/swig/2.0.11/d/std_vector.i +++ b/share/swig/3.0.12/d/std_vector.i
@@ -24,7 +24,7 @@ %define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...) #if (SWIG_D_VERSION == 1) %typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;" -%typemap(dcode) std::vector< CTYPE > %{ +%proxycode %{ public this($typemap(dtype, CTYPE)[] values) { this(); append(values); @@ -128,7 +128,7 @@ return $self->capacity() - $self->size(); } - const_reference remove() throw (std::out_of_range) { + CONST_REFERENCE remove() throw (std::out_of_range) { if ($self->empty()) { throw std::out_of_range("Tried to remove last element from empty vector."); } @@ -138,7 +138,7 @@ return value; } - const_reference remove(size_type index) throw (std::out_of_range) { + CONST_REFERENCE remove(size_type index) throw (std::out_of_range) { if (index >= $self->size()) { throw std::out_of_range("Tried to remove element with invalid index."); } @@ -153,7 +153,7 @@ // Wrappers for setting/getting items with the possibly thrown exception // specified (important for SWIG wrapper generation). %extend { - const_reference getElement(size_type index) throw (std::out_of_range) { + CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) { if ((index < 0) || ($self->size() <= index)) { throw std::out_of_range("Tried to get value of element with invalid index."); } @@ -185,7 +185,7 @@ static import std.range; static import std.traits; %} -%typemap(dcode) std::vector< CTYPE > %{ +%proxycode %{ alias size_t KeyType; alias $typemap(dtype, CTYPE) ValueType; @@ -464,7 +464,7 @@ return pv; } - const_reference remove() throw (std::out_of_range) { + CONST_REFERENCE remove() throw (std::out_of_range) { if ($self->empty()) { throw std::out_of_range("Tried to remove last element from empty vector."); } @@ -474,7 +474,7 @@ return value; } - const_reference remove(size_type index) throw (std::out_of_range) { + CONST_REFERENCE remove(size_type index) throw (std::out_of_range) { if (index >= $self->size()) { throw std::out_of_range("Tried to remove element with invalid index."); } @@ -506,7 +506,7 @@ // Wrappers for setting/getting items with the possibly thrown exception // specified (important for SWIG wrapper generation). %extend { - const_reference getElement(size_type index) throw (std::out_of_range) { + CONST_REFERENCE getElement(size_type index) throw (std::out_of_range) { if ((index < 0) || ($self->size() <= index)) { throw std::out_of_range("Tried to get value of element with invalid index."); }
diff --git a/share/swig/2.0.11/d/stl.i b/share/swig/3.0.12/d/stl.i similarity index 100% rename from share/swig/2.0.11/d/stl.i rename to share/swig/3.0.12/d/stl.i
diff --git a/share/swig/2.0.11/d/typemaps.i b/share/swig/3.0.12/d/typemaps.i similarity index 100% rename from share/swig/2.0.11/d/typemaps.i rename to share/swig/3.0.12/d/typemaps.i
diff --git a/share/swig/2.0.11/d/wrapperloader.swg b/share/swig/3.0.12/d/wrapperloader.swg similarity index 100% rename from share/swig/2.0.11/d/wrapperloader.swg rename to share/swig/3.0.12/d/wrapperloader.swg
diff --git a/share/swig/3.0.12/director_common.swg b/share/swig/3.0.12/director_common.swg new file mode 100644 index 0000000..9ce93c7 --- /dev/null +++ b/share/swig/3.0.12/director_common.swg
@@ -0,0 +1,15 @@ +/* ----------------------------------------------------------------------------- + * director_common.swg + * + * This file contains support for director classes which is common between + * languages. + * ----------------------------------------------------------------------------- */ + +/* + Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the + 'Swig' namespace. This could be useful for multi-modules projects. +*/ +#ifdef SWIG_DIRECTOR_STATIC +/* Force anonymous (static) namespace */ +#define Swig +#endif
diff --git a/share/swig/2.0.11/exception.i b/share/swig/3.0.12/exception.i similarity index 94% rename from share/swig/2.0.11/exception.i rename to share/swig/3.0.12/exception.i index 050042d..da0d56c 100644 --- a/share/swig/2.0.11/exception.i +++ b/share/swig/3.0.12/exception.i
@@ -12,10 +12,17 @@ %insert("runtime") "swigerrors.swg" -#ifdef SWIGPHP +#ifdef SWIGPHP5 %{ #include "zend_exceptions.h" -#define SWIG_exception(code, msg) { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); } +#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code TSRMLS_CC); goto thrown; } while (0) +%} +#endif + +#ifdef SWIGPHP7 +%{ +#include "zend_exceptions.h" +#define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code); goto thrown; } while (0) %} #endif @@ -258,6 +265,7 @@ } */ %{ +#include <typeinfo> #include <stdexcept> %} %define SWIG_CATCH_STDEXCEPT @@ -274,6 +282,8 @@ SWIG_exception(SWIG_IndexError, e.what() ); } catch (std::runtime_error& e) { SWIG_exception(SWIG_RuntimeError, e.what() ); + } catch (std::bad_cast& e) { + SWIG_exception(SWIG_TypeError, e.what() ); } catch (std::exception& e) { SWIG_exception(SWIG_SystemError, e.what() ); }
diff --git a/share/swig/2.0.11/gcj/cni.i b/share/swig/3.0.12/gcj/cni.i similarity index 86% rename from share/swig/2.0.11/gcj/cni.i rename to share/swig/3.0.12/gcj/cni.i index b12148e..fcc5668 100644 --- a/share/swig/2.0.11/gcj/cni.i +++ b/share/swig/3.0.12/gcj/cni.i
@@ -4,10 +4,6 @@ %include <gcj/javaprims.i> -extern jobject JvAllocObject (jclass cls); - -extern jobject JvAllocObject (jclass cls, jsize sz); - extern void JvInitClass (jclass cls); extern jstring JvAllocString (jsize sz); @@ -30,7 +26,7 @@ extern void JvFree (void *ptr); -extern jint JvCreateJavaVM (void* vm_args); +extern jint JvCreateJavaVM (JvVMInitArgs* vm_args); extern java::lang::Thread* JvAttachCurrentThread (jstring name, java::lang::ThreadGroup* group);
diff --git a/share/swig/2.0.11/gcj/cni.swg b/share/swig/3.0.12/gcj/cni.swg similarity index 100% rename from share/swig/2.0.11/gcj/cni.swg rename to share/swig/3.0.12/gcj/cni.swg
diff --git a/share/swig/2.0.11/gcj/javaprims.i b/share/swig/3.0.12/gcj/javaprims.i similarity index 100% rename from share/swig/2.0.11/gcj/javaprims.i rename to share/swig/3.0.12/gcj/javaprims.i
diff --git a/share/swig/3.0.12/go/cdata.i b/share/swig/3.0.12/go/cdata.i new file mode 100644 index 0000000..b4411af --- /dev/null +++ b/share/swig/3.0.12/go/cdata.i
@@ -0,0 +1,97 @@ +/* ----------------------------------------------------------------------------- + * cdata.i + * + * SWIG library file containing macros for manipulating raw C data as strings. + * ----------------------------------------------------------------------------- */ + +%{ +typedef struct SWIGCDATA { + char *data; + intgo len; +} SWIGCDATA; +%} + +%fragment("cdata", "header") %{ +struct swigcdata { + intgo size; + void *data; +}; +%} + +%typemap(gotype) SWIGCDATA "[]byte" + +%typemap(imtype) SWIGCDATA "uint64" + +%typemap(out, fragment="cdata") SWIGCDATA(struct swigcdata *swig_out) %{ + swig_out = (struct swigcdata *)malloc(sizeof(*swig_out)); + if (swig_out) { + swig_out->size = $1.len; + swig_out->data = malloc(swig_out->size); + if (swig_out->data) { + memcpy(swig_out->data, $1.data, swig_out->size); + } + } + $result = *(long long *)(void **)&swig_out; +%} + +%typemap(goout) SWIGCDATA %{ + { + type swigcdata struct { size int; data uintptr } + p := (*swigcdata)(unsafe.Pointer(uintptr($1))) + if p == nil || p.data == 0 { + $result = nil + } else { + b := make([]byte, p.size) + a := (*[0x7fffffff]byte)(unsafe.Pointer(p.data))[:p.size] + copy(b, a) + Swig_free(p.data) + Swig_free(uintptr(unsafe.Pointer(p))) + $result = b + } + } +%} + +/* ----------------------------------------------------------------------------- + * %cdata(TYPE [, NAME]) + * + * Convert raw C data to a binary string. + * ----------------------------------------------------------------------------- */ + +%define %cdata(TYPE,NAME...) + +%insert("header") { +#if #NAME == "" +static SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements) { +#else +static SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements) { +#endif + SWIGCDATA d; + d.data = (char *) ptr; +#if #TYPE != "void" + d.len = nelements*sizeof(TYPE); +#else + d.len = nelements; +#endif + return d; +} +} + +%typemap(default) int nelements "$1 = 1;" + +#if #NAME == "" +SWIGCDATA cdata_##TYPE(TYPE *ptr, int nelements); +#else +SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements); +#endif +%enddef + +%typemap(default) int nelements; + +%rename(cdata) ::cdata_void(void *ptr, int nelements); + +%cdata(void); + +/* Memory move function. Due to multi-argument typemaps this appears + to be wrapped as + void memmove(void *data, const char *s); */ +void memmove(void *data, char *indata, int inlen);
diff --git a/share/swig/2.0.11/go/exception.i b/share/swig/3.0.12/go/exception.i similarity index 100% rename from share/swig/2.0.11/go/exception.i rename to share/swig/3.0.12/go/exception.i
diff --git a/share/swig/2.0.11/go/go.swg b/share/swig/3.0.12/go/go.swg similarity index 62% rename from share/swig/2.0.11/go/go.swg rename to share/swig/3.0.12/go/go.swg index cc3beef..53b653f 100644 --- a/share/swig/2.0.11/go/go.swg +++ b/share/swig/3.0.12/go/go.swg
@@ -4,6 +4,11 @@ * Go configuration module. * ------------------------------------------------------------ */ +%include <gostring.swg> + +/* Code insertion directives */ +#define %go_import(...) %insert(go_imports) %{__VA_ARGS__%} + /* Basic types */ %typemap(gotype) bool, const bool & "bool" @@ -14,15 +19,8 @@ %typemap(gotype) unsigned short, const unsigned short & "uint16" %typemap(gotype) int, const int & "int" %typemap(gotype) unsigned int, const unsigned int & "uint" -#if SWIGGO_LONG_TYPE_SIZE == 32 -%typemap(gotype) long, const long & "int32" -%typemap(gotype) unsigned long, const unsigned long & "uint32" -#elif SWIGGO_LONG_TYPE_SIZE == 64 %typemap(gotype) long, const long & "int64" %typemap(gotype) unsigned long, const unsigned long & "uint64" -#else -#error "SWIGGO_LONG_TYPE_SIZE not 32 or 64" -#endif %typemap(gotype) long long, const long long & "int64" %typemap(gotype) unsigned long long, const unsigned long long & "uint64" %typemap(gotype) float, const float & "float32" @@ -52,14 +50,17 @@ const unsigned short &, const int &, const unsigned int &, - const long &, - const unsigned long &, const long long &, const unsigned long long &, const float &, const double & %{ $1 = ($1_ltype)&$input; %} +%typemap(in) const long & ($*1_ltype temp), + const unsigned long & ($*1_ltype temp) +%{ temp = ($*1_ltype)$input; + $1 = ($1_ltype)&temp; %} + %typemap(out) bool, char, signed char, @@ -76,6 +77,22 @@ double %{ $result = $1; %} +%typemap(goout) bool, + char, + signed char, + unsigned char, + short, + unsigned short, + int, + unsigned int, + long, + unsigned long, + long long, + unsigned long long, + float, + double +"" + %typemap(out) const bool &, const char &, const signed char &, @@ -92,8 +109,26 @@ const double & %{ $result = ($*1_ltype)*$1; %} +%typemap(goout) const bool &, + const char &, + const signed char &, + const unsigned char &, + const short &, + const unsigned short &, + const int &, + const unsigned int &, + const long &, + const unsigned long &, + const long long &, + const unsigned long long &, + const float &, + const double & +"" + %typemap(out) void "" +%typemap(goout) void "" + %typemap(directorin) bool, char, signed char, @@ -110,6 +145,22 @@ double %{ $input = ($1_ltype)$1; %} +%typemap(godirectorin) bool, + char, + signed char, + unsigned char, + short, + unsigned short, + int, + unsigned int, + long, + unsigned long, + long long, + unsigned long long, + float, + double +"" + %typemap(directorin) const bool &, const char &, const signed char &, @@ -126,6 +177,22 @@ const double & %{ $input = ($*1_ltype)$1; %} +%typemap(godirectorin) const bool &, + const char &, + const signed char &, + const unsigned char &, + const short &, + const unsigned short &, + const int &, + const unsigned int &, + const long &, + const unsigned long &, + const long long &, + const unsigned long long &, + const float &, + const double & +"" + %typemap(directorout) bool, char, signed char, @@ -142,7 +209,7 @@ double %{ $result = ($1_ltype)$input; %} -%typemap(directorout) const bool &, +%typemap(directorout,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) const bool &, const char &, const signed char &, const unsigned char &, @@ -157,17 +224,13 @@ const float &, const double & %{ - $result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype)); - *$result = *($1_ltype)&$input; + $result = new $*1_ltype($input); + swig_acquire_pointer(&swig_mem, $result); %} /* The size_t type. */ -#if SWIGGO_LONG_TYPE_SIZE == 32 -%typemap(gotype) size_t, const size_t & %{int%} -#else %typemap(gotype) size_t, const size_t & %{int64%} -#endif %typemap(in) size_t %{ $1 = (size_t)$input; %} @@ -178,22 +241,30 @@ %typemap(out) size_t %{ $result = $1; %} +%typemap(goout) size_t "" + %typemap(out) const size_t & %{ $result = ($*1_ltype)*$1; %} +%typemap(goout) const size_t & "" + %typemap(directorin) size_t %{ $input = (size_t)$1; %} +%typemap(godirectorin) size_t "" + %typemap(directorin) const size_t & %{ $input = ($*1_ltype)$1; %} +%typemap(godirectorin) const size_t & "" + %typemap(directorout) size_t %{ $result = ($1_ltype)$input; %} -%typemap(directorout) const size_t & +%typemap(directorout,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) const size_t & %{ - $result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype)); - *$result = *($1_ltype)$input; + $result = new $*1_ltype($input); + swig_acquire_pointer(&swig_mem, $result); %} /* Member pointers. */ @@ -206,17 +277,45 @@ %typemap(out) SWIGTYPE (CLASS::*) %{ - $result = _swig_goallocate(sizeof($1_ltype)); - *($&1_ltype)$result = $1; + struct swig_out_type { intgo size; void* val; } *swig_out; + swig_out = (struct swig_out_type*)malloc(sizeof(*swig_out)); + if (swig_out) { + swig_out->size = sizeof($1_ltype); + swig_out->val = malloc(swig_out->size); + if (swig_out->val) { + *($&1_ltype)(swig_out->val) = $1; + } + } + $result = swig_out; +%} + +%typemap(goout) SWIGTYPE (CLASS::*) +%{ + { + type swig_out_type struct { size int; val uintptr } + p := (*swig_out_type)(unsafe.Pointer($1)) + if p == nil || p.val == 0 { + $result = nil + } else { + m := make([]byte, p.size) + a := (*[1024]byte)(unsafe.Pointer(p.val))[:p.size] + copy(m, a) + Swig_free(p.val) + Swig_free(uintptr(unsafe.Pointer(p))) + $result = &m[0] + } + } %} %typemap(directorin) SWIGTYPE (CLASS::*) %{ $input = *($&1_ltype)$1; %} +%typemap(godirectorin) SWIGTYPE (CLASS::*) "" + %typemap(directorout) SWIGTYPE (CLASS::*) %{ - $result = _swig_goallocate(sizeof($1_ltype)); - *($&1_ltype)$result = $input; + $result = new $1_ltype($input); + swig_acquire_pointer(&swig_mem, $result); %} /* Pointers. */ @@ -230,13 +329,17 @@ %{ $1 = *($&1_ltype)&$input; %} %typemap(out) SWIGTYPE * -%{ *($&1_ltype)&$result = $1; %} +%{ *($&1_ltype)&$result = ($1_ltype)$1; %} + +%typemap(goout) SWIGTYPE * "" %typemap(directorin) SWIGTYPE * -%{ $input = ($1_ltype)$1; %} +%{ *($&1_ltype)&$input = ($1_ltype)$1; %} + +%typemap(godirectorin) SWIGTYPE * "" %typemap(directorout) SWIGTYPE * -%{ $result = ($1_ltype)$input; %} +%{ $result = *($&1_ltype)&$input; %} %apply SWIGTYPE * { SWIGTYPE *const } @@ -254,6 +357,8 @@ %typemap(out) SWIGTYPE *const& %{ *($1_ltype)&$result = *$1; %} +%typemap(goout) SWIGTYPE *const& "" + /* References. */ /* Converting a C++ reference to Go has to be handled in the C++ @@ -267,12 +372,35 @@ %typemap(out) SWIGTYPE & %{ *($&1_ltype)&$result = $1; %} +%typemap(goout) SWIGTYPE & "" + %typemap(directorin) SWIGTYPE & %{ $input = ($1_ltype)&$1; %} +%typemap(godirectorin) SWIGTYPE & "" + %typemap(directorout) SWIGTYPE & %{ *($&1_ltype)&$result = $input; %} +%typemap(gotype) SWIGTYPE && +%{$gotypename%} + +%typemap(in) SWIGTYPE && +%{ $1 = *($&1_ltype)&$input; %} + +%typemap(out) SWIGTYPE && +%{ *($&1_ltype)&$result = $1; %} + +%typemap(goout) SWIGTYPE && "" + +%typemap(directorin) SWIGTYPE && +%{ $input = ($1_ltype)&$1_name; %} + +%typemap(godirectorin) SWIGTYPE && "" + +%typemap(directorout) SWIGTYPE && +%{ *($&1_ltype)&$result = $input; %} + /* C arrays turn into Go pointers. If we know the length we can use a slice. */ @@ -285,19 +413,20 @@ %typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %} +%typemap(goout) SWIGTYPE [] "" + %typemap(directorin) SWIGTYPE [] %{ $input = *($1_ltype)&$1; %} +%typemap(godirectorin) SWIGTYPE [] "" + %typemap(directorout) SWIGTYPE [] %{ *($&1_ltype)&$result = $input; %} /* Strings. */ %typemap(gotype) - char *, char *&, char[ANY], char[], - signed char *, signed char *&, signed char[ANY], signed char[], - unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[] -"string" + char *, char *&, char[ANY], char[] "string" /* Needed to avoid confusion with the way the go module handles references. */ @@ -305,32 +434,59 @@ %typemap(gotype) signed char& "*int8" %typemap(in) - char *, char[ANY], char[], - signed char *, signed char[ANY], signed char[], - unsigned char *, unsigned char[ANY], unsigned char[] -%{ $1 = ($1_ltype)$input.p; %} - -%typemap(in) char *&, signed char *&, unsigned char *& -%{ $1 = ($1_ltype)$input.p; %} - -%typemap(out) - char *, char *&, char[ANY], char[], - signed char *, signed char *&, signed char[ANY], signed char[], - unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[] -%{ $result = _swig_makegostring((char*)$1, $1 ? strlen((char*)$1) : 0); %} - -%typemap(directorin) - char *, char *&, char[ANY], char[], - signed char *, signed char *&, signed char[ANY], signed char[], - unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[] + char *, char[ANY], char[] %{ - $input = _swig_makegostring((char*)$1, $1 ? strlen((char*)$1) : 0); + $1 = ($1_ltype)malloc($input.n + 1); + memcpy($1, $input.p, $input.n); + $1[$input.n] = '\0'; %} -%typemap(directorout) - char *, char *&, char[ANY], char[], - signed char *, signed char *&, signed char[ANY], signed char[], - unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[] +%typemap(in) char *& (char *temp) +%{ + temp = (char *)malloc($input.n + 1); + memcpy(temp, $input.p, $input.n); + temp[$input.n] = '\0'; + $1 = ($1_ltype)&temp; +%} + +%typemap(freearg) + char *, char *&, char[ANY], char[] +%{ free($1); %} + +%typemap(out,fragment="AllocateString") + char *, char *&, char[ANY], char[] +%{ $result = Swig_AllocateString((char*)$1, $1 ? strlen((char*)$1) : 0); %} + +%typemap(goout,fragment="CopyString") + char *, char *&, char[ANY], char[] +%{ $result = swigCopyString($1) %} + +%typemap(directorin,fragment="AllocateString") + char *, char *&, char[ANY], char[] +%{ + $input = Swig_AllocateString((char*)$1, $1 ? strlen((char*)$1) : 0); +%} + +%typemap(godirectorin,fragment="CopyString") + char *, char *&, char[ANY], char[] +%{ + $result = swigCopyString($input) +%} + +%typemap(godirectorout) + char *, char *&, char[ANY], char[] +%{ + { + p := Swig_malloc(len($input) + 1) + s := (*[1<<30]byte)(unsafe.Pointer(p))[:len($input) + 1] + copy(s, $input) + s[len($input)] = 0 + $result = *(*string)(unsafe.Pointer(&s)) + } +%} + +%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) + char *, char *&, char[ANY], char[] %{ $result = ($1_ltype)$input.p; %} /* String & length */ @@ -343,11 +499,17 @@ $2 = ($2_ltype)$input.n; %} -%typemap(out) (char *STRING, size_t LENGTH) -%{ $result = _swig_makegostring((char*)$1, (size_t)$2); %} +%typemap(out,fragment="AllocateString") (char *STRING, size_t LENGTH) +%{ $result = Swig_AllocateString((char*)$1, (size_t)$2); %} -%typemap(directorin) (char *STRING, size_t LENGTH) -%{ $input = _swig_makegostring((char*)$1, $2); %} +%typemap(goout,fragment="CopyString") (char *STRING, size_t LENGTH) +%{ $result = swigCopyString($1) %} + +%typemap(directorin,fragment="AllocateString") (char *STRING, size_t LENGTH) +%{ $input = Swig_AllocateString((char*)$1, $2); %} + +%typemap(godirectorin,fragment="CopyString") (char *STRING, size_t LENGTH) +%{ $result = swigCopyString($input) %} %typemap(directorout) (char *STRING, size_t LENGTH) %{ @@ -368,8 +530,12 @@ %typemap(out) enum SWIGTYPE %{ $result = (intgo)$1; %} +%typemap(goout) enum SWIGTYPE "" + %typemap(directorin) enum SWIGTYPE -%{ $input = ($1_ltype)$1; %} +%{ $input = (intgo)$1; %} + +%typemap(godirectorin) enum SWIGTYPE "" %typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %} @@ -377,9 +543,11 @@ %typemap(directorin) enum SWIGTYPE & (intgo e) %{ e = (intgo)$1; - $input = &e; + $input = ($1_ltype)&e; %} +%typemap(godirectorin) enum SWIGTYPE & "" + %typemap(directorout) enum SWIGTYPE & %{ $*1_ltype f = ($*1_ltype)*$input; @@ -413,8 +581,12 @@ } #endif +%typemap(goout) SWIGTYPE "" + %typemap(directorin) SWIGTYPE -%{ $input = ($&1_ltype)&$1; %} +%{ $input = new $1_ltype((const $1_ltype &)$1); %} + +%typemap(godirectorin) SWIGTYPE "" %typemap(directorout) SWIGTYPE %{ $result = *($&1_ltype)$input; %} @@ -424,14 +596,14 @@ %typemap(throws) char * %{ _swig_gopanic($1); %} -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ (void)$1; _swig_gopanic("C++ $1_type exception thrown"); %} /* Typecheck typemaps. The purpose of these is merely to issue a - warning for overloaded C++ functions * that cannot be overloaded in + warning for overloaded C++ functions that cannot be overloaded in Go as more than one C++ type maps to a single Go type. */ %typecheck(SWIG_TYPECHECK_BOOL) /* Go bool */ @@ -471,32 +643,16 @@ const unsigned int & "" -#if SWIGGO_LONG_TYPE_SIZE == 32 -%typecheck(SWIG_TYPECHECK_INT32) /* Go int32 */ - long, - const long & - "" - -%typecheck(SWIG_TYPECHECK_INT32) /* Go uint32 */ - unsigned long, - const unsigned long & - "" -#endif - %typecheck(SWIG_TYPECHECK_INT64) /* Go int64 */ -#if SWIGGO_LONG_TYPE_SIZE == 64 long, const long &, -#endif long long, const long long & "" %typecheck(SWIG_TYPECHECK_INT64) /* Go uint64 */ -#if SWIGGO_LONG_TYPE_SIZE == 64 unsigned long, const unsigned long &, -#endif unsigned long long, const unsigned long long & "" @@ -530,6 +686,7 @@ SWIGTYPE, SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const&, SWIGTYPE [], SWIGTYPE (CLASS::*)
diff --git a/share/swig/2.0.11/go/gokw.swg b/share/swig/3.0.12/go/gokw.swg similarity index 100% rename from share/swig/2.0.11/go/gokw.swg rename to share/swig/3.0.12/go/gokw.swg
diff --git a/share/swig/3.0.12/go/goruntime.swg b/share/swig/3.0.12/go/goruntime.swg new file mode 100644 index 0000000..dc6193d --- /dev/null +++ b/share/swig/3.0.12/go/goruntime.swg
@@ -0,0 +1,471 @@ +/* ------------------------------------------------------------ + * goruntime.swg + * + * Go runtime code for the various generated files. + * ------------------------------------------------------------ */ + +%inline %{ +static void Swig_free(void* p) { + free(p); +} + +static void* Swig_malloc(int c) { + return malloc(c); +} +%} + +%insert(runtime) %{ +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> + +%} + +#if SWIGGO_CGO +%insert(cgo_comment_typedefs) %{ +#include <stdint.h> +%} +#endif + +#if SWIGGO_INTGO_SIZE == 32 +%insert(runtime) %{ +typedef int intgo; +typedef unsigned int uintgo; +%} +#if SWIGGO_CGO +%insert(cgo_comment_typedefs) %{ +typedef int intgo; +typedef unsigned int uintgo; +%} +#endif +#elif SWIGGO_INTGO_SIZE == 64 +%insert(runtime) %{ +typedef long long intgo; +typedef unsigned long long uintgo; +%} +#if SWIGGO_CGO +%insert(cgo_comment_typedefs) %{ +typedef long long intgo; +typedef unsigned long long uintgo; +%} +#endif +#else +%insert(runtime) %{ +typedef ptrdiff_t intgo; +typedef size_t uintgo; +%} +#if SWIGGO_CGO +%insert(cgo_comment_typedefs) %{ +typedef ptrdiff_t intgo; +typedef size_t uintgo; +%} +#endif +#endif + +#ifndef SWIGGO_GCCGO +// Set the host compiler struct attribute that will be +// used to match gc's struct layout. For example, on 386 Windows, +// gcc wants to 8-align int64s, but gc does not. +// Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86, +// and https://golang.org/issue/5603. +// See: https://github.com/golang/go/blob/fcbf04f9b93b4cd8addd05c2ed784118eb50a46c/src/cmd/cgo/out.go#L663 +%insert(runtime) %{ +# if !defined(__clang__) && (defined(__i386__) || defined(__x86_64__)) +# define SWIGSTRUCTPACKED __attribute__((__packed__, __gcc_struct__)) +# else +# define SWIGSTRUCTPACKED __attribute__((__packed__)) +# endif +%} +#else +# define SWIGSTRUCTPACKED +#endif + +%insert(runtime) %{ + +typedef struct { char *p; intgo n; } _gostring_; +typedef struct { void* array; intgo len; intgo cap; } _goslice_; + +%} + +#ifdef SWIGGO_CGO + +%insert(cgo_comment_typedefs) %{ + +typedef struct { char *p; intgo n; } _gostring_; +typedef struct { void* array; intgo len; intgo cap; } _goslice_; + +%} + +#endif + +#ifndef SWIGGO_GCCGO +/* Boilerplate for C/C++ code when using 6g/8g. This code is compiled + with gcc. */ +%insert(runtime) %{ + +#define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1]; +#define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n) + +swiggo_size_assert(char, 1) +swiggo_size_assert(short, 2) +swiggo_size_assert(int, 4) +typedef long long swiggo_long_long; +swiggo_size_assert(swiggo_long_long, 8) +swiggo_size_assert(float, 4) +swiggo_size_assert(double, 8) + +#ifdef __cplusplus +extern "C" { +#endif +extern void crosscall2(void (*fn)(void *, int), void *, int); +extern char* _cgo_topofstack(void) __attribute__ ((weak)); +extern void _cgo_allocate(void *, int); +extern void _cgo_panic(void *, int); +#ifdef __cplusplus +} +#endif + +static char *_swig_topofstack() { + if (_cgo_topofstack) { + return _cgo_topofstack(); + } else { + return 0; + } +} + +static void _swig_gopanic(const char *p) { + struct { + const char *p; + } SWIGSTRUCTPACKED a; + a.p = p; + crosscall2(_cgo_panic, &a, (int) sizeof a); +} + +%} + +#if !SWIGGO_CGO + +/* This is here for backward compatibility, but it will not work + with Go 1.5 or later. Do not use it in new code. */ +%insert(runtime) %{ + +static void *_swig_goallocate(size_t len) { + struct { + size_t len; + void *ret; + } SWIGSTRUCTPACKED a; + a.len = len; + crosscall2(_cgo_allocate, &a, (int) sizeof a); + return a.ret; +} + +%} + +#endif + +#if !SWIGGO_CGO + +/* Boilerplate for C code when using 6g/8g. This code is compiled + with 6c/8c. */ +%insert(gc_header) %{ +#include "runtime.h" +#include "cgocall.h" + +#pragma dataflag 16 +static void *cgocall = runtime·cgocall; +#pragma dataflag 16 +void *·_cgo_runtime_cgocall = &cgocall; + +%} + +#endif + +#else + +/* Boilerplate for C/C++ code when using gccgo. */ +%insert(runtime) %{ +#define SWIGGO_GCCGO + +#ifdef __cplusplus +extern "C" { +#endif +extern void *_cgo_allocate(size_t); +extern void _cgo_panic(const char *); +#ifdef __cplusplus +} +#endif + +#define _swig_goallocate _cgo_allocate +#define _swig_gopanic _cgo_panic +%} + +#if !SWIGGO_CGO + +%insert(runtime) %{ + +/* Implementations of SwigCgocall and friends for different versions + of gccgo. The Go code will call these functions using C names with + a prefix of the module name. The implementations here call the + routine in libgo. The routines to call vary depending on the gccgo + version. We assume that the version of gcc used to compile this + file is the same as the version of gccgo. */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SWIG_GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#if SWIG_GCC_VERSION < 40700 +#define SwigDoCgocall() +#define SwigDoCgocallDone() +#define SwigDoCgocallBack() +#define SwigDoCgocallBackDone() +#elif SWIG_GCC_VERSION == 40700 +void SwigDoCgocall(void) __asm__("libgo_syscall.syscall.Entersyscall"); +void SwigDoCgocallDone(void) __asm__("libgo_syscall.syscall.Exitsyscall"); +void SwigDoCgocallBack(void) __asm__("libgo_syscall.syscall.Exitsyscall"); +void SwigDoCgocallBackDone(void) __asm__("libgo_syscall.syscall.Entersyscall"); +#else +void SwigDoCgocall(void) __asm__("syscall.Cgocall"); +void SwigDoCgocallDone(void) __asm__("syscall.CgocallDone"); +void SwigDoCgocallBack(void) __asm__("syscall.CgocallBack"); +void SwigDoCgocallBackDone(void) __asm__("syscall.CgocallBackDone"); +#endif + +#define SWIGSTRINGIFY2(s) #s +#define SWIGSTRINGIFY(s) SWIGSTRINGIFY2(s) + +void SwigCgocall() + __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocall"); +void SwigCgocall() { + SwigDoCgocall(); +} + +void SwigCgocallDone() + __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallDone"); +void SwigCgocallDone() { + SwigDoCgocallDone(); +} + +void SwigCgocallBack() + __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBack"); +void SwigCgocallBack() { + SwigDoCgocallBack(); +} + +void SwigCgocallBackDone() + __asm__(SWIGSTRINGIFY(SWIGGO_PREFIX) ".SwigCgocallBackDone"); +void SwigCgocallBackDone() { + SwigDoCgocallBackDone(); +} + +#undef SWIGSTRINGIFY +#undef SWIGSTRINGIFY2 + +#ifdef __cplusplus +} +#endif + +%} + +#endif + +#endif + +#if !SWIGGO_CGO + +%insert(runtime) %{ + +/* This is here for backward compatibility, but it will not work + with Go 1.5 or later. Do not use it in new code. */ +static _gostring_ _swig_makegostring(const char *p, size_t l) { + _gostring_ ret; + ret.p = (char*)_swig_goallocate(l + 1); + memcpy(ret.p, p, l); + ret.n = l; + return ret; +} + +%} + +#endif + +%insert(runtime) %{ + +#define SWIG_contract_assert(expr, msg) \ + if (!(expr)) { _swig_gopanic(msg); } else +%} + +#ifndef SWIGGO_GCCGO + +%go_import("unsafe", _ "runtime/cgo") + +#if !SWIGGO_CGO +%insert(go_header) %{ +var _cgo_runtime_cgocall func(unsafe.Pointer, uintptr) +%} +#endif + +#else + +%go_import("syscall", "unsafe") + +%insert(go_header) %{ + +type _ syscall.Sockaddr + +%} + +#endif + +%insert(go_header) %{ + +type _ unsafe.Pointer + +%} + +/* Swig_always_false is used to conditionally assign parameters to + Swig_escape_val so that the compiler thinks that they escape. We + only assign them if Swig_always_false is true, which it never is. + We export the variable so that the compiler doesn't realize that it + is never set. */ +%insert(go_header) %{ +var Swig_escape_always_false bool +var Swig_escape_val interface{} +%} + +/* Function pointers are translated by the code in go.cxx into + _swig_fnptr. Member pointers are translated to _swig_memberptr. */ + +%insert(go_header) %{ +type _swig_fnptr *byte +type _swig_memberptr *byte +%} + +/* Handle memory management for directors. */ + +%insert(director) %{ +#include <map> + +namespace { + struct GCItem { + virtual ~GCItem() {} + }; + + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { + } + + GCItem_var& operator=(GCItem *item) { + GCItem *tmp = _item; + _item = item; + delete tmp; + return *this; + } + + ~GCItem_var() { + delete _item; + } + + GCItem* operator->() { + return _item; + } + + private: + GCItem *_item; + }; + + template <typename Type> + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { + } + + virtual ~GCItem_T() { + delete _ptr; + } + + private: + Type *_ptr; + }; +} + +class Swig_memory { +public: + template <typename Type> + void swig_acquire_pointer(Type* vptr) { + if (vptr) { + swig_owner[vptr] = new GCItem_T<Type>(vptr); + } + } +private: + typedef std::map<void *, GCItem_var> swig_ownership_map; + swig_ownership_map swig_owner; +}; + +template <typename Type> +static void swig_acquire_pointer(Swig_memory** pmem, Type* ptr) { + if (!pmem) { + *pmem = new Swig_memory; + } + (*pmem)->swig_acquire_pointer(ptr); +} +%} + +/* For directors we need C++ to track a Go pointer. Since we can't + pass a Go pointer into C++, we use a map to track the pointers on + the Go side. */ + +%go_import("sync") + +%insert(go_header) %{ +type _ sync.Mutex +%} + +%insert(go_director) %{ + +var swigDirectorTrack struct { + sync.Mutex + m map[int]interface{} + c int +} + +func swigDirectorAdd(v interface{}) int { + swigDirectorTrack.Lock() + defer swigDirectorTrack.Unlock() + if swigDirectorTrack.m == nil { + swigDirectorTrack.m = make(map[int]interface{}) + } + swigDirectorTrack.c++ + ret := swigDirectorTrack.c + swigDirectorTrack.m[ret] = v + return ret +} + +func swigDirectorLookup(c int) interface{} { + swigDirectorTrack.Lock() + defer swigDirectorTrack.Unlock() + ret := swigDirectorTrack.m[c] + if ret == nil { + panic("C++ director pointer not found (possible use-after-free)") + } + return ret +} + +func swigDirectorDelete(c int) { + swigDirectorTrack.Lock() + defer swigDirectorTrack.Unlock() + if swigDirectorTrack.m[c] == nil { + if c > swigDirectorTrack.c { + panic("C++ director pointer invalid (possible memory corruption") + } else { + panic("C++ director pointer not found (possible use-after-free)") + } + } + delete(swigDirectorTrack.m, c) +} + +%}
diff --git a/share/swig/3.0.12/go/gostring.swg b/share/swig/3.0.12/go/gostring.swg new file mode 100644 index 0000000..44cbbb8 --- /dev/null +++ b/share/swig/3.0.12/go/gostring.swg
@@ -0,0 +1,29 @@ +/* ------------------------------------------------------------ + * gostring.swg + * + * Support for returning strings from C to Go. + * ------------------------------------------------------------ */ + +// C/C++ code to convert a memory buffer into a Go string allocated in +// C/C++ memory. +%fragment("AllocateString", "runtime") %{ +static _gostring_ Swig_AllocateString(const char *p, size_t l) { + _gostring_ ret; + ret.p = (char*)malloc(l); + memcpy(ret.p, p, l); + ret.n = l; + return ret; +} +%} + +// Go code to convert a string allocated in C++ memory to one +// allocated in Go memory. +%fragment("CopyString", "go_runtime") %{ +type swig_gostring struct { p uintptr; n int } +func swigCopyString(s string) string { + p := *(*swig_gostring)(unsafe.Pointer(&s)) + r := string((*[0x7fffffff]byte)(unsafe.Pointer(p.p))[:p.n]) + Swig_free(p.p) + return r +} +%}
diff --git a/share/swig/2.0.11/go/std_common.i b/share/swig/3.0.12/go/std_common.i similarity index 100% rename from share/swig/2.0.11/go/std_common.i rename to share/swig/3.0.12/go/std_common.i
diff --git a/share/swig/2.0.11/go/std_deque.i b/share/swig/3.0.12/go/std_deque.i similarity index 100% rename from share/swig/2.0.11/go/std_deque.i rename to share/swig/3.0.12/go/std_deque.i
diff --git a/share/swig/2.0.11/go/std_except.i b/share/swig/3.0.12/go/std_except.i similarity index 93% rename from share/swig/2.0.11/go/std_except.i rename to share/swig/3.0.12/go/std_except.i index 789a335..4f021a1 100644 --- a/share/swig/2.0.11/go/std_except.i +++ b/share/swig/3.0.12/go/std_except.i
@@ -7,6 +7,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <typeinfo> #include <stdexcept> %} @@ -16,6 +17,7 @@ struct exception {}; } +%typemap(throws) std::bad_cast %{_swig_gopanic($1.what());%} %typemap(throws) std::bad_exception %{_swig_gopanic($1.what());%} %typemap(throws) std::domain_error %{_swig_gopanic($1.what());%} %typemap(throws) std::exception %{_swig_gopanic($1.what());%}
diff --git a/share/swig/2.0.11/go/std_list.i b/share/swig/3.0.12/go/std_list.i similarity index 100% rename from share/swig/2.0.11/go/std_list.i rename to share/swig/3.0.12/go/std_list.i
diff --git a/share/swig/2.0.11/go/std_map.i b/share/swig/3.0.12/go/std_map.i similarity index 100% rename from share/swig/2.0.11/go/std_map.i rename to share/swig/3.0.12/go/std_map.i
diff --git a/share/swig/2.0.11/go/std_pair.i b/share/swig/3.0.12/go/std_pair.i similarity index 100% rename from share/swig/2.0.11/go/std_pair.i rename to share/swig/3.0.12/go/std_pair.i
diff --git a/share/swig/3.0.12/go/std_string.i b/share/swig/3.0.12/go/std_string.i new file mode 100644 index 0000000..099ae84 --- /dev/null +++ b/share/swig/3.0.12/go/std_string.i
@@ -0,0 +1,91 @@ +/* ----------------------------------------------------------------------------- + * std_string.i + * + * Typemaps for std::string and const std::string& + * These are mapped to a Go string and are passed around by value. + * + * To use non-const std::string references use the following %apply. Note + * that they are passed by value. + * %apply const std::string & {std::string &}; + * ----------------------------------------------------------------------------- */ + +%{ +#include <string> +%} + +namespace std { + +%naturalvar string; + +class string; + +%typemap(gotype) string, const string & "string" + +%typemap(in) string +%{ $1.assign($input.p, $input.n); %} + +%typemap(godirectorout) string +%{ + { + p := Swig_malloc(len($input)) + s := (*[1<<30]byte)(unsafe.Pointer(p))[:len($input)] + copy(s, $input) + $result = *(*string)(unsafe.Pointer(&s)) + } +%} + +%typemap(directorout) string +%{ + $result.assign($input.p, $input.n); + free($input.p); +%} + +%typemap(out,fragment="AllocateString") string +%{ $result = Swig_AllocateString($1.data(), $1.length()); %} + +%typemap(goout,fragment="CopyString") string +%{ $result = swigCopyString($1) %} + +%typemap(directorin,fragment="AllocateString") string +%{ $input = Swig_AllocateString($1.data(), $1.length()); %} + +%typemap(godirectorin,fragment="CopyString") string +%{ $result = swigCopyString($input) %} + +%typemap(in) const string & +%{ + $*1_ltype $1_str($input.p, $input.n); + $1 = &$1_str; +%} + +%typemap(godirectorout) const string & +%{ + { + p := Swig_malloc(len($input)) + s := (*[1<<30]byte)(unsafe.Pointer(p))[:len($input)] + copy(s, $input) + $result = *(*string)(unsafe.Pointer(&s)) + } +%} + +%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string & +%{ + static $*1_ltype $1_str; + $1_str.assign($input.p, $input.n); + free($input.p); + $result = &$1_str; +%} + +%typemap(out,fragment="AllocateString") const string & +%{ $result = Swig_AllocateString((*$1).data(), (*$1).length()); %} + +%typemap(goout,fragment="CopyString") const string & +%{ $result = swigCopyString($1) %} + +%typemap(directorin,fragment="AllocateString") const string & +%{ $input = Swig_AllocateString($1.data(), $1.length()); %} + +%typemap(godirectorin,fragment="CopyString") const string & +%{ $result = swigCopyString($input) %} + +}
diff --git a/share/swig/2.0.11/go/std_vector.i b/share/swig/3.0.12/go/std_vector.i similarity index 97% rename from share/swig/2.0.11/go/std_vector.i rename to share/swig/3.0.12/go/std_vector.i index f4ce843..29bcd13 100644 --- a/share/swig/2.0.11/go/std_vector.i +++ b/share/swig/3.0.12/go/std_vector.i
@@ -59,7 +59,7 @@ %rename(add) push_back; void push_back(const value_type& x); %extend { - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/go/stl.i b/share/swig/3.0.12/go/stl.i similarity index 100% rename from share/swig/2.0.11/go/stl.i rename to share/swig/3.0.12/go/stl.i
diff --git a/share/swig/2.0.11/go/typemaps.i b/share/swig/3.0.12/go/typemaps.i similarity index 98% rename from share/swig/2.0.11/go/typemaps.i rename to share/swig/3.0.12/go/typemaps.i index c339fb3..d2e60d3 100644 --- a/share/swig/2.0.11/go/typemaps.i +++ b/share/swig/3.0.12/go/typemaps.i
@@ -67,6 +67,8 @@ %typemap(out) TYPE *INPUT, TYPE &INPUT "" +%typemap(goout) TYPE *INPUT, TYPE &INPUT "" + %typemap(freearg) TYPE *INPUT, TYPE &INPUT "" %typemap(argout) TYPE *INPUT, TYPE &INPUT "" @@ -167,6 +169,8 @@ %typemap(out) TYPE *OUTPUT, TYPE &OUTPUT "" +%typemap(goout) TYPE *INPUT, TYPE &INPUT "" + %typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT "" %typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT @@ -268,6 +272,8 @@ %typemap(out) TYPE *INOUT, TYPE &INOUT "" +%typemap(goout) TYPE *INOUT, TYPE &INOUT "" + %typemap(freearg) TYPE *INOUT, TYPE &INOUT "" %typemap(argout) TYPE *INOUT, TYPE &INOUT ""
diff --git a/share/swig/2.0.11/guile/common.scm b/share/swig/3.0.12/guile/common.scm similarity index 100% rename from share/swig/2.0.11/guile/common.scm rename to share/swig/3.0.12/guile/common.scm
diff --git a/share/swig/2.0.11/guile/cplusplus.i b/share/swig/3.0.12/guile/cplusplus.i similarity index 100% rename from share/swig/2.0.11/guile/cplusplus.i rename to share/swig/3.0.12/guile/cplusplus.i
diff --git a/share/swig/2.0.11/guile/guile.i b/share/swig/3.0.12/guile/guile.i similarity index 100% rename from share/swig/2.0.11/guile/guile.i rename to share/swig/3.0.12/guile/guile.i
diff --git a/share/swig/2.0.11/guile/guile_scm.swg b/share/swig/3.0.12/guile/guile_scm.swg similarity index 100% rename from share/swig/2.0.11/guile/guile_scm.swg rename to share/swig/3.0.12/guile/guile_scm.swg
diff --git a/share/swig/2.0.11/guile/guile_scm_run.swg b/share/swig/3.0.12/guile/guile_scm_run.swg similarity index 93% rename from share/swig/2.0.11/guile/guile_scm_run.swg rename to share/swig/3.0.12/guile/guile_scm_run.swg index 0ac51f9..1cc08b0 100644 --- a/share/swig/2.0.11/guile/guile_scm_run.swg +++ b/share/swig/3.0.12/guile/guile_scm_run.swg
@@ -27,8 +27,7 @@ #endif #if SCM_MAJOR_VERSION >= 2 -// scm_c_define_gsubr takes a different parameter type -// depending on the guile version +/* scm_c_define_gsubr takes a different parameter type depending on the guile version */ typedef scm_t_subr swig_guile_proc; #else @@ -41,10 +40,14 @@ SCM goops_class; } swig_guile_clientdata; +#if SCM_MAJOR_VERSION <= 2 +#define scm_to_utf8_string scm_to_locale_string +#define scm_from_utf8_string scm_from_locale_string +#endif #define SWIG_scm2str(s) \ SWIG_Guile_scm2newstr(s, NULL) #define SWIG_str02scm(str) \ - str ? scm_from_locale_string(str) : SCM_BOOL_F + str ? scm_from_utf8_string(str) : SCM_BOOL_F # define SWIG_malloc(size) \ scm_malloc(size) # define SWIG_free(mem) \ @@ -84,21 +87,13 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) { #define FUNC_NAME "SWIG_Guile_scm2newstr" char *ret; - char *tmp; - size_t l; SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME); - l = scm_c_string_length(str); - ret = (char *) SWIG_malloc( (l + 1) * sizeof(char)); + ret = scm_to_utf8_string(str); if (!ret) return NULL; - tmp = scm_to_locale_string(str); - memcpy(ret, tmp, l); - free(tmp); - - ret[l] = '\0'; - if (len) *len = l; + if (len) *len = strlen(ret) - 1; return ret; #undef FUNC_NAME } @@ -181,6 +176,11 @@ if (SCM_NULLP(smob)) { *result = NULL; return SWIG_OK; +#if SCM_MAJOR_VERSION >= 2 + } else if (SCM_POINTER_P(s)) { + *result = SCM_POINTER_VALUE(s); + return SWIG_OK; +#endif /* if SCM_MAJOR_VERSION >= 2 */ } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) { /* we do not accept smobs representing destroyed pointers */ from = (swig_type_info *) SCM_CELL_WORD_2(smob); @@ -446,13 +446,8 @@ SWIGINTERN swig_module_info * SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - SCM module; - SCM variable; - - module = SWIG_Guile_Init(); - - variable = scm_module_variable(module, - scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME)); + SCM module = SWIG_Guile_Init(); + SCM variable = scm_module_variable(module, scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME)); if (scm_is_false(variable)) { return NULL; } else { @@ -463,11 +458,7 @@ SWIGINTERN void SWIG_Guile_SetModule(swig_module_info *swig_module) { - SCM module; - SCM variable; - - module = SWIG_Guile_Init(); - + SCM module = SWIG_Guile_Init(); scm_module_define(module, scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME), scm_from_ulong((unsigned long) swig_module)); @@ -482,7 +473,7 @@ int num_args_passed = 0; for (i = 0; i<reqargs; i++) { if (!SCM_CONSP(rest)) - scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure")); + scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure")); *dest++ = SCM_CAR(rest); rest = SCM_CDR(rest); num_args_passed++; @@ -495,7 +486,7 @@ for (; i<optargs; i++) *dest++ = SCM_UNDEFINED; if (!SCM_NULLP(rest)) - scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure")); + scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure")); return num_args_passed; }
diff --git a/share/swig/2.0.11/guile/guilemain.i b/share/swig/3.0.12/guile/guilemain.i similarity index 100% rename from share/swig/2.0.11/guile/guilemain.i rename to share/swig/3.0.12/guile/guilemain.i
diff --git a/share/swig/2.0.11/guile/interpreter.i b/share/swig/3.0.12/guile/interpreter.i similarity index 100% rename from share/swig/2.0.11/guile/interpreter.i rename to share/swig/3.0.12/guile/interpreter.i
diff --git a/share/swig/2.0.11/guile/list-vector.i b/share/swig/3.0.12/guile/list-vector.i similarity index 100% rename from share/swig/2.0.11/guile/list-vector.i rename to share/swig/3.0.12/guile/list-vector.i
diff --git a/share/swig/2.0.11/guile/pointer-in-out.i b/share/swig/3.0.12/guile/pointer-in-out.i similarity index 100% rename from share/swig/2.0.11/guile/pointer-in-out.i rename to share/swig/3.0.12/guile/pointer-in-out.i
diff --git a/share/swig/2.0.11/guile/ports.i b/share/swig/3.0.12/guile/ports.i similarity index 100% rename from share/swig/2.0.11/guile/ports.i rename to share/swig/3.0.12/guile/ports.i
diff --git a/share/swig/2.0.11/guile/std_common.i b/share/swig/3.0.12/guile/std_common.i similarity index 90% rename from share/swig/2.0.11/guile/std_common.i rename to share/swig/3.0.12/guile/std_common.i index 18c7db0..5899c55 100644 --- a/share/swig/2.0.11/guile/std_common.i +++ b/share/swig/3.0.12/guile/std_common.i
@@ -14,7 +14,8 @@ %{ #include <string> -inline std::string SWIG_scm2string(SCM x) { +SWIGINTERNINLINE +std::string SWIG_scm2string(SCM x) { char* temp; temp = SWIG_scm2str(x); std::string s(temp);
diff --git a/share/swig/2.0.11/guile/std_deque.i b/share/swig/3.0.12/guile/std_deque.i similarity index 100% rename from share/swig/2.0.11/guile/std_deque.i rename to share/swig/3.0.12/guile/std_deque.i
diff --git a/share/swig/2.0.11/guile/std_except.i b/share/swig/3.0.12/guile/std_except.i similarity index 89% rename from share/swig/2.0.11/guile/std_except.i rename to share/swig/3.0.12/guile/std_except.i index 61bf481..6c30a31 100644 --- a/share/swig/2.0.11/guile/std_except.i +++ b/share/swig/3.0.12/guile/std_except.i
@@ -1,6 +1,7 @@ // TODO: STL exception handling // Note that the generic std_except.i file did not work %{ +#include <typeinfo> #include <stdexcept> %}
diff --git a/share/swig/2.0.11/guile/std_map.i b/share/swig/3.0.12/guile/std_map.i similarity index 92% rename from share/swig/2.0.11/guile/std_map.i rename to share/swig/3.0.12/guile/std_map.i index 1e1014f..489acc1 100644 --- a/share/swig/2.0.11/guile/std_map.i +++ b/share/swig/3.0.12/guile/std_map.i
@@ -41,11 +41,11 @@ namespace std { template<class K, class T> class map { - %typemap(in) map<K,T> (std::map<K,T>* m) { + %typemap(in) map<K,T> { if (scm_is_null($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); } else if (scm_is_pair($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); SCM alist = $input; while (!scm_is_null(alist)) { K* k; @@ -72,15 +72,13 @@ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); } } - %typemap(in) const map<K,T>& (std::map<K,T> temp, - std::map<K,T>* m), - const map<K,T>* (std::map<K,T> temp, - std::map<K,T>* m) { + %typemap(in) const map<K,T>& (std::map<K,T> temp), + const map<K,T>* (std::map<K,T> temp) { if (scm_is_null($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; } else if (scm_is_pair($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; SCM alist = $input; while (!scm_is_null(alist)) { @@ -109,8 +107,7 @@ } %typemap(out) map<K,T> { SCM alist = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=$i.rbegin(); - i!=$i.rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=$i.rbegin(); i!=$i.rend(); ++i) { K* key = new K(i->first); T* val = new T(i->second); SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); @@ -156,7 +153,7 @@ } } else { /* wrapped map? */ - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -201,7 +198,7 @@ } } else { /* wrapped map? */ - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -222,14 +219,14 @@ typedef K key_type; typedef T mapped_type; map(); - map(const map<K,T> &); + map(const map< K, T> &); unsigned int size() const; bool empty() const; void clear(); %extend { const T& __getitem__(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -239,20 +236,19 @@ (*self)[key] = x; } void __delitem__(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(const K& key) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); return i != self->end(); } SCM keys() { SCM result = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { K* key = new K(i->first); SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); result = scm_cons(k,result); @@ -268,11 +264,11 @@ %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO) template<class T> class map<K,T> { - %typemap(in) map<K,T> (std::map<K,T>* m) { + %typemap(in) map<K,T> { if (scm_is_null($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); } else if (scm_is_pair($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); SCM alist = $input; while (!scm_is_null(alist)) { T* x; @@ -300,15 +296,13 @@ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); } } - %typemap(in) const map<K,T>& (std::map<K,T> temp, - std::map<K,T>* m), - const map<K,T>* (std::map<K,T> temp, - std::map<K,T>* m) { + %typemap(in) const map<K,T>& (std::map<K,T> temp), + const map<K,T>* (std::map<K,T> temp) { if (scm_is_null($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; } else if (scm_is_pair($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; SCM alist = $input; while (!scm_is_null(alist)) { @@ -338,8 +332,7 @@ } %typemap(out) map<K,T> { SCM alist = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { T* val = new T(i->second); SCM k = CONVERT_TO(i->first); SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1); @@ -382,7 +375,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -425,7 +418,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -442,14 +435,14 @@ %rename("has-key?") has_key; public: map(); - map(const map<K,T> &); + map(const map< K, T > &); unsigned int size() const; bool empty() const; void clear(); %extend { T& __getitem__(K key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -459,20 +452,19 @@ (*self)[key] = x; } void __delitem__(K key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(K key) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); return i != self->end(); } SCM keys() { SCM result = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { SCM k = CONVERT_TO(i->first); result = scm_cons(k,result); } @@ -484,11 +476,11 @@ %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO) template<class K> class map<K,T> { - %typemap(in) map<K,T> (std::map<K,T>* m) { + %typemap(in) map<K,T> { if (scm_is_null($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); } else if (scm_is_pair($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); SCM alist = $input; while (!scm_is_null(alist)) { K* k; @@ -515,15 +507,13 @@ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); } } - %typemap(in) const map<K,T>& (std::map<K,T> temp, - std::map<K,T>* m), - const map<K,T>* (std::map<K,T> temp, - std::map<K,T>* m) { + %typemap(in) const map<K,T>& (std::map<K,T> temp), + const map<K,T>* (std::map<K,T> temp) { if (scm_is_null($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; } else if (scm_is_pair($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; SCM alist = $input; while (!scm_is_null(alist)) { @@ -552,8 +542,7 @@ } %typemap(out) map<K,T> { SCM alist = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { K* key = new K(i->first); SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); SCM x = CONVERT_TO(i->second); @@ -572,7 +561,6 @@ K* k; SCM head = SCM_CAR($input); if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); SCM val = SCM_CDR(head); if (SWIG_ConvertPtr(val,(void **) &k, $descriptor(K *), 0) != 0) { @@ -595,7 +583,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -614,7 +602,6 @@ K* k; SCM head = SCM_CAR($input); if (scm_is_pair(head)) { - SCM key = SCM_CAR(head); SCM val = SCM_CDR(head); if (SWIG_ConvertPtr(val,(void **) &k, $descriptor(K *), 0) != 0) { @@ -637,7 +624,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -654,14 +641,14 @@ %rename("has-key?") has_key; public: map(); - map(const map<K,T> &); + map(const map< K, T > &); unsigned int size() const; bool empty() const; void clear(); %extend { T __getitem__(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -671,20 +658,19 @@ (*self)[key] = x; } void __delitem__(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(const K& key) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); return i != self->end(); } SCM keys() { SCM result = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { K* key = new K(i->first); SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1); result = scm_cons(k,result); @@ -698,11 +684,11 @@ %define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO) template<> class map<K,T> { - %typemap(in) map<K,T> (std::map<K,T>* m) { + %typemap(in) map<K,T> { if (scm_is_null($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); } else if (scm_is_pair($input)) { - $1 = std::map<K,T >(); + $1 = std::map< K, T >(); SCM alist = $input; while (!scm_is_null(alist)) { SCM entry, key, val; @@ -731,15 +717,13 @@ SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0)); } } - %typemap(in) const map<K,T>& (std::map<K,T> temp, - std::map<K,T>* m), - const map<K,T>* (std::map<K,T> temp, - std::map<K,T>* m) { + %typemap(in) const map<K,T>& (std::map<K,T> temp), + const map<K,T>* (std::map<K,T> temp) { if (scm_is_null($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; } else if (scm_is_pair($input)) { - temp = std::map<K,T >(); + temp = std::map< K, T >(); $1 = &temp; SCM alist = $input; while (!scm_is_null(alist)) { @@ -769,8 +753,7 @@ } %typemap(out) map<K,T> { SCM alist = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=$1.rbegin(); - i!=$1.rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=$1.rbegin(); i!=$1.rend(); ++i) { SCM k = CONVERT_K_TO(i->first); SCM x = CONVERT_T_TO(i->second); SCM entry = scm_cons(k,x); @@ -809,7 +792,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -849,7 +832,7 @@ } } else { // wrapped map? - std::map<K,T >* m; + std::map< K, T >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -866,14 +849,14 @@ %rename("has-key?") has_key; public: map(); - map(const map<K,T> &); + map(const map< K, T> &); unsigned int size() const; bool empty() const; void clear(); %extend { T __getitem__(K key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -883,20 +866,19 @@ (*self)[key] = x; } void __delitem__(K key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(K key) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); return i != self->end(); } SCM keys() { SCM result = SCM_EOL; - for (std::map<K,T >::reverse_iterator i=self->rbegin(); - i!=self->rend(); ++i) { + for (std::map< K, T >::reverse_iterator i=self->rbegin(); i!=self->rend(); ++i) { SCM k = CONVERT_K_TO(i->first); result = scm_cons(k,result); }
diff --git a/share/swig/2.0.11/guile/std_pair.i b/share/swig/3.0.12/guile/std_pair.i similarity index 98% rename from share/swig/2.0.11/guile/std_pair.i rename to share/swig/3.0.12/guile/std_pair.i index 512d0d5..92dec5f 100644 --- a/share/swig/2.0.11/guile/std_pair.i +++ b/share/swig/3.0.12/guile/std_pair.i
@@ -79,7 +79,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -105,7 +105,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -183,7 +183,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -207,7 +207,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -283,7 +283,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -307,7 +307,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1; @@ -377,7 +377,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $&1_descriptor, 0) == 0) $1 = 1; @@ -398,7 +398,7 @@ } } else { /* wrapped pair? */ - std::pair<T,U >* m; + std::pair< T, U >* m; if (SWIG_ConvertPtr($input,(void **) &m, $1_descriptor, 0) == 0) $1 = 1;
diff --git a/share/swig/2.0.11/guile/std_string.i b/share/swig/3.0.12/guile/std_string.i similarity index 100% rename from share/swig/2.0.11/guile/std_string.i rename to share/swig/3.0.12/guile/std_string.i
diff --git a/share/swig/2.0.11/guile/std_vector.i b/share/swig/3.0.12/guile/std_vector.i similarity index 95% rename from share/swig/2.0.11/guile/std_vector.i rename to share/swig/3.0.12/guile/std_vector.i index 79c716b..d7a7140 100644 --- a/share/swig/2.0.11/guile/std_vector.i +++ b/share/swig/3.0.12/guile/std_vector.i
@@ -44,17 +44,17 @@ %typemap(in) vector<T> { if (scm_is_vector($input)) { unsigned long size = scm_c_vector_length($input); - $1 = std::vector<T >(size); + $1 = std::vector< T >(size); for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref($input,scm_from_ulong(i)); (($1_type &)$1)[i] = *((T*) SWIG_MustGetPtr(o,$descriptor(T *),$argnum, 0)); } } else if (scm_is_null($input)) { - $1 = std::vector<T >(); + $1 = std::vector< T >(); } else if (scm_is_pair($input)) { SCM head, tail; - $1 = std::vector<T >(); + $1 = std::vector< T >(); tail = $input; while (!scm_is_null(tail)) { head = SCM_CAR(tail); @@ -72,7 +72,7 @@ const vector<T>* (std::vector<T> temp) { if (scm_is_vector($input)) { unsigned long size = scm_c_vector_length($input); - temp = std::vector<T >(size); + temp = std::vector< T >(size); $1 = &temp; for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref($input,scm_from_ulong(i)); @@ -81,10 +81,10 @@ $argnum, 0)); } } else if (scm_is_null($input)) { - temp = std::vector<T >(); + temp = std::vector< T >(); $1 = &temp; } else if (scm_is_pair($input)) { - temp = std::vector<T >(); + temp = std::vector< T >(); $1 = &temp; SCM head, tail; tail = $input; @@ -138,7 +138,7 @@ $1 = 0; } else { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $&1_descriptor, 0) != -1) $1 = 1; @@ -178,7 +178,7 @@ $1 = 0; } else { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor, 0) != -1) $1 = 1; @@ -232,7 +232,7 @@ %typemap(in) vector<T> { if (scm_is_vector($input)) { unsigned long size = scm_c_vector_length($input); - $1 = std::vector<T >(size); + $1 = std::vector< T >(size); for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref($input,scm_from_ulong(i)); if (CHECK(o)) @@ -245,7 +245,7 @@ } else if (scm_is_pair($input)) { SCM v = scm_vector($input); unsigned long size = scm_c_vector_length(v); - $1 = std::vector<T >(size); + $1 = std::vector< T >(size); for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref(v,scm_from_ulong(i)); if (CHECK(o)) @@ -262,7 +262,7 @@ const vector<T>* (std::vector<T> temp) { if (scm_is_vector($input)) { unsigned long size = scm_c_vector_length($input); - temp = std::vector<T >(size); + temp = std::vector< T >(size); $1 = &temp; for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref($input,scm_from_ulong(i)); @@ -272,12 +272,12 @@ scm_wrong_type_arg(FUNC_NAME, $argnum, $input); } } else if (scm_is_null($input)) { - temp = std::vector<T >(); + temp = std::vector< T >(); $1 = &temp; } else if (scm_is_pair($input)) { SCM v = scm_vector($input); unsigned long size = scm_c_vector_length(v); - temp = std::vector<T >(size); + temp = std::vector< T >(size); $1 = &temp; for (unsigned long i=0; i<size; i++) { SCM o = scm_vector_ref(v,scm_from_ulong(i)); @@ -306,7 +306,6 @@ $1 = 1; } else { /* check the first element only */ - T* x; SCM o = scm_vector_ref($input,scm_from_ulong(0)); $1 = CHECK(o) ? 1 : 0; } @@ -315,12 +314,11 @@ $1 = 1; } else if (scm_is_pair($input)) { /* check the first element only */ - T* x; SCM head = SCM_CAR($input); $1 = CHECK(head) ? 1 : 0; } else { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; $1 = (SWIG_ConvertPtr($input,(void **) &v, $&1_descriptor, 0) != -1) ? 1 : 0; } @@ -335,7 +333,6 @@ $1 = 1; } else { /* check the first element only */ - T* x; SCM o = scm_vector_ref($input,scm_from_ulong(0)); $1 = CHECK(o) ? 1 : 0; } @@ -344,12 +341,11 @@ $1 = 1; } else if (scm_is_pair($input)) { /* check the first element only */ - T* x; SCM head = SCM_CAR($input); $1 = CHECK(head) ? 1 : 0; } else { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; $1 = (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor, 0) != -1) ? 1 : 0; }
diff --git a/share/swig/2.0.11/guile/stl.i b/share/swig/3.0.12/guile/stl.i similarity index 100% rename from share/swig/2.0.11/guile/stl.i rename to share/swig/3.0.12/guile/stl.i
diff --git a/share/swig/2.0.11/guile/swigrun.i b/share/swig/3.0.12/guile/swigrun.i similarity index 100% rename from share/swig/2.0.11/guile/swigrun.i rename to share/swig/3.0.12/guile/swigrun.i
diff --git a/share/swig/2.0.11/guile/typemaps.i b/share/swig/3.0.12/guile/typemaps.i similarity index 94% rename from share/swig/2.0.11/guile/typemaps.i rename to share/swig/3.0.12/guile/typemaps.i index ba447ac..a01e73f 100644 --- a/share/swig/2.0.11/guile/typemaps.i +++ b/share/swig/3.0.12/guile/typemaps.i
@@ -6,10 +6,10 @@ /* Pointers */ -%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } -%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] ""; +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""; %typemap(in) void * { $1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0); @@ -24,6 +24,10 @@ $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin) SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [] { scm_wrong_type_arg((char *) FUNC_NAME, 1, $input); } @@ -41,7 +45,7 @@ $1 = SWIG_MustGetPtr($input, NULL, 1, 0); } -%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { $result = SWIG_NewPointerObj ($1, $descriptor, $owner); } @@ -58,6 +62,10 @@ $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); +} + %typemap(throws) SWIGTYPE { $<ype temp = new $ltype($1); scm_throw(scm_from_locale_symbol((char *) "swig-exception"), @@ -71,6 +79,12 @@ SCM_UNDEFINED)); } +%typemap(throws) SWIGTYPE && { + scm_throw(gh_symbol2scm((char *) "swig-exception"), + gh_list(SWIG_NewPointerObj(&$1, $descriptor, 1), + SCM_UNDEFINED)); +} + %typemap(throws) SWIGTYPE * { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), scm_listify(SWIG_NewPointerObj($1, $descriptor, 1), @@ -158,11 +172,11 @@ } * (int *) &($1) = scm_to_int($input); } -%typemap(out) enum SWIGTYPE { $result = scm_from_long($1); } -%typemap(varout) enum SWIGTYPE { $result = scm_from_long($1); } +%typemap(out) enum SWIGTYPE { $result = scm_from_long((int)$1); } +%typemap(varout) enum SWIGTYPE { $result = scm_from_long((int)$1); } %typemap(throws) enum SWIGTYPE { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(scm_from_long($1), SCM_UNDEFINED)); + scm_listify(scm_from_long((int)$1), SCM_UNDEFINED)); } /* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of @@ -430,7 +444,7 @@ $1 = scm_is_string($input) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0); $1 = SWIG_CheckState(res); @@ -450,6 +464,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/intrusive_ptr.i b/share/swig/3.0.12/intrusive_ptr.i similarity index 100% rename from share/swig/2.0.11/intrusive_ptr.i rename to share/swig/3.0.12/intrusive_ptr.i
diff --git a/share/swig/2.0.11/inttypes.i b/share/swig/3.0.12/inttypes.i similarity index 89% rename from share/swig/2.0.11/inttypes.i rename to share/swig/3.0.12/inttypes.i index 8450cb8..85bd5ad 100644 --- a/share/swig/2.0.11/inttypes.i +++ b/share/swig/3.0.12/inttypes.i
@@ -41,12 +41,6 @@ /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ extern imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom); - /* Like `strtol' but convert to `intmax_t'. */ - extern intmax_t strtoimax (const char *nptr, char **endptr, int base); - - /* Like `strtoul' but convert to `uintmax_t'. */ - extern uintmax_t strtoumax (const char *nptr, char ** endptr, int base); - #ifdef SWIG_WCHAR /* Like `wcstol' but convert to `intmax_t'. */ extern intmax_t wcstoimax (const wchar_t *nptr, wchar_t **endptr, int base); @@ -84,7 +78,7 @@ extern uintmax_t wcstoumax (const wchar_t *nptr, wchar_t **endptr, int base); #endif -#endif /* SWIGWORDSIZE32 */ +#endif /* SWIGWORDSIZE64 */ #ifdef __cplusplus }
diff --git a/share/swig/2.0.11/java/arrays_java.i b/share/swig/3.0.12/java/arrays_java.i similarity index 98% rename from share/swig/2.0.11/java/arrays_java.i rename to share/swig/3.0.12/java/arrays_java.i index 4b780ae..dd38438 100644 --- a/share/swig/2.0.11/java/arrays_java.i +++ b/share/swig/3.0.12/java/arrays_java.i
@@ -52,7 +52,7 @@ #ifdef __cplusplus %{ *carr = new CTYPE[sz]; %} #else -%{ *carr = (CTYPE*) calloc(sz, sizeof(CTYPE)); %} +%{ *carr = (CTYPE*) malloc(sz * sizeof(CTYPE)); %} #endif %{ if (!*carr) { SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed"); @@ -259,7 +259,7 @@ #ifdef __cplusplus $1 = new $*1_ltype[sz]; #else - $1 = ($1_ltype) calloc(sz, sizeof($*1_ltype)); + $1 = ($1_ltype) malloc(sz * sizeof($*1_ltype)); #endif if (!$1) { SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed"); @@ -289,7 +289,7 @@ #ifdef __cplusplus $1 = new $*1_ltype[sz]; #else - $1 = ($1_ltype) calloc(sz, sizeof($*1_ltype)); + $1 = ($1_ltype) malloc(sz * sizeof($*1_ltype)); #endif if (!$1) { SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed"); @@ -337,7 +337,8 @@ /* Add some code to the proxy class of the array type for converting between type used in * JNI class (long[]) and type used in proxy class ( ARRAYSOFCLASSES[] ) */ -%typemap(javacode) ARRAYSOFCLASSES %{ +%extend ARRAYSOFCLASSES { +%proxycode %{ protected static long[] cArrayUnwrap($javaclassname[] arrayWrapper) { long[] cArray = new long[arrayWrapper.length]; for (int i=0; i<arrayWrapper.length; i++) @@ -352,6 +353,7 @@ return arrayWrapper; } %} +} %enddef /* JAVA_ARRAYSOFCLASSES */
diff --git a/share/swig/2.0.11/java/boost_intrusive_ptr.i b/share/swig/3.0.12/java/boost_intrusive_ptr.i similarity index 98% rename from share/swig/2.0.11/java/boost_intrusive_ptr.i rename to share/swig/3.0.12/java/boost_intrusive_ptr.i index f952589..a484a3b 100644 --- a/share/swig/2.0.11/java/boost_intrusive_ptr.i +++ b/share/swig/3.0.12/java/boost_intrusive_ptr.i
@@ -263,8 +263,8 @@ // Base proxy classes %typemap(javabody) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwnBase; + private transient long swigCPtr; + private transient boolean swigCMemOwnBase; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { swigCMemOwnBase = cMemoryOwn; @@ -278,8 +278,8 @@ // Derived proxy classes %typemap(javabody_derived) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwnDerived; + private transient long swigCPtr; + private transient boolean swigCMemOwnDerived; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { super($imclassname.$javaclazznameSWIGSmartPtrUpcast(cPtr), true); @@ -413,8 +413,8 @@ // Base proxy classes %typemap(javabody) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwnBase; + private transient long swigCPtr; + private transient boolean swigCMemOwnBase; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { swigCMemOwnBase = cMemoryOwn; @@ -428,8 +428,8 @@ // Derived proxy classes %typemap(javabody_derived) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwnDerived; + private transient long swigCPtr; + private transient boolean swigCMemOwnDerived; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { super($imclassname.$javaclazznameSWIGSmartPtrUpcast(cPtr), true);
diff --git a/share/swig/2.0.11/java/boost_shared_ptr.i b/share/swig/3.0.12/java/boost_shared_ptr.i similarity index 97% rename from share/swig/2.0.11/java/boost_shared_ptr.i rename to share/swig/3.0.12/java/boost_shared_ptr.i index e752369..5ed16aa 100644 --- a/share/swig/2.0.11/java/boost_shared_ptr.i +++ b/share/swig/3.0.12/java/boost_shared_ptr.i
@@ -145,8 +145,8 @@ // Base proxy classes %typemap(javabody) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwn; + private transient long swigCPtr; + private transient boolean swigCMemOwn; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; @@ -160,8 +160,8 @@ // Derived proxy classes %typemap(javabody_derived) TYPE %{ - private long swigCPtr; - private boolean swigCMemOwnDerived; + private transient long swigCPtr; + private transient boolean swigCMemOwnDerived; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { super($imclassname.$javaclazznameSWIGSmartPtrUpcast(cPtr), true);
diff --git a/share/swig/3.0.12/java/director.swg b/share/swig/3.0.12/java/director.swg new file mode 100644 index 0000000..355e62d --- /dev/null +++ b/share/swig/3.0.12/java/director.swg
@@ -0,0 +1,413 @@ +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that Java proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) +#include <iostream> +#endif + +#include <exception> + +namespace Swig { + + /* Java object wrapper */ + class JObjectWrapper { + public: + JObjectWrapper() : jthis_(NULL), weak_global_(true) { + } + + ~JObjectWrapper() { + jthis_ = NULL; + weak_global_ = true; + } + + bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { + if (!jthis_) { + weak_global_ = weak_global || !mem_own; // hold as weak global if explicitly requested or not owned + if (jobj) + jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; +#endif + return true; + } else { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; +#endif + return false; + } + } + + jobject get(JNIEnv *jenv) const { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::get("; + if (jthis_) + std::cout << jthis_; + else + std::cout << "null"; + std::cout << ") -> return new local ref" << std::endl; +#endif + return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); + } + + void release(JNIEnv *jenv) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; +#endif + if (jthis_) { + if (weak_global_) { + if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) + jenv->DeleteWeakGlobalRef((jweak)jthis_); + } else + jenv->DeleteGlobalRef(jthis_); + } + + jthis_ = NULL; + weak_global_ = true; + } + + /* Only call peek if you know what you are doing wrt to weak/global references */ + jobject peek() { + return jthis_; + } + + /* Java proxy releases ownership of C++ object, C++ object is now + responsible for destruction (creates NewGlobalRef to pin Java proxy) */ + void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ + if (!weak_global_) { + jenv->DeleteGlobalRef(jthis_); + jthis_ = jenv->NewWeakGlobalRef(jself); + weak_global_ = true; + } + } else { + /* Java releases ownership of C++ object's lifetime */ + if (weak_global_) { + jenv->DeleteWeakGlobalRef((jweak)jthis_); + jthis_ = jenv->NewGlobalRef(jself); + weak_global_ = false; + } + } + } + + private: + /* pointer to Java object */ + jobject jthis_; + /* Local or global reference flag */ + bool weak_global_; + }; + + /* Local JNI reference deleter */ + class LocalRefGuard { + JNIEnv *jenv_; + jobject jobj_; + + // non-copyable + LocalRefGuard(const LocalRefGuard &); + LocalRefGuard &operator=(const LocalRefGuard &); + public: + LocalRefGuard(JNIEnv *jenv, jobject jobj): jenv_(jenv), jobj_(jobj) {} + ~LocalRefGuard() { + if (jobj_) + jenv_->DeleteLocalRef(jobj_); + } + }; + + /* director base class */ + class Director { + /* pointer to Java virtual machine */ + JavaVM *swig_jvm_; + + protected: +#if defined (_MSC_VER) && (_MSC_VER<1300) + class JNIEnvWrapper; + friend class JNIEnvWrapper; +#endif + /* Utility class for managing the JNI environment */ + class JNIEnvWrapper { + const Director *director_; + JNIEnv *jenv_; + int env_status; + public: + JNIEnvWrapper(const Director *director) : director_(director), jenv_(0), env_status(0) { +#if defined(__ANDROID__) + JNIEnv **jenv = &jenv_; +#else + void **jenv = (void **)&jenv_; +#endif + env_status = director_->swig_jvm_->GetEnv((void **)&jenv_, JNI_VERSION_1_2); +#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) + // Attach a daemon thread to the JVM. Useful when the JVM should not wait for + // the thread to exit upon shutdown. Only for jdk-1.4 and later. + director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, NULL); +#else + director_->swig_jvm_->AttachCurrentThread(jenv, NULL); +#endif + } + ~JNIEnvWrapper() { +#if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) + // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. + // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. + if (env_status == JNI_EDETACHED) + director_->swig_jvm_->DetachCurrentThread(); +#endif + } + JNIEnv *getJNIEnv() const { + return jenv_; + } + }; + + /* Java object wrapper */ + JObjectWrapper swig_self_; + + /* Disconnect director from Java object */ + void swig_disconnect_director_self(const char *disconn_method) { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + jobject jobj = swig_self_.get(jenv); + LocalRefGuard ref_deleter(jenv, jobj); +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; +#endif + if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { + jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); + if (disconn_meth) { +#if defined(DEBUG_DIRECTOR_OWNED) + std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; +#endif + jenv->CallVoidMethod(jobj, disconn_meth); + } + } + } + + public: + Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { + /* Acquire the Java VM pointer */ + jenv->GetJavaVM(&swig_jvm_); + } + + virtual ~Director() { + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + swig_self_.release(jenv); + } + + bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { + return swig_self_.set(jenv, jself, mem_own, weak_global); + } + + jobject swig_get_self(JNIEnv *jenv) const { + return swig_self_.get(jenv); + } + + // Change C++ object's ownership, relative to Java + void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { + swig_self_.java_change_ownership(jenv, jself, take_or_release); + } + }; + + // Zero initialized bool array + template<size_t N> class BoolArray { + bool array_[N]; + public: + BoolArray() { + memset(array_, 0, sizeof(array_)); + } + bool& operator[](size_t n) { + return array_[n]; + } + bool operator[](size_t n) const { + return array_[n]; + } + }; + + // Utility classes and functions for exception handling. + + // Simple holder for a Java string during exception handling, providing access to a c-style string + class JavaString { + public: + JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) { + if (jenv_ && jstr_) + cstr_ = (const char *) jenv_->GetStringUTFChars(jstr_, NULL); + } + + ~JavaString() { + if (jenv_ && jstr_ && cstr_) + jenv_->ReleaseStringUTFChars(jstr_, cstr_); + } + + const char *c_str(const char *null_string = "null JavaString") const { + return cstr_ ? cstr_ : null_string; + } + + private: + // non-copyable + JavaString(const JavaString &); + JavaString &operator=(const JavaString &); + + JNIEnv *jenv_; + jstring jstr_; + const char *cstr_; + }; + + // Helper class to extract the exception message from a Java throwable + class JavaExceptionMessage { + public: + JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) { + } + + const char *message() const { + return message_.c_str("Could not get exception message in JavaExceptionMessage"); + } + + private: + // non-copyable + JavaExceptionMessage(const JavaExceptionMessage &); + JavaExceptionMessage &operator=(const JavaExceptionMessage &); + + // Get exception message by calling Java method Throwable.getMessage() + static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) { + jstring jmsg = NULL; + if (jenv && throwable) { + jenv->ExceptionClear(); // Cannot invoke methods with any pending exceptions + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + // All Throwable classes have a getMessage() method, so call it to extract the exception message + jmethodID getMessageMethodID = jenv->GetMethodID(throwclz, "getMessage", "()Ljava/lang/String;"); + if (getMessageMethodID) + jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID); + } + if (jmsg == NULL && jenv->ExceptionCheck()) + jenv->ExceptionClear(); + } + return jmsg; + } + + JavaString message_; + }; + + // C++ Exception class for handling Java exceptions thrown during a director method Java upcall + class DirectorException : public std::exception { + public: + + // Construct exception from a Java throwable + DirectorException(JNIEnv *jenv, jthrowable throwable) : classname_(0), msg_(0) { + + // Call Java method Object.getClass().getName() to obtain the throwable's class name (delimited by '/') + if (throwable) { + jclass throwclz = jenv->GetObjectClass(throwable); + if (throwclz) { + jclass clzclz = jenv->GetObjectClass(throwclz); + if (clzclz) { + jmethodID getNameMethodID = jenv->GetMethodID(clzclz, "getName", "()Ljava/lang/String;"); + if (getNameMethodID) { + jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID)); + // Copy strings, since there is no guarantee that jenv will be active when handled + if (jstr_classname) { + JavaString jsclassname(jenv, jstr_classname); + const char *classname = jsclassname.c_str(0); + if (classname) + classname_ = copypath(classname); + } + } + } + } + } + + JavaExceptionMessage exceptionmsg(jenv, throwable); + msg_ = copystr(exceptionmsg.message()); + } + + // More general constructor for handling as a java.lang.RuntimeException + DirectorException(const char *msg) : classname_(0), msg_(copystr(msg ? msg : "Unspecified DirectorException message")) { + } + + ~DirectorException() throw() { + delete[] classname_; + delete[] msg_; + } + + const char *what() const throw() { + return msg_; + } + + // Reconstruct and raise/throw the Java Exception that caused the DirectorException + // Note that any error in the JNI exception handling results in a Java RuntimeException + void raiseJavaException(JNIEnv *jenv) const { + if (jenv) { + jenv->ExceptionClear(); + + jmethodID ctorMethodID = 0; + jclass throwableclass = 0; + if (classname_) { + throwableclass = jenv->FindClass(classname_); + if (throwableclass) + ctorMethodID = jenv->GetMethodID(throwableclass, "<init>", "(Ljava/lang/String;)V"); + } + + if (ctorMethodID) { + jenv->ThrowNew(throwableclass, what()); + } else { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, what()); + } + } + } + + private: + static char *copypath(const char *srcmsg) { + char *target = copystr(srcmsg); + for (char *c=target; *c; ++c) { + if ('.' == *c) + *c = '/'; + } + return target; + } + + static char *copystr(const char *srcmsg) { + char *target = 0; + if (srcmsg) { + size_t msglen = strlen(srcmsg) + 1; + target = new char[msglen]; + strncpy(target, srcmsg, msglen); + } + return target; + } + + const char *classname_; + const char *msg_; + }; + + // Helper method to determine if a Java throwable matches a particular Java class type + SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname) { + bool matches = false; + + if (throwable && jenv && classname) { + // Exceptions need to be cleared for correct behavior. + // The caller of ExceptionMatches should restore pending exceptions if desired - + // the caller already has the throwable. + jenv->ExceptionClear(); + + jclass clz = jenv->FindClass(classname); + if (clz) { + jclass classclz = jenv->GetObjectClass(clz); + jmethodID isInstanceMethodID = jenv->GetMethodID(classclz, "isInstance", "(Ljava/lang/Object;)Z"); + if (isInstanceMethodID) { + matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0; + } + } + +#if defined(DEBUG_DIRECTOR_EXCEPTION) + if (jenv->ExceptionCheck()) { + // Typically occurs when an invalid classname argument is passed resulting in a ClassNotFoundException + JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred()); + std::cout << "Error: ExceptionMatches: class '" << classname << "' : " << exc.message() << std::endl; + } +#endif + } + return matches; + } +} +
diff --git a/share/swig/2.0.11/java/enums.swg b/share/swig/3.0.12/java/enums.swg similarity index 98% rename from share/swig/2.0.11/java/enums.swg rename to share/swig/3.0.12/java/enums.swg index b8b7f9e..81fe578 100644 --- a/share/swig/2.0.11/java/enums.swg +++ b/share/swig/3.0.12/java/enums.swg
@@ -65,7 +65,6 @@ %typemap(javacode) enum SWIGTYPE "" %typemap(javaimports) enum SWIGTYPE "" %typemap(javainterfaces) enum SWIGTYPE "" -%typemap(javabody) enum SWIGTYPE "" /* * SwigNext static inner class used instead of a static int as static fields cannot be accessed from enum initialisers.
diff --git a/share/swig/2.0.11/java/enumsimple.swg b/share/swig/3.0.12/java/enumsimple.swg similarity index 100% rename from share/swig/2.0.11/java/enumsimple.swg rename to share/swig/3.0.12/java/enumsimple.swg
diff --git a/share/swig/2.0.11/java/enumtypesafe.swg b/share/swig/3.0.12/java/enumtypesafe.swg similarity index 98% rename from share/swig/2.0.11/java/enumtypesafe.swg rename to share/swig/3.0.12/java/enumtypesafe.swg index 976364b..c2012f5 100644 --- a/share/swig/2.0.11/java/enumtypesafe.swg +++ b/share/swig/3.0.12/java/enumtypesafe.swg
@@ -64,7 +64,6 @@ %typemap(javacode) enum SWIGTYPE "" %typemap(javaimports) enum SWIGTYPE "" %typemap(javainterfaces) enum SWIGTYPE "" -%typemap(javabody) enum SWIGTYPE "" /* * The swigToEnum method is used to find the Java enum from a C++ enum integer value. The default one here takes
diff --git a/share/swig/2.0.11/java/enumtypeunsafe.swg b/share/swig/3.0.12/java/enumtypeunsafe.swg similarity index 100% rename from share/swig/2.0.11/java/enumtypeunsafe.swg rename to share/swig/3.0.12/java/enumtypeunsafe.swg
diff --git a/share/swig/2.0.11/java/java.swg b/share/swig/3.0.12/java/java.swg similarity index 91% rename from share/swig/2.0.11/java/java.swg rename to share/swig/3.0.12/java/java.swg index 6126a55..d173cb6 100644 --- a/share/swig/2.0.11/java/java.swg +++ b/share/swig/3.0.12/java/java.swg
@@ -16,10 +16,10 @@ /* Pack binary data into a string */ SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } @@ -30,11 +30,11 @@ %fragment("SWIG_UnPackData", "header") { /* Unpack binary data from a string */ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) @@ -185,6 +185,10 @@ %typemap(jtype) SWIGTYPE & "long" %typemap(jstype) SWIGTYPE & "$javaclassname" +%typemap(jni) SWIGTYPE && "jlong" +%typemap(jtype) SWIGTYPE && "long" +%typemap(jstype) SWIGTYPE && "$javaclassname" + /* pointer to a class member */ %typemap(jni) SWIGTYPE (CLASS::*) "jstring" %typemap(jtype) SWIGTYPE (CLASS::*) "String" @@ -306,8 +310,11 @@ bae = JCALL2(GetByteArrayElements, jenv, ba, 0); sz = JCALL1(GetArrayLength, jenv, ba); $1 = 0; - for(i=0; i<sz; i++) { - $1 = ($1 << 8) | ($1_type)(unsigned char)bae[i]; + if (sz > 0) { + $1 = ($1_type)(signed char)bae[0]; + for(i=1; i<sz; i++) { + $1 = ($1 << 8) | ($1_type)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); } @@ -330,8 +337,11 @@ bae = JCALL2(GetByteArrayElements, jenv, ba, 0); sz = JCALL1(GetArrayLength, jenv, ba); $result = 0; - for(i=0; i<sz; i++) { - $result = ($result << 8) | ($1_type)(unsigned char)bae[i]; + if (sz > 0) { + $result = ($1_type)(signed char)bae[0]; + for(i=1; i<sz; i++) { + $result = ($result << 8) | ($1_type)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); } @@ -353,11 +363,13 @@ JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); bigint = JCALL3(NewObject, jenv, clazz, mid, ba); + JCALL1(DeleteLocalRef, jenv, ba); $result = bigint; } /* Convert to BigInteger (see out typemap) */ -%typemap(directorin, descriptor="Ljava/math/BigInteger;") unsigned long long, const unsigned long long & { +%typemap(directorin, descriptor="Ljava/math/BigInteger;", noblock=1) unsigned long long, const unsigned long long & { +{ jbyteArray ba = JCALL1(NewByteArray, jenv, 9); jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0); jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger"); @@ -372,8 +384,10 @@ JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); bigint = JCALL3(NewObject, jenv, clazz, mid, ba); + JCALL1(DeleteLocalRef, jenv, ba); $input = bigint; } +Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(javadirectorin) unsigned long long "$jniinput" %typemap(javadirectorout) unsigned long long "$javacall" @@ -396,11 +410,12 @@ } %typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char * { - $input = 0; + $input = 0; if ($1) { $input = JCALL1(NewStringUTF, jenv, (const char *)$1); if (!$input) return $null; } + Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(freearg, noblock=1) char * { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, (const char *)$1); } @@ -547,8 +562,11 @@ sz = JCALL1(GetArrayLength, jenv, ba); $1 = &temp; temp = 0; - for(i=0; i<sz; i++) { - temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + if (sz > 0) { + temp = ($*1_ltype)(signed char)bae[0]; + for(i=1; i<sz; i++) { + temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); } @@ -573,8 +591,11 @@ sz = JCALL1(GetArrayLength, jenv, ba); $result = &temp; temp = 0; - for(i=0; i<sz; i++) { - temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + if (sz > 0) { + temp = ($*1_ltype)(signed char)bae[0]; + for(i=1; i<sz; i++) { + temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); } @@ -594,6 +615,7 @@ JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); bigint = JCALL3(NewObject, jenv, clazz, mid, ba); + JCALL1(DeleteLocalRef, jenv, ba); $result = bigint; } @@ -630,8 +652,8 @@ %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE %{ $input = 0; - *(($&1_ltype*)&$input) = &$1; %} -%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, false)" + *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} +%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)" %typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)" /* Generic pointers and references */ @@ -649,6 +671,11 @@ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); return $null; } %} +%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input; + if (!$1) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + return $null; + } %} %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %} %typemap(out, fragment="SWIG_PackData", noblock=1) SWIGTYPE (CLASS::*) { @@ -659,6 +686,8 @@ } %typemap(out) SWIGTYPE & %{ *($&1_ltype)&$result = $1; %} +%typemap(out) SWIGTYPE && +%{ *($&1_ltype)&$result = $1; %} %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE * %{ $result = *($&1_ltype)&$input; %} @@ -676,12 +705,21 @@ return $null; } $result = *($&1_ltype)&$input; %} +%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE && +%{ if (!$input) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type"); + return $null; + } + $result = *($&1_ltype)&$input; %} %typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE & %{ *($&1_ltype)&$input = ($1_ltype) &$1; %} +%typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE && +%{ *($&1_ltype)&$input = ($1_ltype) &$1; %} %typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($jniinput == 0) ? null : new $javaclassname($jniinput, false)" %typemap(javadirectorin) SWIGTYPE & "new $javaclassname($jniinput, false)" -%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$javaclassname.getCPtr($javacall)" +%typemap(javadirectorin) SWIGTYPE && "new $javaclassname($jniinput, false)" +%typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE &, SWIGTYPE && "$javaclassname.getCPtr($javacall)" /* Default array handling */ %typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %} @@ -711,6 +749,7 @@ $input = JCALL1(NewStringUTF, jenv, (const char *)$1); if (!$input) return $null; } + Swig::LocalRefGuard $1_refguard(jenv, $input); } %typemap(argout) char[ANY], char[] "" @@ -959,6 +998,7 @@ SWIGTYPE, SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const&, SWIGTYPE [], SWIGTYPE (CLASS::*) @@ -978,7 +1018,7 @@ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg); return $null; %} -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ (void)$1; SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown"); return $null; %} @@ -1029,7 +1069,7 @@ jobjectArray "$javainput" %typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)" -%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" +%typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$javaclassname.getCPtr($javainput)" %typemap(javain) SWIGTYPE (CLASS::*) "$javaclassname.getCMemberPtr($javainput)" /* The javaout typemap is used for converting function return types from the return type @@ -1083,6 +1123,9 @@ %typemap(javaout) SWIGTYPE & { return new $javaclassname($jnicall, $owner); } +%typemap(javaout) SWIGTYPE && { + return new $javaclassname($jnicall, $owner); + } %typemap(javaout) SWIGTYPE *, SWIGTYPE [] { long cPtr = $jnicall; return (cPtr == 0) ? null : new $javaclassname(cPtr, $owner); @@ -1108,11 +1151,11 @@ %{ *($1_ltype)&$result = *$1; %} /* Typemaps used for the generation of proxy and type wrapper class code */ -%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" -%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" +%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" /* javabody typemaps */ @@ -1121,8 +1164,8 @@ %define SWIG_JAVABODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) // Base proxy classes %typemap(javabody) TYPE %{ - private long swigCPtr; - protected boolean swigCMemOwn; + private transient long swigCPtr; + protected transient boolean swigCMemOwn; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; @@ -1136,7 +1179,7 @@ // Derived proxy classes %typemap(javabody_derived) TYPE %{ - private long swigCPtr; + private transient long swigCPtr; PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) { super($imclassname.$javaclazznameSWIGUpcast(cPtr), cMemoryOwn); @@ -1151,10 +1194,10 @@ %define SWIG_JAVABODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) // Typewrapper classes -%typemap(javabody) TYPE *, TYPE &, TYPE [] %{ - private long swigCPtr; +%typemap(javabody) TYPE *, TYPE &, TYPE &&, TYPE [] %{ + private transient long swigCPtr; - PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean futureUse) { + PTRCTOR_VISIBILITY $javaclassname(long cPtr, @SuppressWarnings("unused") boolean futureUse) { swigCPtr = cPtr; } @@ -1168,9 +1211,9 @@ %} %typemap(javabody) TYPE (CLASS::*) %{ - private String swigCMemberPtr; + private transient String swigCMemberPtr; - PTRCTOR_VISIBILITY $javaclassname(String cMemberPtr, boolean futureUse) { + PTRCTOR_VISIBILITY $javaclassname(String cMemberPtr, @SuppressWarnings("unused") boolean futureUse) { swigCMemberPtr = cMemberPtr; } @@ -1279,6 +1322,7 @@ #define %javaexception(exceptionclasses) %feature("except",throws=exceptionclasses) #define %nojavaexception %feature("except","0",throws="") #define %clearjavaexception %feature("except","",throws="") +#define %proxycode %insert("proxycode") %pragma(java) jniclassclassmodifiers="public class" %pragma(java) moduleclassmodifiers="public class" @@ -1290,6 +1334,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const } @@ -1302,8 +1347,8 @@ %typemap(freearg) (char *STRING, size_t LENGTH) "" %typemap(in) (char *STRING, size_t LENGTH) { if ($input) { - $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0); - $2 = (size_t) JCALL1(GetArrayLength, jenv, $input); + $1 = ($1_ltype) JCALL2(GetByteArrayElements, jenv, $input, 0); + $2 = ($2_type) JCALL1(GetArrayLength, jenv, $input); } else { $1 = 0; $2 = 0; @@ -1312,13 +1357,18 @@ %typemap(argout) (char *STRING, size_t LENGTH) { if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0); } -%typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) { - jbyteArray jb = (jenv)->NewByteArray($2); - (jenv)->SetByteArrayRegion(jb, 0, $2, (jbyte *)$1); - $input = jb; +%typemap(directorin, descriptor="[B", noblock=1) (char *STRING, size_t LENGTH) { + $input = 0; + if ($1) { + $input = JCALL1(NewByteArray, jenv, (jsize)$2); + if (!$input) return $null; + JCALL4(SetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); + } + Swig::LocalRefGuard $1_refguard(jenv, $input); } -%typemap(directorargout) (char *STRING, size_t LENGTH) -%{(jenv)->GetByteArrayRegion($input, 0, $2, (jbyte *)$1); %} +%typemap(directorargout, noblock=1) (char *STRING, size_t LENGTH) +{ if ($input && $1) JCALL4(GetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); } +%typemap(javadirectorin, descriptor="[B") (char *STRING, size_t LENGTH) "$jniinput" %apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) } /* java keywords */
diff --git a/share/swig/2.0.11/java/javahead.swg b/share/swig/3.0.12/java/javahead.swg similarity index 100% rename from share/swig/2.0.11/java/javahead.swg rename to share/swig/3.0.12/java/javahead.swg
diff --git a/share/swig/2.0.11/java/javakw.swg b/share/swig/3.0.12/java/javakw.swg similarity index 100% rename from share/swig/2.0.11/java/javakw.swg rename to share/swig/3.0.12/java/javakw.swg
diff --git a/share/swig/3.0.12/java/std_array.i b/share/swig/3.0.12/java/std_array.i new file mode 100644 index 0000000..cbacfe6 --- /dev/null +++ b/share/swig/3.0.12/java/std_array.i
@@ -0,0 +1,42 @@ +/* ----------------------------------------------------------------------------- + * std_array.i + * ----------------------------------------------------------------------------- */ + +%include <std_common.i> + +namespace std { + + template<class T, size_t N> class array { + public: + typedef T& reference; + typedef const T& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + array(); + array(const array& other); + size_type size() const; + %rename(isEmpty) empty; + bool empty() const; + void fill(const T& u); + %extend { + const_reference get(int i) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && i<size) + return (*self)[i]; + else + throw std::out_of_range("array index out of range"); + } + void set(int i, const value_type& val) throw (std::out_of_range) { + int size = int(self->size()); + if (i>=0 && i<size) + (*self)[i] = val; + else + throw std::out_of_range("array index out of range"); + } + } + }; +} +
diff --git a/share/swig/3.0.12/java/std_auto_ptr.i b/share/swig/3.0.12/java/std_auto_ptr.i new file mode 100644 index 0000000..9b3cd73 --- /dev/null +++ b/share/swig/3.0.12/java/std_auto_ptr.i
@@ -0,0 +1,27 @@ +/* + The typemaps here allow to handle functions returning std::auto_ptr<>, + which is the most common use of this type. If you have functions taking it + as parameter, these typemaps can't be used for them and you need to do + something else (e.g. use shared_ptr<> which SWIG supports fully). + */ + +%define %auto_ptr(TYPE) +%typemap (jni) std::auto_ptr<TYPE > "jlong" +%typemap (jtype) std::auto_ptr<TYPE > "long" +%typemap (jstype) std::auto_ptr<TYPE > "$typemap(jstype, TYPE)" + +%typemap (out) std::auto_ptr<TYPE > %{ + jlong lpp = 0; + *(TYPE**) &lpp = $1.release(); + $result = lpp; +%} +%typemap(javaout) std::auto_ptr<TYPE > { + long cPtr = $jnicall; + return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); + } +%template() std::auto_ptr<TYPE >; +%enddef + +namespace std { + template <class T> class auto_ptr {}; +}
diff --git a/share/swig/2.0.11/java/std_common.i b/share/swig/3.0.12/java/std_common.i similarity index 100% rename from share/swig/2.0.11/java/std_common.i rename to share/swig/3.0.12/java/std_common.i
diff --git a/share/swig/2.0.11/java/std_deque.i b/share/swig/3.0.12/java/std_deque.i similarity index 100% rename from share/swig/2.0.11/java/std_deque.i rename to share/swig/3.0.12/java/std_deque.i
diff --git a/share/swig/2.0.11/java/std_except.i b/share/swig/3.0.12/java/std_except.i similarity index 92% rename from share/swig/2.0.11/java/std_except.i rename to share/swig/3.0.12/java/std_except.i index 9e23d50..91d2f92 100644 --- a/share/swig/2.0.11/java/std_except.i +++ b/share/swig/3.0.12/java/std_except.i
@@ -7,6 +7,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <typeinfo> #include <stdexcept> %} @@ -16,6 +17,7 @@ struct exception {}; } +%typemap(throws) std::bad_cast "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;" %typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;" %typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;" %typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
diff --git a/share/swig/2.0.11/java/std_map.i b/share/swig/3.0.12/java/std_map.i similarity index 100% rename from share/swig/2.0.11/java/std_map.i rename to share/swig/3.0.12/java/std_map.i
diff --git a/share/swig/2.0.11/java/std_pair.i b/share/swig/3.0.12/java/std_pair.i similarity index 100% rename from share/swig/2.0.11/java/std_pair.i rename to share/swig/3.0.12/java/std_pair.i
diff --git a/share/swig/2.0.11/java/std_shared_ptr.i b/share/swig/3.0.12/java/std_shared_ptr.i similarity index 100% rename from share/swig/2.0.11/java/std_shared_ptr.i rename to share/swig/3.0.12/java/std_shared_ptr.i
diff --git a/share/swig/2.0.11/java/std_string.i b/share/swig/3.0.12/java/std_string.i similarity index 90% rename from share/swig/2.0.11/java/std_string.i rename to share/swig/3.0.12/java/std_string.i index f178e6d..830a896 100644 --- a/share/swig/2.0.11/java/std_string.i +++ b/share/swig/3.0.12/java/std_string.i
@@ -38,7 +38,9 @@ %typemap(directorout) string %{ if(!$input) { - SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + if (!jenv->ExceptionCheck()) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null string"); + } return $null; } const char *$1_pstr = (const char *)jenv->GetStringUTFChars($input, 0); @@ -47,7 +49,8 @@ jenv->ReleaseStringUTFChars($input, $1_pstr); %} %typemap(directorin,descriptor="Ljava/lang/String;") string -%{ $input = jenv->NewStringUTF($1.c_str()); %} +%{ $input = jenv->NewStringUTF($1.c_str()); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} %typemap(out) string %{ $result = jenv->NewStringUTF($1.c_str()); %} @@ -96,7 +99,8 @@ jenv->ReleaseStringUTFChars($input, $1_pstr); %} %typemap(directorin,descriptor="Ljava/lang/String;") const string & -%{ $input = jenv->NewStringUTF($1.c_str()); %} +%{ $input = jenv->NewStringUTF($1.c_str()); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} %typemap(out) const string & %{ $result = jenv->NewStringUTF($1->c_str()); %}
diff --git a/share/swig/2.0.11/java/std_vector.i b/share/swig/3.0.12/java/std_vector.i similarity index 97% rename from share/swig/2.0.11/java/std_vector.i rename to share/swig/3.0.12/java/std_vector.i index 3f29b19..971b426 100644 --- a/share/swig/2.0.11/java/std_vector.i +++ b/share/swig/3.0.12/java/std_vector.i
@@ -61,7 +61,7 @@ %rename(add) push_back; void push_back(const value_type& x); %extend { - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/java/std_wstring.i b/share/swig/3.0.12/java/std_wstring.i similarity index 90% rename from share/swig/2.0.11/java/std_wstring.i rename to share/swig/3.0.12/java/std_wstring.i index 12d8fc1..dd0b2f5 100644 --- a/share/swig/2.0.11/java/std_wstring.i +++ b/share/swig/3.0.12/java/std_wstring.i
@@ -59,15 +59,16 @@ jenv->ReleaseStringChars($input, $1_pstr); %} -%typemap(directorin,descriptor="Ljava/lang/String;") wstring { +%typemap(directorin,descriptor="Ljava/lang/String;") wstring %{ jsize $1_len = $1.length(); - jchar *conv_buf = new jchar[$1_len]; + jchar *$1_conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { - conv_buf[i] = (jchar)$1[i]; + $1_conv_buf[i] = (jchar)$1[i]; } - $input = jenv->NewString(conv_buf, $1_len); - delete [] conv_buf; -} + $input = jenv->NewString($1_conv_buf, $1_len); + Swig::LocalRefGuard $1_refguard(jenv, $input); + delete [] $1_conv_buf; +%} %typemap(out) wstring %{jsize $1_len = $1.length(); @@ -136,15 +137,16 @@ $result = &$1_str; jenv->ReleaseStringChars($input, $1_pstr); %} -%typemap(directorin,descriptor="Ljava/lang/String;") const wstring & { +%typemap(directorin,descriptor="Ljava/lang/String;") const wstring & %{ jsize $1_len = $1.length(); - jchar *conv_buf = new jchar[$1_len]; + jchar *$1_conv_buf = new jchar[$1_len]; for (jsize i = 0; i < $1_len; ++i) { - conv_buf[i] = (jchar)($1)[i]; + $1_conv_buf[i] = (jchar)($1)[i]; } - $input = jenv->NewString(conv_buf, $1_len); - delete [] conv_buf; -} + $input = jenv->NewString($1_conv_buf, $1_len); + Swig::LocalRefGuard $1_refguard(jenv, $input); + delete [] $1_conv_buf; +%} %typemap(out) const wstring & %{jsize $1_len = $1->length();
diff --git a/share/swig/2.0.11/java/stl.i b/share/swig/3.0.12/java/stl.i similarity index 100% rename from share/swig/2.0.11/java/stl.i rename to share/swig/3.0.12/java/stl.i
diff --git a/share/swig/3.0.12/java/swiginterface.i b/share/swig/3.0.12/java/swiginterface.i new file mode 100644 index 0000000..3344641 --- /dev/null +++ b/share/swig/3.0.12/java/swiginterface.i
@@ -0,0 +1,74 @@ +/* ----------------------------------------------------------------------------- + * swiginterface.i + * + * SWIG interface feature and typemaps implementation providing: + * %interface + * %interface_impl + * %interface_custom + * ----------------------------------------------------------------------------- */ + +%define INTERFACE_TYPEMAPS(CTYPE...) +%typemap(jtype) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "long" +%typemap(jstype) CTYPE "$&javainterfacename" +%typemap(jstype) CTYPE *, CTYPE [], CTYPE & "$javainterfacename" +%typemap(jstype) CTYPE *const& "$*javainterfacename" +%typemap(javain) CTYPE "$javainput.$&interfacename_GetInterfaceCPtr()" +%typemap(javain) CTYPE & "$javainput.$interfacename_GetInterfaceCPtr()" +%typemap(javain) CTYPE *, CTYPE [] "($javainput == null) ? 0 : $javainput.$interfacename_GetInterfaceCPtr()" +%typemap(javain) CTYPE *const& "($javainput == null) ? 0 : $javainput.$*interfacename_GetInterfaceCPtr()" +%typemap(javaout) CTYPE { + return ($&javainterfacename)new $&javaclassname($jnicall, true); + } +%typemap(javaout) CTYPE & { + return ($javainterfacename)new $javaclassname($jnicall, $owner); + } +%typemap(javaout) CTYPE *, CTYPE [] { + long cPtr = $jnicall; + return (cPtr == 0) ? null : ($javainterfacename)new $javaclassname(cPtr, $owner); + } +%typemap(javaout) CTYPE *const& { + long cPtr = $jnicall; + return (cPtr == 0) ? null : ($javainterfacename)new $javaclassname(cPtr, $owner); + } + +%typemap(javadirectorin) CTYPE "($&javainterfacename)new $&javaclassname($jniinput, true)" +%typemap(javadirectorin) CTYPE & "($javainterfacename)new $javaclassname($jniinput, false)" +%typemap(javadirectorin) CTYPE *, CTYPE [] "($jniinput == 0) ? null : ($javainterfacename)new $javaclassname($jniinput, false)" +%typemap(javadirectorin) CTYPE *const& "($jniinput == 0) ? null : ($*javainterfacename)new $*javaclassname($jniinput, false)" +%typemap(javadirectorout) CTYPE "$javacall.$&interfacename_GetInterfaceCPtr()" +%typemap(javadirectorout) CTYPE *, CTYPE [], CTYPE & "$javacall.$interfacename_GetInterfaceCPtr()" +%typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()" +%typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE +%{ $input = 0; + *(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %} +%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE [] +%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %} +%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE & +%{ *($&1_ltype)&$input = ($1_ltype) &$1; %} +%typemap(directorin,descriptor="L$packagepath/$*javainterfacename;") CTYPE *const& +%{ *($&1_ltype)&$input = ($1_ltype) &$1; %} + +%typemap(javainterfacecode, declaration=" long $interfacename_GetInterfaceCPtr();\n", cptrmethod="$interfacename_GetInterfaceCPtr") CTYPE %{ + public long $interfacename_GetInterfaceCPtr() { + return $imclassname.$javaclazzname$interfacename_GetInterfaceCPtr(swigCPtr); + } +%} +%enddef + +%define %interface(CTYPE...) +%feature("interface", name="%sSwigInterface") CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef + +%define %interface_impl(CTYPE...) +%rename("%sSwigImpl") CTYPE; +%feature("interface", name="%(rstrip:[SwigImpl])s") CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef + +%define %interface_custom(PROXY, INTERFACE, CTYPE...) +%rename(PROXY) CTYPE; +%feature("interface", name=INTERFACE) CTYPE; +INTERFACE_TYPEMAPS(CTYPE) +%enddef +
diff --git a/share/swig/2.0.11/java/typemaps.i b/share/swig/3.0.12/java/typemaps.i similarity index 80% rename from share/swig/2.0.11/java/typemaps.i rename to share/swig/3.0.12/java/typemaps.i index e71790b..4170915 100644 --- a/share/swig/2.0.11/java/typemaps.i +++ b/share/swig/3.0.12/java/typemaps.i
@@ -109,8 +109,11 @@ bae = JCALL2(GetByteArrayElements, jenv, ba, 0); sz = JCALL1(GetArrayLength, jenv, ba); temp = 0; - for(i=0; i<sz; i++) { - temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + if (sz > 0) { + temp = ($*1_ltype)(signed char)bae[0]; + for(i=1; i<sz; i++) { + temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); $1 = &temp; @@ -184,6 +187,8 @@ %typemap(jtype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]" %typemap(jstype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]" %typemap(javain) TYPE *OUTPUT, TYPE &OUTPUT "$javainput" +%typemap(javadirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$jniinput" +%typemap(javadirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$javacall" %typemap(in) TYPE *OUTPUT($*1_ltype temp), TYPE &OUTPUT($*1_ltype temp) { @@ -201,29 +206,47 @@ %typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT "" -%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT +%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT { JNITYPE jvalue = (JNITYPE)temp$argnum; JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue); } +%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT, TYPE *OUTPUT %{ + $input = JCALL1(New##JAVATYPE##Array, jenv, 1); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} + +%typemap(directorargout, noblock=1) TYPE &OUTPUT +{ + JNITYPE $1_jvalue; + JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + $result = $1_jvalue; +} + +%typemap(directorargout, noblock=1) TYPE *OUTPUT +{ + JNITYPE $1_jvalue; + JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + *$result = $1_jvalue; +} + %typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE; %typemap(typecheck) TYPE &OUTPUT = TYPECHECKTYPE; %enddef -OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray); -OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray); -OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray); -OUTPUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray); -OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -OUTPUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -OUTPUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -OUTPUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava/lang/BigInteger;", SWIGBIGINTEGERARRAY); -OUTPUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray); -OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray); +OUTPUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray); +OUTPUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray); +OUTPUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray); +OUTPUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray); +OUTPUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray); +OUTPUT_TYPEMAP(int, jint, int, Int, "[I", jintArray); +OUTPUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray); +OUTPUT_TYPEMAP(long, jint, int, Int, "[I", jintArray); +OUTPUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray); +OUTPUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray); +OUTPUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[Ljava/math/BigInteger;", jobjectArray); +OUTPUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray); +OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray); #undef OUTPUT_TYPEMAP @@ -259,6 +282,7 @@ JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); bigint = JCALL3(NewObject, jenv, clazz, mid, ba); + JCALL1(DeleteLocalRef, jenv, ba); JCALL3(SetObjectArrayElement, jenv, $input, 0, bigint); } @@ -327,6 +351,8 @@ %typemap(jtype) TYPE *INOUT, TYPE &INOUT "JTYPE[]" %typemap(jstype) TYPE *INOUT, TYPE &INOUT "JTYPE[]" %typemap(javain) TYPE *INOUT, TYPE &INOUT "$javainput" +%typemap(javadirectorin) TYPE *INOUT, TYPE &INOUT "$jniinput" +%typemap(javadirectorout) TYPE *INOUT, TYPE &INOUT "$javacall" %typemap(in) TYPE *INOUT, TYPE &INOUT { if (!$input) { @@ -345,24 +371,47 @@ %typemap(argout) TYPE *INOUT, TYPE &INOUT { JCALL3(Release##JAVATYPE##ArrayElements, jenv, $input, (JNITYPE *)$1, 0); } +%typemap(directorin,descriptor=JNIDESC) TYPE &INOUT %{ + $input = JCALL1(New##JAVATYPE##Array, jenv, 1); + JNITYPE $1_jvalue = (JNITYPE)$1; + JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} + +%typemap(directorin,descriptor=JNIDESC) TYPE *INOUT %{ + $input = JCALL1(New##JAVATYPE##Array, jenv, 1); + JNITYPE $1_jvalue = (JNITYPE)*$1; + JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + Swig::LocalRefGuard $1_refguard(jenv, $input); %} + +%typemap(directorargout, noblock=1) TYPE &INOUT +{ + JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + $result = $1_jvalue; +} + +%typemap(directorargout, noblock=1) TYPE *INOUT +{ + JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); + *$result = $1_jvalue; +} %typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE; %typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE; %enddef -INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray); -INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[Ljava/lang/Byte;", jbyteArray); -INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[Ljava/lang/Short;", jshortArray); -INOUT_TYPEMAP(short, jshort, short, Short, "[Ljava/lang/Short;", jshortArray); -INOUT_TYPEMAP(unsigned short, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -INOUT_TYPEMAP(int, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -INOUT_TYPEMAP(long, jint, int, Int, "[Ljava/lang/Integer;", jintArray); -INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -INOUT_TYPEMAP(long long, jlong, long, Long, "[Ljava/lang/Long;", jlongArray); -INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, NOTUSED, "[Ljava.math.BigInteger;", SWIGBIGINTEGERARRAY); -INOUT_TYPEMAP(float, jfloat, float, Float, "[Ljava/lang/Float;", jfloatArray); -INOUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleArray); +INOUT_TYPEMAP(bool, jboolean, boolean, Boolean, "[Z", jbooleanArray); +INOUT_TYPEMAP(signed char, jbyte, byte, Byte, "[B", jbyteArray); +INOUT_TYPEMAP(unsigned char, jshort, short, Short, "[S", jshortArray); +INOUT_TYPEMAP(short, jshort, short, Short, "[S", jshortArray); +INOUT_TYPEMAP(unsigned short, jint, int, Int, "[I", jintArray); +INOUT_TYPEMAP(int, jint, int, Int, "[I", jintArray); +INOUT_TYPEMAP(unsigned int, jlong, long, Long, "[J", jlongArray); +INOUT_TYPEMAP(long, jint, int, Int, "[I", jintArray); +INOUT_TYPEMAP(unsigned long, jlong, long, Long, "[J", jlongArray); +INOUT_TYPEMAP(long long, jlong, long, Long, "[J", jlongArray); +INOUT_TYPEMAP(unsigned long long, jobject, java.math.BigInteger, Object, "[java/math/BigInteger;", jobjectArray); +INOUT_TYPEMAP(float, jfloat, float, Float, "[F", jfloatArray); +INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray); #undef INOUT_TYPEMAP @@ -416,8 +465,11 @@ bae = JCALL2(GetByteArrayElements, jenv, ba, 0); sz = JCALL1(GetArrayLength, jenv, ba); temp = 0; - for(i=0; i<sz; i++) { - temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + if (sz > 0) { + temp = ($*1_ltype)(signed char)bae[0]; + for(i=1; i<sz; i++) { + temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i]; + } } JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0); $1 = &temp;
diff --git a/share/swig/2.0.11/java/various.i b/share/swig/3.0.12/java/various.i similarity index 72% rename from share/swig/2.0.11/java/various.i rename to share/swig/3.0.12/java/various.i index f589bf7..76fb2b1 100644 --- a/share/swig/2.0.11/java/various.i +++ b/share/swig/3.0.12/java/various.i
@@ -29,7 +29,7 @@ #ifdef __cplusplus $1 = new char*[size+1]; #else - $1 = (char **)calloc(size+1, sizeof(char *)); + $1 = (char **)malloc((size+1) * sizeof(char *)); #endif for (i = 0; i<size; i++) { jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, i); @@ -37,7 +37,7 @@ #ifdef __cplusplus $1[i] = new char [strlen(c_string)+1]; #else - $1[i] = (char *)calloc(strlen(c_string)+1, sizeof(const char *)); + $1[i] = (char *)malloc((strlen(c_string)+1) * sizeof(const char *)); #endif strcpy($1[i], c_string); JCALL2(ReleaseStringUTFChars, jenv, j_string, c_string); @@ -52,7 +52,7 @@ %typemap(freearg) char **STRING_ARRAY { int i; - for (i=0; i<size$argnum-1; i++) + for (i=0; i<size$argnum; i++) #ifdef __cplusplus delete[] $1[i]; delete[] $1; @@ -65,7 +65,7 @@ %typemap(out) char **STRING_ARRAY { if ($1) { int i; - int len=0; + jsize len=0; jstring temp_string; const jclass clazz = JCALL1(FindClass, jenv, "java/lang/String"); @@ -92,6 +92,7 @@ * The returned string appears in the 1st element of the passed in Java String array. * * Example usage wrapping: + * %apply char **STRING_OUT { char **string_out }; * void foo(char **string_out); * * Java usage: @@ -154,3 +155,40 @@ /* Prevent default freearg typemap from being used */ %typemap(freearg) char *BYTE "" +/* + * unsigned char *NIOBUFFER typemaps. + * This is for mapping Java nio buffers to C char arrays. + * It is useful for performance critical code as it reduces the memory copy an marshaling overhead. + * Note: The Java buffer has to be allocated with allocateDirect. + * + * Example usage wrapping: + * %apply unsigned char *NIOBUFFER { unsigned char *buf }; + * void foo(unsigned char *buf); + * + * Java usage: + * java.nio.ByteBuffer b = ByteBuffer.allocateDirect(20); + * modulename.foo(b); + */ +%typemap(jni) unsigned char *NIOBUFFER "jobject" +%typemap(jtype) unsigned char *NIOBUFFER "java.nio.ByteBuffer" +%typemap(jstype) unsigned char *NIOBUFFER "java.nio.ByteBuffer" +%typemap(javain, + pre=" assert $javainput.isDirect() : \"Buffer must be allocated direct.\";") unsigned char *NIOBUFFER "$javainput" +%typemap(javaout) unsigned char *NIOBUFFER { + return $jnicall; +} +%typemap(in) unsigned char *NIOBUFFER { + $1 = (unsigned char *) JCALL1(GetDirectBufferAddress, jenv, $input); + if ($1 == NULL) { + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of a java.nio.ByteBuffer direct byte buffer. Buffer must be a direct buffer and not a non-direct buffer."); + } +} +%typemap(memberin) unsigned char *NIOBUFFER { + if ($input) { + $1 = $input; + } else { + $1 = 0; + } +} +%typemap(freearg) unsigned char *NIOBUFFER "" +
diff --git a/share/swig/3.0.12/javascript/jsc/arrays_javascript.i b/share/swig/3.0.12/javascript/jsc/arrays_javascript.i new file mode 100644 index 0000000..b9199d8 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/arrays_javascript.i
@@ -0,0 +1,123 @@ +/* ----------------------------------------------------------------------------- + * arrays_javascript.i + * + * These typemaps give more natural support for arrays. The typemaps are not efficient + * as there is a lot of copying of the array values whenever the array is passed to C/C++ + * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. + * An exception is thrown if they are not. + * + * Example usage: + * Wrapping: + * + * %include <arrays_javascript.i> + * %inline %{ + * extern int FiddleSticks[3]; + * %} + * + * Use from JavaScript like this: + * + * var fs = [10, 11, 12]; + * example.FiddleSticks = fs; + * fs = example.FiddleSticks; + * ----------------------------------------------------------------------------- */ + +%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} +%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} + +%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY] + (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) { + if (JSValueIsObject(context, $input)) + { + // Convert into Array + array = JSValueToObject(context, $input, NULL); + + length = $1_dim0; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (i = 0; i < length; i++) + { + jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL); + + // Get primitive value from JSObject + res = SWIG_AsVal(int)(jsvalue, &temp); + if (!SWIG_IsOK(res)) + { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + + } + else + { + SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); + } +} + +%typemap(freearg) int[], int[ANY] { + free($1); +} + +%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0) +{ + length = $1_dim0; + JSValueRef values[length]; + + for (i = 0; i < length; i++) + { + values[i] = SWIG_From(int)($1[i]); + } + + $result = JSObjectMakeArray(context, length, values, NULL); +} + +%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY] + (int length = 0, JSObjectRef array, JSValueRef jsvalue, int i = 0, int res = 0, $*1_ltype temp) { + if (JSValueIsObject(context, $input)) + { + // Convert into Array + array = JSValueToObject(context, $input, NULL); + + length = $1_dim0; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (i = 0; i < length; i++) + { + jsvalue = JSObjectGetPropertyAtIndex(context, array, i, NULL); + + // Get primitive value from JSObject + res = SWIG_AsVal(double)(jsvalue, &temp); + if (!SWIG_IsOK(res)) + { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + + } + else + { + SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); + } +} + +%typemap(freearg) double[], double[ANY] { + free($1); +} + +%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0) +{ + length = $1_dim0; + JSValueRef values[length]; + + for (i = 0; i < length; i++) + { + values[i] = SWIG_From(double)($1[i]); + } + + $result = JSObjectMakeArray(context, length, values, NULL); +}
diff --git a/share/swig/3.0.12/javascript/jsc/ccomplex.i b/share/swig/3.0.12/javascript/jsc/ccomplex.i new file mode 100644 index 0000000..50f0f95 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/ccomplex.i
@@ -0,0 +1,26 @@ +/* ----------------------------------------------------------------------------- + * ccomplex.i + * + * C complex typemaps + * ISO C99: 7.3 Complex arithmetic <complex.h> + * ----------------------------------------------------------------------------- */ + + +%include <javascriptcomplex.swg> + +%{ +#include <complex.h> +%} + + +/* C complex constructor */ +#define CCplxConst(r, i) ((r) + I*(i)) + +%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); + +/* declaring the typemaps */ +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
diff --git a/share/swig/2.0.11/octave/cdata.i b/share/swig/3.0.12/javascript/jsc/cdata.i similarity index 100% copy from share/swig/2.0.11/octave/cdata.i copy to share/swig/3.0.12/javascript/jsc/cdata.i
diff --git a/share/swig/2.0.11/python/complex.i b/share/swig/3.0.12/javascript/jsc/complex.i similarity index 100% copy from share/swig/2.0.11/python/complex.i copy to share/swig/3.0.12/javascript/jsc/complex.i
diff --git a/share/swig/3.0.12/javascript/jsc/exception.i b/share/swig/3.0.12/javascript/jsc/exception.i new file mode 100644 index 0000000..0246cfd --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/exception.i
@@ -0,0 +1 @@ +%include <typemaps/exception.swg>
diff --git a/share/swig/3.0.12/javascript/jsc/javascript.swg b/share/swig/3.0.12/javascript/jsc/javascript.swg new file mode 100644 index 0000000..3a83b64 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascript.swg
@@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * javascript.swg + * + * Javascript typemaps + * ----------------------------------------------------------------------------- */ + +%include <typemaps/swigmacros.swg> + +%include <javascripttypemaps.swg> + +%include <javascriptruntime.swg> + +%include <javascripthelpers.swg> + +%include <javascriptkw.swg> + +%include <javascriptcode.swg> + +%include <javascriptinit.swg>
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptcode.swg b/share/swig/3.0.12/javascript/jsc/javascriptcode.swg new file mode 100644 index 0000000..4b21c98 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptcode.swg
@@ -0,0 +1,429 @@ +/* ----------------------------------------------------------------------------- + * js_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor", "templates") +%{ +static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + $jslocals + if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + + $jscode + return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); + goto fail; + fail: + return NULL; +} +%} + +/* ----------------------------------------------------------------------------- + * js_veto_ctor: a vetoing ctor for abstract classes + * - $jswrapper: name of wrapper + * - $jsname: class name + * ----------------------------------------------------------------------------- */ +%fragment ("js_veto_ctor", "templates") +%{ +static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject, + size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated"); +fail: + return 0; +} +%} + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatcher: dispatcher for overloaded constructors + * - $jswrapper: name of wrapper + * - $jsname: class name + * - $jsdispatchcases: part containing code for dispatching + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatcher", "templates") +%{ +static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef ctorObject, + size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + JSObjectRef thisObject = NULL; + + // switch all cases by means of series of if-returns. + $jsdispatchcases + + // default: + SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of $jsname"); + + fail: + return thisObject; +} +%} + +/* ----------------------------------------------------------------------------- + * js_overloaded_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ +%fragment ("js_overloaded_ctor", "templates") +%{ +static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + $jslocals + $jscode + return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); + + goto fail; + fail: + return NULL; +} +%} + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor. + * - $jsargcount: number of arguments of called ctor + * - $jswrapper: wrapper of called ctor + * + * Note: a try-catch-like mechanism is used to switch cases + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatch_case", "templates") +%{ + if(argc == $jsargcount) { + thisObject = $jswrapper(context, NULL, argc, argv, exception); + if(thisObject != NULL) { *exception=0; return thisObject; } /* reset exception and return */ + } +%} + + +/* ----------------------------------------------------------------------------- + * js_dtor: template for a destructor wrapper + * - $jsmangledname: mangled class name + * - $jstype: class type + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtor", "templates") +%{ +static void $jswrapper(JSObjectRef thisObject) +{ + SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject); + if(t) { + if (t->swigCMemOwn) { + free (($jstype)t->swigCObject); + } + JSObjectSetPrivate(thisObject, NULL); + free(t); + } +} +%} + +/* ----------------------------------------------------------------------------- + * js_dtor: template for a destructor wrapper + * - $jsmangledname: mangled class name + * - $jstype: class type + * - ${destructor_action}: The custom destructor action to invoke. + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtoroverride", "templates") +%{ +static void $jswrapper(JSObjectRef thisObject) +{ + SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject); + if(t) { + if (t->swigCMemOwn) { + $jstype arg1 = ($jstype)t->swigCObject; + ${destructor_action} + } + /* remove the private data to make sure that it isn't accessed elsewhere */ + JSObjectSetPrivate(thisObject, NULL); + free(t); + } +} +%} + +/* ----------------------------------------------------------------------------- + * js_getter: template for getter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_getter", "templates") +%{ +static JSValueRef $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) +{ + $jslocals + JSValueRef jsresult; + + $jscode + return jsresult; + + goto fail; + fail: + return JSValueMakeUndefined(context); +} +%} + +/* ----------------------------------------------------------------------------- + * js_setter: template for setter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_setter", "templates") +%{ +static bool $jswrapper(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + $jslocals + $jscode + + return true; + + goto fail; + fail: + return false; +} +%} + +/* ----------------------------------------------------------------------------- + * js_function: template for function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_function", "templates") +%{ +static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + $jslocals + JSValueRef jsresult; + + if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + + $jscode + return jsresult; + + goto fail; + fail: + return JSValueMakeUndefined(context); +} +%} + +/* ----------------------------------------------------------------------------- + * js_function_dispatcher: template for a function dispatcher for overloaded functions + * - $jswrapper: wrapper function name + * - $jsname: name of the wrapped function + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_function_dispatcher", "templates") +%{ +static JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + $jslocals + JSValueRef jsresult; + int res; + $jscode + + SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for function $jsname."); + return jsresult; + + goto fail; + fail: + return JSValueMakeUndefined(context); +} +%} + +/* ----------------------------------------------------------------------------- + * js_overloaded_function: template for a overloaded function + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_overloaded_function", "templates") +%{ +static int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception, JSValueRef* p_result) +{ + $jslocals + JSValueRef jsresult; + + if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + + $jscode + *p_result = jsresult; + return SWIG_OK; + + goto fail; + fail: + return SWIG_TypeError; +} +%} + +/* ----------------------------------------------------------------------------- + * js_function_dispatch_case: template for a case used in the function dispatcher + * - $jswrapper: wrapper function name + * - $jsargcount: number of arguments of overloaded function + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_function_dispatch_case", "templates") +%{ + if(argc == $jsargcount) { + res = $jswrapper(context, function, thisObject, argc, argv, exception, &jsresult); + if(res == SWIG_OK) { *exception = 0; return jsresult; } + } +%} + +/* ----------------------------------------------------------------------------- + * jsc_variable_declaration: template for a variable table entry + * - $jsname: name of the variable + * - $jsgetter: wrapper of getter function + * - $jssetter: wrapper of setter function + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_variable_declaration", "templates") +%{ + {"$jsname", $jsgetter, $jssetter, kJSPropertyAttributeNone}, +%} + + +/* ----------------------------------------------------------------------------- + * jsc_function_declaration: template for a function table entry + * - $jsname: name of the variable + * - $jswrapper: wrapper function + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_function_declaration", "templates") +%{ + {"$jsname", $jswrapper, kJSPropertyAttributeNone}, +%} + +/* ----------------------------------------------------------------------------- + * jsc_classtemplate_declaration: template for a namespace declaration + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_class_declaration", "templates") +%{ +static JSClassDefinition $jsmangledname_classDefinition; + +static JSClassDefinition $jsmangledname_objectDefinition; + +static JSClassRef $jsmangledname_classRef; +%} + +/* ----------------------------------------------------------------------------- + * jsc_class_tables: template for a namespace declaration + * - $jsmangledname: mangled class name + * - $jsstaticclassvariables: list of static variable entries + * - $jsstaticclassfunctions: list of static function entries + * - $jsclassvariables: list of member variable entries + * - $jsclassfunctions: list of member function entries + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_class_tables", "templates") +%{ +static JSStaticValue $jsmangledname_staticValues[] = { + $jsstaticclassvariables + { 0, 0, 0, 0 } +}; + +static JSStaticFunction $jsmangledname_staticFunctions[] = { + $jsstaticclassfunctions + { 0, 0, 0 } +}; + +static JSStaticValue $jsmangledname_values[] = { + $jsclassvariables + { 0, 0, 0, 0 } +}; + +static JSStaticFunction $jsmangledname_functions[] = { + $jsclassfunctions + { 0, 0, 0 } +}; +%} + +/* ----------------------------------------------------------------------------- + * jsc_define_class_template: template for defining a class template + * - $jsmangledname: mangled class name + * - $jsmangledtype: mangled class type + * - $jsctor: wrapper of ctor + * - $jsbaseclass: mangled name of base class + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_class_definition", "templates") +%{ + $jsmangledname_classDefinition.staticFunctions = $jsmangledname_staticFunctions; + $jsmangledname_classDefinition.staticValues = $jsmangledname_staticValues; + $jsmangledname_classDefinition.callAsConstructor = $jsctor; + $jsmangledname_objectDefinition.finalize = $jsdtor; + $jsmangledname_objectDefinition.staticValues = $jsmangledname_values; + $jsmangledname_objectDefinition.staticFunctions = $jsmangledname_functions; + $jsclass_inheritance + $jsmangledname_classRef = JSClassCreate(&$jsmangledname_objectDefinition); + SWIGTYPE_$jsmangledtype->clientdata = $jsmangledname_classRef; +%} + +%fragment ("jsc_class_inherit", templates) +%{ + if (SWIGTYPE_p$jsbaseclassmangled != NULL) { + $jsmangledname_objectDefinition.parentClass = (JSClassRef) SWIGTYPE_p$jsbaseclassmangled->clientdata; + } +%} + +%fragment ("jsc_class_noinherit", templates) +%{ + $jsmangledname_objectDefinition.parentClass = _SwigObject_classRef; +%} + + +/* ----------------------------------------------------------------------------- + * jsc_register_class: template for registration of a class + * - $jsname: class name + * - $jsmangledname: mangled class name + * - $jsnspace: mangled name of namespace + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_class_registration", "templates") +%{ + JS_registerClass(context, $jsnspace_object, "$jsname", &$jsmangledname_classDefinition); +%} + + +/* ----------------------------------------------------------------------------- + * jsc_nspace_declaration: template for a namespace declaration + * - $jsnspace: mangled name of the namespace + * - $jsglobalvariables: list of variable entries + * - $jsglobalfunctions: list if fuction entries + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_nspace_declaration", "templates") +%{ +static JSStaticValue $jsnspace_values[] = { + $jsglobalvariables + { 0, 0, 0, 0 } +}; + +static JSStaticFunction $jsnspace_functions[] = { + $jsglobalfunctions + { 0, 0, 0 } +}; + +static JSClassDefinition $jsnspace_classDefinition; +static JSObjectRef $jsmangledname_object; +%} + +/* ----------------------------------------------------------------------------- + * jsc_nspace_definition: template for definition of a namespace object + * - $jsmangledname: mangled name of namespace + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_nspace_definition", "templates") +%{ + $jsmangledname_classDefinition.staticFunctions = $jsmangledname_functions; + $jsmangledname_classDefinition.staticValues = $jsmangledname_values; + $jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL); +%} + +/* ----------------------------------------------------------------------------- + * jsc_nspace_registration: template for registration of a namespace object + * - $jsname: name of namespace + * - $jsmangledname: mangled name of namespace + * - $jsparent: mangled name of parent namespace + * ----------------------------------------------------------------------------- */ +%fragment ("jsc_nspace_registration", "templates") +%{ + JS_registerNamespace(context, $jsmangledname_object, $jsparent_object, "$jsname"); +%}
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptcomplex.swg b/share/swig/3.0.12/javascript/jsc/javascriptcomplex.swg new file mode 100644 index 0000000..7be120b --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptcomplex.swg
@@ -0,0 +1,146 @@ +/* + Defines the As/From converters for double/float complex, you need to + provide complex Type, the Name you want to use in the converters, + the complex Constructor method, and the Real and Imag complex + accessor methods. + + See the std_complex.i and ccomplex.i for concrete examples. +*/ + +/* the common from converter */ +%define %swig_fromcplx_conv(Type, Real, Imag) +%fragment(SWIG_From_frag(Type),"header", + fragment=SWIG_From_frag(double)) +{ +SWIGINTERNINLINE JSObjectRef +SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) +{ + JSValueRef vals[2]; + vals[0] = SWIG_From(double)(Real(c)); + vals[1] = SWIG_From(double)(Imag(c)); + return JSObjectMakeArray(context, 2, vals, NULL); +} +} +%enddef + +/* the double case */ +%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(double)) +{ +SWIGINTERN int +SWIG_AsVal_dec(Type) (JSValueRef o, Type* val) +{ + if (JSValueIsObject(context, o)) { + JSObjectRef array; + JSValueRef exception, js_re, js_im; + double re, im; + int res; + + exception = 0; + res = 0; + + array = JSValueToObject(context, o, &exception); + if(exception != 0) + return SWIG_TypeError; + + js_re = JSObjectGetPropertyAtIndex(context, array, 0, &exception); + if(exception != 0) + return SWIG_TypeError; + + js_im = JSObjectGetPropertyAtIndex(context, array, 1, &exception); + if(exception != 0) + return SWIG_TypeError; + + res = SWIG_AsVal(double)(js_re, &re); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + res = SWIG_AsVal(double)(js_im, &im); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + if (val) *val = Constructor(re, im); + return SWIG_OK; + } else { + double d; + int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d)); + if (SWIG_IsOK(res)) { + if (val) *val = Constructor(d, 0.0); + return res; + } + } + return SWIG_TypeError; +} +} +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +/* the float case */ +%define %swig_cplxflt_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(float)) { +SWIGINTERN int +SWIG_AsVal_dec(Type)(JSValueRef o, Type *val) +{ + if (JSValueIsObject(context, o)) { + JSObjectRef array; + JSValueRef exception, js_re, js_im; + double re, im; + int res; + + exception = 0; + res = 0; + + array = JSValueToObject(context, o, &exception); + if(exception != 0) + return SWIG_TypeError; + + js_re = JSObjectGetPropertyAtIndex(context, array, 0, &exception); + if(exception != 0) + return SWIG_TypeError; + + js_im = JSObjectGetPropertyAtIndex(context, array, 1, &exception); + if(exception != 0) + return SWIG_TypeError; + + res = SWIG_AsVal(double)(js_re, &re); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + res = SWIG_AsVal(double)(js_im, &im); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { + if (val) *val = Constructor(%numeric_cast(re, float), + %numeric_cast(im, float)); + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else { + float re; + int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); + if (SWIG_IsOK(res)) { + if (val) *val = Constructor(re, 0.0); + return res; + } + } + return SWIG_TypeError; +} +} + +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \ +%swig_cplxflt_conv(Type, Constructor, Real, Imag) + + +#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \ +%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptfragments.swg b/share/swig/3.0.12/javascript/jsc/javascriptfragments.swg new file mode 100644 index 0000000..4778bf0 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptfragments.swg
@@ -0,0 +1,23 @@ +/* + + Create a file with this name, 'javascriptfragments.swg', in your working + directory and add all the %fragments you want to take precedence + over the default ones defined by swig. + + For example, if you add: + + %fragment(SWIG_AsVal_frag(int),"header") { + SWIGINTERNINLINE int + SWIG_AsVal(int)(PyObject *obj, int *val) + { + <your code here>; + } + } + + this will replace the code used to retrieve an integer value for all + the typemaps that need it, including: + + int, std::vector<int>, std::list<std::pair<int,int> >, etc. + + +*/
diff --git a/share/swig/3.0.12/javascript/jsc/javascripthelpers.swg b/share/swig/3.0.12/javascript/jsc/javascripthelpers.swg new file mode 100644 index 0000000..4576543 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascripthelpers.swg
@@ -0,0 +1,69 @@ +%insert(wrapper) %{ + +SWIGINTERN bool JS_registerClass(JSGlobalContextRef context, JSObjectRef parentObject, + const char* className, + JSClassDefinition* definition) { + + JSStringRef js_className = JSStringCreateWithUTF8CString(className); + JSObjectRef classObject = JSObjectMake(context, JSClassCreate(definition), NULL); + JSObjectSetProperty(context, parentObject, + js_className, classObject, + kJSPropertyAttributeNone, NULL); + JSStringRelease(js_className); + + return true; +} + +SWIGINTERN bool JS_registerNamespace(JSGlobalContextRef context, + JSObjectRef namespaceObj, JSObjectRef parentNamespace, + const char* name) +{ + JSStringRef js_name = JSStringCreateWithUTF8CString(name); + JSObjectSetProperty(context, parentNamespace, + js_name, namespaceObj, + kJSPropertyAttributeNone, NULL); + JSStringRelease(js_name); + + return true; +} + + +SWIGINTERN bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object, + const char* functionName, JSObjectCallAsFunctionCallback callback) +{ + JSStringRef js_functionName = JSStringCreateWithUTF8CString(functionName); + JSObjectSetProperty(context, object, js_functionName, + JSObjectMakeFunctionWithCallback(context, js_functionName, callback), + kJSPropertyAttributeNone, NULL); + JSStringRelease(js_functionName); + return true; +} + +SWIGINTERN bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + char buffer[256]; + char msg[512]; + int res; + + JSStringGetUTF8CString(propertyName, buffer, 256); + res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); + + if(res<0) { + SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); + } else { + SWIG_exception(SWIG_ERROR, msg); + } +fail: + return false; +} + +SWIGINTERN JSValueRef JS_CharPtrToJSValue(JSContextRef context, char* cstr) { + JSValueRef val; + + JSStringRef jsstring = JSStringCreateWithUTF8CString((char*) cstr); + val = JSValueMakeString(context, jsstring); + JSStringRelease(jsstring); + + return val; +} +%}
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptinit.swg b/share/swig/3.0.12/javascript/jsc/javascriptinit.swg new file mode 100644 index 0000000..a32ba33 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptinit.swg
@@ -0,0 +1,67 @@ +%insert(init) %{ +SWIGRUNTIME void +SWIG_JSC_SetModule(swig_module_info *swig_module) {} + +SWIGRUNTIME swig_module_info * +SWIG_JSC_GetModule(void) { + return 0; +} + +#define SWIG_GetModule(clientdata) SWIG_JSC_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_JSC_SetModule(pointer) +%} + +%insert(init) "swiginit.swg" + +%fragment ("js_initializer_define", "templates") %{ +#define SWIGJSC_INIT $jsname_initialize +%} + +// Open the initializer function +%insert(init) +%{ + +#ifdef __cplusplus +extern "C" { +#endif + +bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) { + SWIG_InitializeModule(0); +%} + +/* ----------------------------------------------------------------------------- + * js_initializer: template for the module initializer function + * - $jsname: module name + * - $jscreatenamespaces: part with code for creating namespace objects + * - $jscreateclasses: part with code for creating classes + * - $jsregisternamespaces: part with code for registration of namespaces + * ----------------------------------------------------------------------------- */ +%fragment ("js_initializer", "templates") %{ + /* Initialize the base swig type object */ + _SwigObject_objectDefinition.staticFunctions = _SwigObject_functions; + _SwigObject_objectDefinition.staticValues = _SwigObject_values; + _SwigObject_classRef = JSClassCreate(&_SwigObject_objectDefinition); + + /* Initialize the PackedData class */ + _SwigPackedData_objectDefinition.staticFunctions = _SwigPackedData_functions; + _SwigPackedData_objectDefinition.staticValues = _SwigPackedData_values; + _SwigPackedData_objectDefinition.finalize = _wrap_SwigPackedData_delete; + _SwigPackedData_classRef = JSClassCreate(&_SwigPackedData_objectDefinition); + + /* Create objects for namespaces */ + $jscreatenamespaces + + /* Register classes */ + $jsregisterclasses + + /* Register namespaces */ + $jsregisternamespaces + + *exports = exports_object; + + return true; +} +#ifdef __cplusplus +} +#endif +%}
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptkw.swg b/share/swig/3.0.12/javascript/jsc/javascriptkw.swg new file mode 100644 index 0000000..c3c1183 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptkw.swg
@@ -0,0 +1,40 @@ +#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_ +#define JAVASCRIPT_JAVASCRIPTKW_SWG_ + +/* Warnings for Java keywords */ +#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x` + +/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */ + +JAVASCRIPTKW(break); +JAVASCRIPTKW(case); +JAVASCRIPTKW(catch); +JAVASCRIPTKW(continue); +JAVASCRIPTKW(default); +JAVASCRIPTKW(delete); +JAVASCRIPTKW(do); +JAVASCRIPTKW(else); +JAVASCRIPTKW(finally); +JAVASCRIPTKW(for); +JAVASCRIPTKW(function); +JAVASCRIPTKW(if); +JAVASCRIPTKW(in); +JAVASCRIPTKW(instanceof); +JAVASCRIPTKW(new); +JAVASCRIPTKW(return); +JAVASCRIPTKW(switch); +JAVASCRIPTKW(this); +JAVASCRIPTKW(throw); +JAVASCRIPTKW(try); +JAVASCRIPTKW(typeof); +JAVASCRIPTKW(var); +JAVASCRIPTKW(void); +JAVASCRIPTKW(while); +JAVASCRIPTKW(with); + +/* others bad names if any*/ +// for example %namewarn("321:clone() is a javascript bad method name") *::clone(); + +#undef JAVASCRIPTKW + +#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptprimtypes.swg b/share/swig/3.0.12/javascript/jsc/javascriptprimtypes.swg new file mode 100644 index 0000000..20d575d --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptprimtypes.swg
@@ -0,0 +1,192 @@ +/* ------------------------------------------------------------ + * Primitive Types + * ------------------------------------------------------------ */ + +/* boolean */ + +%fragment(SWIG_From_frag(bool),"header") { +SWIGINTERNINLINE +JSValueRef SWIG_From_dec(bool)(bool value) +{ + return JSValueMakeBoolean(context, value); +} +} + +%fragment(SWIG_AsVal_frag(bool),"header", + fragment=SWIG_AsVal_frag(long)) { +SWIGINTERN +int SWIG_AsVal_dec(bool)(JSValueRef obj, bool *val) +{ + if(!JSValueIsBoolean(context, obj)) { + return SWIG_ERROR; + } + if (val) *val = JSValueToBoolean(context, obj); + return SWIG_OK; +} +} + +/* int */ + +%fragment(SWIG_From_frag(int),"header") { +SWIGINTERNINLINE JSValueRef + SWIG_From_dec(int)(int value) +{ + return JSValueMakeNumber(context, value); +} +} + +/* long */ + +%fragment(SWIG_From_frag(long),"header") { +SWIGINTERNINLINE JSValueRef +SWIG_From_dec(long)(long value) +{ + return JSValueMakeNumber(context, value); +} +} + +%fragment(SWIG_AsVal_frag(long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN int +SWIG_AsVal_dec(long)(JSValueRef obj, long* val) +{ + if (!JSValueIsNumber(context, obj)) { + return SWIG_TypeError; + } + if(val) *val = (long) JSValueToNumber(context, obj, NULL); + + return SWIG_OK; +} +} + +/* unsigned long */ + +%fragment(SWIG_From_frag(unsigned long),"header", + fragment=SWIG_From_frag(long)) { +SWIGINTERNINLINE JSValueRef +SWIG_From_dec(unsigned long)(unsigned long value) +{ + return (value > LONG_MAX) ? + JSValueMakeNumber(context, value) : JSValueMakeNumber(context, %numeric_cast(value,long)); +} +} + +%fragment(SWIG_AsVal_frag(unsigned long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN int +SWIG_AsVal_dec(unsigned long)(JSValueRef obj, unsigned long *val) +{ + long longVal; + if(!JSValueIsNumber(context, obj)) { + return SWIG_TypeError; + } + + longVal = (long) JSValueToNumber(context, obj, NULL); + + if(longVal < 0) { + return SWIG_OverflowError; + } + + if(val) *val = longVal; + + return SWIG_OK; +} +} + +/* long long */ +// Note: these are copied from 'long' and probably need fixing + +%fragment(SWIG_From_frag(long long),"header", + fragment=SWIG_From_frag(long), + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE JSValueRef +SWIG_From_dec(long long)(long long value) +{ + return JSValueMakeNumber(context, value); +} +%#endif +} + +%fragment(SWIG_AsVal_frag(long long),"header", + fragment=SWIG_AsVal_frag(long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_dec(long long)(JSValueRef obj, long long* val) +{ + if (!JSValueIsNumber(context, obj)) { + return SWIG_TypeError; + } + if(val) *val = (long long) JSValueToNumber(context, obj, NULL); + + return SWIG_OK; +} +%#endif +} + +/* unsigned long long */ +// Note: these are copied from 'unsigned long' and probably need fixing + +%fragment(SWIG_From_frag(unsigned long long),"header", + fragment=SWIG_From_frag(long long), + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN JSValueRef +SWIG_From_dec(unsigned long long)(unsigned long long value) +{ + return (value > LONG_MAX) ? + JSValueMakeNumber(context, value) : JSValueMakeNumber(context, %numeric_cast(value,long)); +} +%#endif +} + +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment=SWIG_AsVal_frag(unsigned long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN int +SWIG_AsVal_dec(unsigned long long)(JSValueRef obj, unsigned long long *val) +{ + long long longVal; + if(!JSValueIsNumber(context, obj)) { + return SWIG_TypeError; + } + + longVal = (unsigned long long) JSValueToNumber(context, obj, NULL); + + if(longVal < 0) { + return SWIG_OverflowError; + } + + if(val) *val = longVal; + + return SWIG_OK; +} +%#endif +} + +/* double */ + +%fragment(SWIG_From_frag(double),"header") { +SWIGINTERN JSValueRef +SWIG_From_dec(double) (double val) +{ + return JSValueMakeNumber(context, val); +} +} + +%fragment(SWIG_AsVal_frag(double),"header") { +SWIGINTERN int +SWIG_AsVal_dec(double)(JSValueRef obj, double *val) +{ + if(!JSValueIsNumber(context, obj)) { + return SWIG_TypeError; + } + if(val) *val = JSValueToNumber(context, obj, NULL); + + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptrun.swg b/share/swig/3.0.12/javascript/jsc/javascriptrun.swg new file mode 100644 index 0000000..30ee032 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptrun.swg
@@ -0,0 +1,334 @@ +/* ---------------------------------------------------------------------------- + * Errors and exceptions + * + * ---------------------------------------------------------------------------*/ + +#define SWIG_Error(code, msg) SWIG_JSC_exception(context, exception, code, msg) +#define SWIG_exception(code, msg) do { SWIG_JSC_exception(context, exception, code, msg); SWIG_fail; } while (0) +#define SWIG_fail goto fail + +SWIGRUNTIME void SWIG_Javascript_Raise(JSContextRef context, JSValueRef *exception, const char* type) { + JSStringRef message = JSStringCreateWithUTF8CString(type); + JSValueRef error_arguments[1]; + JSObjectRef exception_object; + JSValueRef exception_value; + exception_value = JSValueMakeString(context, message); + /* Converting the result to an object will let JavascriptCore add + "sourceURL" (file) and "line" (number) and "message" to the exception, + instead of just returning a raw string. This is extremely important for debugging your errors. + Using JSObjectMakeError is better than JSValueToObject because the latter only populates + "sourceURL" and "line", but not "message" or any others I don't know about. + */ + error_arguments[0] = exception_value; + exception_object = JSObjectMakeError(context, 1, error_arguments, NULL); + + /* Return the exception_object */ + *exception = exception_object; + + JSStringRelease(message); +} + +SWIGRUNTIME void SWIG_JSC_exception(JSContextRef context, JSValueRef *exception, int code, const char* msg) { + SWIG_Javascript_Raise(context, exception, msg); +} + +/* ---------------------------------------------------------------------------- + * The parent class of all Proxies + * + * ---------------------------------------------------------------------------*/ + +typedef struct { + bool swigCMemOwn; + void *swigCObject; + swig_type_info *info; +} SwigPrivData; + +SWIGRUNTIME JSValueRef _wrap_SwigObject_disown(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + JSValueRef jsresult; + + JSObjectRef obj = JSValueToObject(context, thisObject, NULL); + SwigPrivData *cdata = (SwigPrivData *) JSObjectGetPrivate(obj); + + cdata->swigCMemOwn = false; + + jsresult = JSValueMakeUndefined(context); + return jsresult; +} + +SWIGRUNTIME JSValueRef _wrap_SwigObject_getCPtr(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + JSValueRef jsresult; + long result; + + JSObjectRef obj = JSValueToObject(context, thisObject, NULL); + SwigPrivData *cdata = (SwigPrivData*) JSObjectGetPrivate(obj); + + result = (long) cdata->swigCObject; + jsresult = JSValueMakeNumber(context, result); + + return jsresult; +} + +SWIGRUNTIME JSValueRef _wrap_SwigObject_equals(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) +{ + JSValueRef jsresult; + bool result; + + JSObjectRef obj = JSValueToObject(context, thisObject, NULL); + SwigPrivData *cdata = (SwigPrivData*) JSObjectGetPrivate(obj); + + JSObjectRef obj2 = JSValueToObject(context, argv[0], NULL); + SwigPrivData *cdata2 = (SwigPrivData*) JSObjectGetPrivate(obj2); + + result = (cdata->swigCObject == cdata2->swigCObject); + jsresult = JSValueMakeBoolean(context, result); + + return jsresult; +} + +SWIGRUNTIME JSStaticValue _SwigObject_values[] = { + { + 0, 0, 0, 0 + } +}; + +SWIGRUNTIME JSStaticFunction _SwigObject_functions[] = { + { + "disown",_wrap_SwigObject_disown, kJSPropertyAttributeNone + }, + { + "equals",_wrap_SwigObject_equals, kJSPropertyAttributeNone + }, + { + "getCPtr",_wrap_SwigObject_getCPtr, kJSPropertyAttributeNone + }, + { + 0, 0, 0 + } +}; + +SWIGRUNTIME JSClassDefinition _SwigObject_objectDefinition; + +SWIGRUNTIME JSClassRef _SwigObject_classRef; + + +SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef objRef, void** ptr, swig_type_info *info, int flags) { + SwigPrivData *cdata; + + cdata = (SwigPrivData *) JSObjectGetPrivate(objRef); + if(cdata == NULL) { + return SWIG_ERROR; + } + if(cdata->info != info) { + bool type_valid = false; + swig_cast_info *t = info->cast; + while(t != NULL) { + if(t->type == cdata->info) { + type_valid = true; + break; + } + t = t->next; + } + if(!type_valid) { + return SWIG_TypeError; + } + } + + *ptr = cdata->swigCObject; + + if(flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + + return SWIG_OK; +} + +SWIGRUNTIME int SWIG_JSC_ConvertPtr(JSContextRef context, JSValueRef valRef, void** ptr, swig_type_info *info, int flags) { + JSObjectRef objRef; + + /* special case: JavaScript null => C NULL pointer */ + if(JSValueIsNull(context, valRef)) { + *ptr=0; + return SWIG_OK; + } + + if(!JSValueIsObject(context, valRef)) { + return SWIG_TypeError; + } + + objRef = JSValueToObject(context, valRef, NULL); + if(objRef == NULL) { + return SWIG_ERROR; + } + + return SWIG_JSC_ConvertInstancePtr(context, objRef, ptr, info, flags); +} + +SWIGRUNTIME JSObjectRef SWIG_JSC_NewPointerObj(JSContextRef context, void *ptr, swig_type_info *info, int flags) { + JSClassRef classRef; + JSObjectRef result; + SwigPrivData *cdata; + + if (ptr == NULL) { + // HACK: it is not possible to use JSValueToObject (causing seg-fault) + // This static cast turned out to be a workaround + // In future, we should change the interface of this method + // to return JSValueRef instead of JSObjectRef. + return (JSObjectRef) JSValueMakeNull(context); + } + + if(info->clientdata == NULL) { + classRef = _SwigObject_classRef; + } else { + classRef = (JSClassRef) info->clientdata; + } + + result = JSObjectMake(context, classRef, NULL); + + cdata = (SwigPrivData*) malloc(sizeof(SwigPrivData)); + cdata->swigCObject = ptr; + cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0; + cdata->info = info; + + JSObjectSetPrivate(result, cdata); + + return result; +} + +#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_JSC_ConvertPtr(context, obj, ptr, info, flags) +#define SWIG_NewPointerObj(ptr, info, flags) SWIG_JSC_NewPointerObj(context, ptr, info, flags) + +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_JSC_ConvertInstancePtr(context, obj, pptr, type, flags) +#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_JSC_NewPointerObj(context, thisvalue, type, flags) + +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_JSC_ConvertPtr(context, obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_JSC_NewPointerObj(context, ptr, type, 0) + +/* ---------------------------------------------------------------------------- + * A class for packed data + * + * ---------------------------------------------------------------------------*/ + +typedef struct { + void *data; + size_t size; + swig_type_info *type; +} SwigPackedData; + +SWIGRUNTIME JSStaticValue _SwigPackedData_values[] = { + { + 0, 0, 0, 0 + } +}; +SWIGRUNTIME JSStaticFunction _SwigPackedData_functions[] = { + { + 0, 0, 0 + } +}; +SWIGRUNTIME JSClassDefinition _SwigPackedData_objectDefinition; +SWIGRUNTIME JSClassRef _SwigPackedData_classRef; + +SWIGRUNTIMEINLINE +int SwigJSCPacked_Check(JSContextRef context, JSValueRef valRef) { + return JSValueIsObjectOfClass(context, valRef, _SwigPackedData_classRef); +} + +SWIGRUNTIME +swig_type_info* SwigJSCPacked_UnpackData(JSContextRef context, JSValueRef valRef, void *ptr, size_t size) { + if (SwigJSCPacked_Check(context, valRef)) { + JSObjectRef objRef = JSValueToObject(context, valRef, NULL); + SwigPackedData *sobj = (SwigPackedData *) JSObjectGetPrivate(objRef); + if (sobj->size != size) return 0; + memcpy(ptr, sobj->data, size); + return sobj->type; + } else { + return 0; + } +} + +SWIGRUNTIME +int SWIG_JSC_ConvertPacked(JSContextRef context, JSValueRef valRef, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigJSCPacked_UnpackData(context, valRef, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +SWIGRUNTIME +JSValueRef SWIG_JSC_NewPackedObj(JSContextRef context, void *data, size_t size, swig_type_info *type) { + + JSClassRef classRef = _SwigObject_classRef; + JSObjectRef result = JSObjectMake(context, classRef, NULL); + + SwigPackedData* cdata = (SwigPackedData*) malloc(sizeof(SwigPackedData)); + cdata->data = data; + cdata->size = size; + cdata->type = type; + + JSObjectSetPrivate(result, cdata); + + return result; +} + +/* SwigPackedData wrappers */ +SWIGRUNTIME +void _wrap_SwigPackedData_delete(JSObjectRef obj) +{ + SwigPackedData* cdata = (SwigPackedData*) JSObjectGetPrivate(obj); + if (cdata) { + free(cdata->data); + } +} + +/* for C++ member pointers, ie, member methods */ + +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_JSC_ConvertPacked(context, obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_JSC_NewPackedObj(context, ptr, sz, type) + + +/* --------------------------------------------------------------------------- + * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg) + * + * ---------------------------------------------------------------------------*/ +SWIGRUNTIME +unsigned int SWIGJSC_ArrayLength(JSContextRef context, JSObjectRef arr) { + static JSStringRef LENGTH = 0; + JSValueRef exception = NULL; + JSValueRef js_length; + double length; + + if (LENGTH == 0) { + LENGTH = JSStringCreateWithUTF8CString("length"); + } + + js_length = JSObjectGetProperty(context, arr, LENGTH, &exception); + if (exception == 0 && JSValueIsNumber(context, js_length)) { + length = JSValueToNumber(context, js_length, 0); + return (unsigned int) length; + } else { + return 0; + } +} + +SWIGRUNTIME +JSValueRef SWIGJSC_AppendOutput(JSContextRef context, JSValueRef value, JSValueRef obj) { + JSObjectRef arr; + unsigned int length; + + if (JSValueIsUndefined(context, value)) { + arr = JSObjectMakeArray(context, 0, 0, 0); + } else { + arr = JSValueToObject(context, value, 0); + } + + length = SWIGJSC_ArrayLength(context, arr); + JSObjectSetPropertyAtIndex(context, arr, length, obj, 0); + return arr; +}
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptruntime.swg b/share/swig/3.0.12/javascript/jsc/javascriptruntime.swg new file mode 100644 index 0000000..8f83908 --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptruntime.swg
@@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * javascriptruntime.swg + * + * Javascript support code + * ----------------------------------------------------------------------------- */ + +%insert(runtime) %{ +#include <JavaScriptCore/JavaScript.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <limits.h> +%} + +%insert(runtime) "swigrun.swg"; /* SWIG API */ +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ + +%insert(runtime) "javascriptrun.swg"; /* SWIG errors */
diff --git a/share/swig/3.0.12/javascript/jsc/javascriptstrings.swg b/share/swig/3.0.12/javascript/jsc/javascriptstrings.swg new file mode 100644 index 0000000..55c8e4b --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascriptstrings.swg
@@ -0,0 +1,185 @@ +/* ------------------------------------------------------------ + * utility methods for char strings + * ------------------------------------------------------------ */ +%fragment("SWIG_AsCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") { +SWIGINTERN int +SWIG_JSC_AsCharPtrAndSize(JSContextRef context, JSValueRef valRef, char** cptr, size_t* psize, int *alloc) +{ + if(JSValueIsString(context, valRef)) { + JSStringRef js_str = JSValueToStringCopy(context, valRef, NULL); + size_t len = JSStringGetMaximumUTF8CStringSize(js_str); + char* cstr = (char*) %new_array(len, char); + /* JSStringGetUTF8CString returns the length including 0-terminator */ + len = JSStringGetUTF8CString(js_str, cstr, len); + + if(alloc) *alloc = SWIG_NEWOBJ; + if(psize) *psize = len; + if(cptr) *cptr = cstr; + + return SWIG_OK; + } else { + if(JSValueIsObject(context, valRef)) { + JSObjectRef obj = JSValueToObject(context, valRef, NULL); + // try if the object is a wrapped char[] + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + return SWIG_TypeError; + } else { + return SWIG_TypeError; + } + } +} +} + +%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") { +SWIGINTERNINLINE JSValueRef +SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + // TODO: handle extra long strings + //swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + //return pchar_descriptor ? + // SWIG_InternalNewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void(); + return JSValueMakeUndefined(context); + } else { + JSStringRef jsstring; + JSValueRef result; + if(size < 2) { + char c[2]; + int i; + for(i=0;i<size;++i) { + c[i] = carray[i]; + } + c[size] = 0; + jsstring = JSStringCreateWithUTF8CString(c); + } else { + jsstring = JSStringCreateWithUTF8CString(carray); + } + result = JSValueMakeString(context, jsstring); + JSStringRelease(jsstring); + return result; + } + } else { + return JSValueMakeUndefined(context); + } +} +} + +%define %_typemap2_string(StringCode, CharCode, + Char, CharName, + SWIG_AsCharPtrAndSize, + SWIG_FromCharPtrAndSize, + SWIG_CharPtrLen, + SWIG_CharBufLen, + SWIG_NewCopyCharArray, + SWIG_DeleteCharArray, + FragLimits, CHAR_MIN, CHAR_MAX) + +%fragment("SWIG_From"#CharName"Ptr","header",fragment=#SWIG_FromCharPtrAndSize) { +SWIGINTERNINLINE SWIG_Object +SWIG_JSC_From##CharName##Ptr(JSContextRef context, const Char *cptr) +{ + return SWIG_JSC_FromCharPtrAndSize(context, cptr, (cptr ? SWIG_CharPtrLen(cptr) : 0)); +} +} + +%fragment("SWIG_From"#CharName"Array","header",fragment=#SWIG_FromCharPtrAndSize) { +SWIGINTERNINLINE SWIG_Object +SWIG_JSC_From##CharName##Array(JSContextRef context, const Char *cptr, size_t size) +{ + return SWIG_JSC_FromCharPtrAndSize(context, cptr, size); +} +} + +%fragment("SWIG_As" #CharName "Ptr","header",fragment=#SWIG_AsCharPtrAndSize) { +%define_as(SWIG_As##CharName##Ptr(obj, val, alloc), SWIG_JSC_AsCharPtrAndSize(context, obj, val, NULL, alloc)) +} + +%fragment("SWIG_As" #CharName "Array","header",fragment=#SWIG_AsCharPtrAndSize) { +SWIGINTERN int +SWIG_JSC_As##CharName##Array(JSContextRef context, SWIG_Object obj, Char *val, size_t size) +{ + Char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; + int res = SWIG_JSC_AsCharPtrAndSize(context, obj, &cptr, &csize, &alloc); + if (SWIG_IsOK(res)) { + if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize; + if (csize <= size) { + if (val) { + if (csize) memcpy(val, cptr, csize*sizeof(Char)); + if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char)); + } + if (alloc == SWIG_NEWOBJ) { + SWIG_DeleteCharArray(cptr); + res = SWIG_DelNewMask(res); + } + return res; + } + if (alloc == SWIG_NEWOBJ) SWIG_DeleteCharArray(cptr); + } + return SWIG_TypeError; +} + +#define SWIG_As##CharName##Array(obj, val, size) SWIG_JSC_As##CharName##Array(context, obj, val, size) +} + +/* Char */ + +%fragment(SWIG_From_frag(Char),"header",fragment=#SWIG_FromCharPtrAndSize) { +SWIGINTERNINLINE SWIG_Object +SWIG_From_dec(Char)(Char c) +{ + return SWIG_JSC_FromCharPtrAndSize(context, &c,1); +} +} + +%fragment(SWIG_AsVal_frag(Char),"header", + fragment="SWIG_As"#CharName"Array", + fragment=FragLimits, + fragment=SWIG_AsVal_frag(long)) { +SWIGINTERN int +SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val) +{ + int res = SWIG_As##CharName##Array(obj, val, 1); + if (!SWIG_IsOK(res)) { + long v; + res = SWIG_AddCast(SWIG_AsVal(long)(obj, &v)); + if (SWIG_IsOK(res)) { + if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) { + if (val) *val = %numeric_cast(v, Char); + } else { + res = SWIG_OverflowError; + } + } + } + return res; +} +} + +%_typemap_string(StringCode, + Char, + SWIG_AsCharPtrAndSize, + SWIG_FromCharPtrAndSize, + SWIG_CharPtrLen, + SWIG_CharBufLen, + SWIG_As##CharName##Ptr, + SWIG_From##CharName##Ptr, + SWIG_As##CharName##Array, + SWIG_NewCopyCharArray, + SWIG_DeleteCharArray) + +%enddef + +%insert(runtime) %{ +#define SWIG_AsCharPtrAndSize(val, cptr, psize, alloc) SWIG_JSC_AsCharPtrAndSize(context, val, cptr, psize, alloc) +#define SWIG_FromCharPtrAndSize(cptr, size) SWIG_JSC_FromCharPtrAndSize(context, cptr, size) +#define SWIG_FromCharPtr(cptr) SWIG_JSC_FromCharPtr(context, cptr) +%}
diff --git a/share/swig/3.0.12/javascript/jsc/javascripttypemaps.swg b/share/swig/3.0.12/javascript/jsc/javascripttypemaps.swg new file mode 100644 index 0000000..e8fbbec --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/javascripttypemaps.swg
@@ -0,0 +1,54 @@ +/* ------------------------------------------------------------ + * Typemap specializations for Javascript + * ------------------------------------------------------------ */ + +/* ------------------------------------------------------------ + * Fragment section + * ------------------------------------------------------------ */ + +/* These macros are necessary to provide an extra parameter + to SWIG_AsVal_dec functions (JSContextRef context). + They must be defined before including `typemaps/fragments.swg` +*/ +#define SWIG_FROM_DECL_ARGS SWIG_JSC_FROM_DECL_ARGS +#define SWIG_FROM_CALL_ARGS SWIG_JSC_FROM_CALL_ARGS +#define SWIG_AS_DECL_ARGS SWIG_JSC_AS_DECL_ARGS +#define SWIG_AS_CALL_ARGS SWIG_JSC_AS_CALL_ARGS + +/* Include fundamental fragemt definitions */ +%include <typemaps/fragments.swg> + +/* Look for user fragments file. */ +%include <javascriptfragments.swg> + +/* Javascript fragments for fundamental types */ +%include <javascriptprimtypes.swg> + +/* Javascript fragments for char* strings */ +%include <javascriptstrings.swg> + +/* ------------------------------------------------------------ + * Unified typemap section + * ------------------------------------------------------------ */ + +#define SWIG_Object JSValueRef +#define VOID_Object JSValueMakeUndefined(context) + +/* append output */ +#define SWIG_AppendOutput(result, obj) SWIGJSC_AppendOutput(context, result, obj) + +/* set constant */ +#define SWIG_SetConstant(name, obj) + +/* raise */ +#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type) + +%insert("runtime") %{ +#define SWIG_JSC_FROM_DECL_ARGS(arg1) (JSContextRef context, arg1) +#define SWIG_JSC_FROM_CALL_ARGS(arg1) (context, arg1) +#define SWIG_JSC_AS_DECL_ARGS(arg1, arg2) (JSContextRef context, arg1, arg2) +#define SWIG_JSC_AS_CALL_ARGS(arg1, arg2) (context, arg1, arg2) +%} + +/* Include the unified typemap library */ +%include <typemaps/swigtypemaps.swg>
diff --git a/share/swig/2.0.11/csharp/std_common.i b/share/swig/3.0.12/javascript/jsc/std_common.i similarity index 100% copy from share/swig/2.0.11/csharp/std_common.i copy to share/swig/3.0.12/javascript/jsc/std_common.i
diff --git a/share/swig/3.0.12/javascript/jsc/std_complex.i b/share/swig/3.0.12/javascript/jsc/std_complex.i new file mode 100644 index 0000000..088a4fe --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/std_complex.i
@@ -0,0 +1,19 @@ +/* + * STD C++ complex typemaps + */ + +%include <javascriptcomplex.swg> + +%{ +#include <complex> +%} + +/* defining the complex as/from converters */ + +%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag) +%swig_cplxflt_convn(std::complex<float>, std::complex<float>, std::real, std::imag) + +/* defining the typemaps */ + +%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>); +%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
diff --git a/share/swig/2.0.11/csharp/std_deque.i b/share/swig/3.0.12/javascript/jsc/std_deque.i similarity index 100% copy from share/swig/2.0.11/csharp/std_deque.i copy to share/swig/3.0.12/javascript/jsc/std_deque.i
diff --git a/share/swig/2.0.11/octave/std_except.i b/share/swig/3.0.12/javascript/jsc/std_except.i similarity index 100% copy from share/swig/2.0.11/octave/std_except.i copy to share/swig/3.0.12/javascript/jsc/std_except.i
diff --git a/share/swig/2.0.11/java/std_map.i b/share/swig/3.0.12/javascript/jsc/std_map.i similarity index 100% copy from share/swig/2.0.11/java/std_map.i copy to share/swig/3.0.12/javascript/jsc/std_map.i
diff --git a/share/swig/2.0.11/go/std_pair.i b/share/swig/3.0.12/javascript/jsc/std_pair.i similarity index 100% copy from share/swig/2.0.11/go/std_pair.i copy to share/swig/3.0.12/javascript/jsc/std_pair.i
diff --git a/share/swig/2.0.11/octave/std_string.i b/share/swig/3.0.12/javascript/jsc/std_string.i similarity index 100% copy from share/swig/2.0.11/octave/std_string.i copy to share/swig/3.0.12/javascript/jsc/std_string.i
diff --git a/share/swig/2.0.11/java/std_vector.i b/share/swig/3.0.12/javascript/jsc/std_vector.i similarity index 97% copy from share/swig/2.0.11/java/std_vector.i copy to share/swig/3.0.12/javascript/jsc/std_vector.i index 3f29b19..971b426 100644 --- a/share/swig/2.0.11/java/std_vector.i +++ b/share/swig/3.0.12/javascript/jsc/std_vector.i
@@ -61,7 +61,7 @@ %rename(add) push_back; void push_back(const value_type& x); %extend { - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/java/stl.i b/share/swig/3.0.12/javascript/jsc/stl.i similarity index 100% copy from share/swig/2.0.11/java/stl.i copy to share/swig/3.0.12/javascript/jsc/stl.i
diff --git a/share/swig/3.0.12/javascript/jsc/typemaps.i b/share/swig/3.0.12/javascript/jsc/typemaps.i new file mode 100644 index 0000000..d3d8afb --- /dev/null +++ b/share/swig/3.0.12/javascript/jsc/typemaps.i
@@ -0,0 +1,148 @@ +/* ----------------------------------------------------------------------------- + * typemaps.i + * + * Pointer handling + * These mappings provide support for input/output arguments and common + * uses for C/C++ pointers. + * ----------------------------------------------------------------------------- */ + +// INPUT typemaps. +// These remap a C pointer to be an "INPUT" value which is passed by value +// instead of reference. + +/* +The following methods can be applied to turn a pointer into a simple +"input" value. That is, instead of passing a pointer to an object, +you would use a real value instead. + + int *INPUT + short *INPUT + long *INPUT + long long *INPUT + unsigned int *INPUT + unsigned short *INPUT + unsigned long *INPUT + unsigned long long *INPUT + unsigned char *INPUT + bool *INPUT + float *INPUT + double *INPUT + +To use these, suppose you had a C function like this : + + double fadd(double *a, double *b) { + return *a+*b; + } + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + double fadd(double *INPUT, double *INPUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *INPUT { double *a, double *b }; + double fadd(double *a, double *b); + +*/ + +// OUTPUT typemaps. These typemaps are used for parameters that +// are output only. The output value is appended to the result as +// a list element. + +/* +The following methods can be applied to turn a pointer into an "output" +value. When calling a function, no input value would be given for +a parameter, but an output value would be returned. In the case of +multiple output values, they are returned in the form of a Python tuple. + + int *OUTPUT + short *OUTPUT + long *OUTPUT + long long *OUTPUT + unsigned int *OUTPUT + unsigned short *OUTPUT + unsigned long *OUTPUT + unsigned long long *OUTPUT + unsigned char *OUTPUT + bool *OUTPUT + float *OUTPUT + double *OUTPUT + +For example, suppose you were trying to wrap the modf() function in the +C math library which splits x into integral and fractional parts (and +returns the integer part in one of its parameters).K: + + double modf(double x, double *ip); + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + double modf(double x, double *OUTPUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *OUTPUT { double *ip }; + double modf(double x, double *ip); + +The Python output of the function would be a tuple containing both +output values. + +*/ + +// INOUT +// Mappings for an argument that is both an input and output +// parameter + +/* +The following methods can be applied to make a function parameter both +an input and output value. This combines the behavior of both the +"INPUT" and "OUTPUT" methods described earlier. Output values are +returned in the form of a Python tuple. + + int *INOUT + short *INOUT + long *INOUT + long long *INOUT + unsigned int *INOUT + unsigned short *INOUT + unsigned long *INOUT + unsigned long long *INOUT + unsigned char *INOUT + bool *INOUT + float *INOUT + double *INOUT + +For example, suppose you were trying to wrap the following function : + + void neg(double *x) { + *x = -(*x); + } + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + void neg(double *INOUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *INOUT { double *x }; + void neg(double *x); + +Unlike C, this mapping does not directly modify the input value (since +this makes no sense in Python). Rather, the modified input value shows +up as the return value of the function. Thus, to apply this function +to a Python variable you might do this : + + x = neg(x) + +Note : previous versions of SWIG used the symbol 'BOTH' to mark +input/output arguments. This is still supported, but will be slowly +phased out in future releases. + +*/ + +%include <typemaps/typemaps.swg>
diff --git a/share/swig/3.0.12/javascript/v8/arrays_javascript.i b/share/swig/3.0.12/javascript/v8/arrays_javascript.i new file mode 100644 index 0000000..22b50be --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/arrays_javascript.i
@@ -0,0 +1,125 @@ +/* ----------------------------------------------------------------------------- + * arrays_javascript.i + * + * These typemaps give more natural support for arrays. The typemaps are not efficient + * as there is a lot of copying of the array values whenever the array is passed to C/C++ + * from JavaScript and vice versa. The JavaScript array is expected to be the same size as the C array. + * An exception is thrown if they are not. + * + * Example usage: + * Wrapping: + * + * %include <arrays_javascript.i> + * %inline %{ + * extern int FiddleSticks[3]; + * %} + * + * Use from JavaScript like this: + * + * var fs = [10, 11, 12]; + * example.FiddleSticks = fs; + * fs = example.FiddleSticks; + * ----------------------------------------------------------------------------- */ + +%fragment("SWIG_JSCGetIntProperty", "header", fragment=SWIG_AsVal_frag(int)) {} +%fragment("SWIG_JSCGetNumberProperty", "header", fragment=SWIG_AsVal_frag(double)) {} + +%typemap(in, fragment="SWIG_JSCGetIntProperty") int[], int[ANY] + (int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) { + if ($input->IsArray()) + { + // Convert into Array + array = v8::Local<v8::Array>::Cast($input); + + length = $1_dim0; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (i = 0; i < length; i++) + { + jsvalue = array->Get(i); + + // Get primitive value from JSObject + res = SWIG_AsVal(int)(jsvalue, &temp); + if (!SWIG_IsOK(res)) + { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + + } + else + { + SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); + } +} + +%typemap(freearg) int[], int[ANY] { + free($1); +} + +%typemap(out, fragment=SWIG_From_frag(int)) int[], int[ANY] (int length = 0, int i = 0) +{ + length = $1_dim0; + v8::Local<v8::Array> array = v8::Array::New(length); + + for (i = 0; i < length; i++) + { + array->Set(i, SWIG_From(int)($1[i])); + } + + + $result = array; +} + +%typemap(in, fragment="SWIG_JSCGetNumberProperty") double[], double[ANY] + (int length = 0, v8::Local<v8::Array> array, v8::Local<v8::Value> jsvalue, int i = 0, int res = 0, $*1_ltype temp) { + if ($input->IsArray()) + { + // Convert into Array + array = v8::Local<v8::Array>::Cast($input); + + length = $1_dim0; + + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + + // Get each element from array + for (i = 0; i < length; i++) + { + jsvalue = array->Get(i); + + // Get primitive value from JSObject + res = SWIG_AsVal(double)(jsvalue, &temp); + if (!SWIG_IsOK(res)) + { + SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); + } + arg$argnum[i] = temp; + } + + } + else + { + SWIG_exception_fail(SWIG_ERROR, "$input is not JSObjectRef"); + } +} + +%typemap(freearg) double[], double[ANY] { + free($1); +} + +%typemap(out, fragment=SWIG_From_frag(double)) double[], double[ANY] (int length = 0, int i = 0) +{ + length = $1_dim0; + v8::Local<v8::Array> array = v8::Array::New(length); + + for (i = 0; i < length; i++) + { + array->Set(i, SWIG_From(double)($1[i])); + } + + + $result = array; +}
diff --git a/share/swig/3.0.12/javascript/v8/ccomplex.i b/share/swig/3.0.12/javascript/v8/ccomplex.i new file mode 100644 index 0000000..8eda920 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/ccomplex.i
@@ -0,0 +1,26 @@ +/* ----------------------------------------------------------------------------- + * ccomplex.i + * + * C complex typemaps + * ISO C99: 7.3 Complex arithmetic <complex.h> + * ----------------------------------------------------------------------------- */ + + +%include <javscriptcomplex.swg> + +%{ +#include <complex.h> +%} + + +/* C complex constructor */ +#define CCplxConst(r, i) ((r) + I*(i)) + +%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag); +%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag); + +/* declaring the typemaps */ +%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex); +%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
diff --git a/share/swig/2.0.11/octave/cdata.i b/share/swig/3.0.12/javascript/v8/cdata.i similarity index 100% copy from share/swig/2.0.11/octave/cdata.i copy to share/swig/3.0.12/javascript/v8/cdata.i
diff --git a/share/swig/2.0.11/python/complex.i b/share/swig/3.0.12/javascript/v8/complex.i similarity index 100% copy from share/swig/2.0.11/python/complex.i copy to share/swig/3.0.12/javascript/v8/complex.i
diff --git a/share/swig/3.0.12/javascript/v8/exception.i b/share/swig/3.0.12/javascript/v8/exception.i new file mode 100644 index 0000000..0246cfd --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/exception.i
@@ -0,0 +1 @@ +%include <typemaps/exception.swg>
diff --git a/share/swig/3.0.12/javascript/v8/javascript.swg b/share/swig/3.0.12/javascript/v8/javascript.swg new file mode 100644 index 0000000..3a83b64 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascript.swg
@@ -0,0 +1,19 @@ +/* ----------------------------------------------------------------------------- + * javascript.swg + * + * Javascript typemaps + * ----------------------------------------------------------------------------- */ + +%include <typemaps/swigmacros.swg> + +%include <javascripttypemaps.swg> + +%include <javascriptruntime.swg> + +%include <javascripthelpers.swg> + +%include <javascriptkw.swg> + +%include <javascriptcode.swg> + +%include <javascriptinit.swg>
diff --git a/share/swig/3.0.12/javascript/v8/javascriptcode.swg b/share/swig/3.0.12/javascript/v8/javascriptcode.swg new file mode 100644 index 0000000..fb7d55c --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptcode.swg
@@ -0,0 +1,494 @@ +/* ----------------------------------------------------------------------------- + * js_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ + +%fragment("js_ctor", "templates") %{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Object> self = args.Holder(); + $jslocals + if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + $jscode + + SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); + SWIGV8_RETURN(self); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_veto_ctor: a vetoing ctor for abstract classes + * - $jswrapper: name of wrapper + * - $jsname: class name + * ----------------------------------------------------------------------------- */ +%fragment ("js_veto_ctor", "templates") +%{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + SWIG_exception(SWIG_ERROR, "Class $jsname can not be instantiated"); +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatcher: dispatcher for overloaded constructors + * - $jswrapper: name of wrapper + * - $jsname: class name + * - $jsdispatchcases: part containing code for dispatching + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatcher", "templates") +%{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + OverloadErrorHandler errorHandler; + v8::Handle<v8::Value> self; + + // switch all cases by means of series of if-returns. + $jsdispatchcases + + // default: + SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for construction of $jsmangledname"); + +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_overloaded_ctor: template for wrapping a ctor. + * - $jswrapper: wrapper of called ctor + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * - $jsargcount: number of arguments + * - $jsmangledtype: mangled type of class + * ----------------------------------------------------------------------------- */ +%fragment("js_overloaded_ctor", "templates") %{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Object> self = args.Holder(); + $jslocals + if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + $jscode + + SWIGV8_SetPrivateData(self, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN); + SWIGV8_RETURN(self); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_ctor_dispatch_case: template for a dispatch case for calling an overloaded ctor. + * - $jsargcount: number of arguments of called ctor + * - $jswrapper: wrapper of called ctor + * + * Note: a try-catch-like mechanism is used to switch cases + * ----------------------------------------------------------------------------- */ +%fragment ("js_ctor_dispatch_case", "templates") +%{ + if(args.Length() == $jsargcount) { + errorHandler.err.Clear(); +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + self = $jswrapper(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + SWIGV8_ESCAPE(self); + } +#else + $jswrapper(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + return; + } +#endif + } +%} + +/* ----------------------------------------------------------------------------- + * js_dtor: template for a destructor wrapper + * - $jsmangledname: mangled class name + * - $jstype: class type + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtor", "templates") +%{ + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +static void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) +static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) +static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) { +#else +static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SWIGV8_Proxy *proxy = data.GetParameter(); +#endif + + if(proxy->swigCMemOwn && proxy->swigCObject) { +#ifdef SWIGRUNTIME_DEBUG + printf("Deleting wrapped instance: %s\n", proxy->info->name); +#endif + $jsfree proxy->swigCObject; + } + delete proxy; + + object.Clear(); + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + object.Dispose(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + object.Dispose(isolate); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + object->Dispose(isolate); +#else + object->Dispose(); +#endif +} +%} + +/* ----------------------------------------------------------------------------- + * js_dtoroverride: template for a destructor wrapper + * - $jsmangledname: mangled class name + * - $jstype: class type + * - ${destructor_action}: The custom destructor action to invoke. + * ----------------------------------------------------------------------------- */ +%fragment ("js_dtoroverride", "templates") +%{ +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +static void $jswrapper(v8::Persistent<v8::Value> object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) +static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) +static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) { +#else +static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SWIGV8_Proxy *proxy = data.GetParameter(); +#endif + + if(proxy->swigCMemOwn && proxy->swigCObject) { + $jstype arg1 = ($jstype)proxy->swigCObject; + ${destructor_action} + } + delete proxy; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + object.Dispose(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + object.Dispose(isolate); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + object->Dispose(isolate); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + object->Dispose(); +#else + object.Clear(); +#endif +} +%} + +/* ----------------------------------------------------------------------------- + * js_getter: template for getter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_getter", "templates") +%{ +static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + $jslocals + $jscode + SWIGV8_RETURN_INFO(jsresult, info); + + goto fail; +fail: + SWIGV8_RETURN_INFO(SWIGV8_UNDEFINED(), info); +} +%} + +/* ----------------------------------------------------------------------------- + * js_setter: template for setter function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_setter", "templates") +%{ +static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, + const SwigV8PropertyCallbackInfoVoid &info) { + SWIGV8_HANDLESCOPE(); + + $jslocals + $jscode + goto fail; +fail: + return; +} +%} + +/* ----------------------------------------------------------------------------- + * js_function: template for function wrappers + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_function", "templates") +%{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + $jslocals + if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper."); + + $jscode + SWIGV8_RETURN(jsresult); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_function_dispatcher: template for a function dispatcher for overloaded functions + * - $jswrapper: wrapper function name + * - $jsname: name of the wrapped function + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment("js_function_dispatcher", "templates") +%{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + OverloadErrorHandler errorHandler; + $jscode + + SWIG_exception_fail(SWIG_ERROR, "Illegal arguments for function $jsname."); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_overloaded_function: template for a overloaded function + * - $jswrapper: wrapper function name + * - $jslocals: locals part of wrapper + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_overloaded_function", "templates") +%{ +static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) +{ + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + $jslocals + $jscode + SWIGV8_RETURN(jsresult); + + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} + +/* ----------------------------------------------------------------------------- + * js_function_dispatch_case: template for a case used in the function dispatcher + * - $jswrapper: wrapper function name + * - $jsargcount: number of arguments of overloaded function + * - $jscode: code part of wrapper + * ----------------------------------------------------------------------------- */ +%fragment ("js_function_dispatch_case", "templates") +%{ + + if(args.Length() == $jsargcount) { + errorHandler.err.Clear(); +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + jsresult = $jswrapper(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + SWIGV8_ESCAPE(jsresult); + } +#else + $jswrapper(args, errorHandler); + if(errorHandler.err.IsEmpty()) { + return; + } +#endif + } +%} + +/* ----------------------------------------------------------------------------- + * jsv8_declare_class_template: template for a class template declaration. + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_declare_class_template", "templates") +%{ + SWIGV8_ClientData $jsmangledname_clientData; +%} + +/* ----------------------------------------------------------------------------- + * jsv8_define_class_template: template for a class template definition. + * - $jsmangledname: mangled class name + * - $jsmangledtype: mangled class type + * - $jsdtor: the dtor wrapper + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_define_class_template", "templates") +%{ + /* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */ + v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname"); + SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class); + $jsmangledname_clientData.dtor = $jsdtor; + if (SWIGTYPE_$jsmangledtype->clientdata == 0) { + SWIGTYPE_$jsmangledtype->clientdata = &$jsmangledname_clientData; + } +%} + + +/* ----------------------------------------------------------------------------- + * jsv8_inherit: template for an class inherit statement. + * - $jsmangledname: mangled class name + * - $jsbaseclass: mangled name of the base class + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_inherit", "templates") +%{ + if (SWIGTYPE_p$jsbaseclass->clientdata && !(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ.IsEmpty())) + { +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + $jsmangledname_class->Inherit(static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ); +#else + $jsmangledname_class->Inherit( + v8::Local<v8::FunctionTemplate>::New( + v8::Isolate::GetCurrent(), + static_cast<SWIGV8_ClientData *>(SWIGTYPE_p$jsbaseclass->clientdata)->class_templ) + ); +#endif + +#ifdef SWIGRUNTIME_DEBUG + printf("Inheritance successful $jsmangledname $jsbaseclass\n"); +#endif + } else { +#ifdef SWIGRUNTIME_DEBUG + printf("Unable to inherit baseclass, it didn't exist $jsmangledname $jsbaseclass\n"); +#endif + } +%} + +/* ----------------------------------------------------------------------------- + * jsv8_create_class_instance: template for creating an class object. + * - $jsname: class name + * - $jsmangledname: mangled class name + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_create_class_instance", "templates") +%{ + /* Class: $jsname ($jsmangledname) */ + v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname"); + $jsmangledname_class_0->SetCallHandler($jsctor); + $jsmangledname_class_0->Inherit($jsmangledname_class); + $jsmangledname_class_0->SetHiddenPrototype(true); + v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_class: template for a statement that registers a class in a parent namespace. + * - $jsname: class name + * - $jsmangledname: mangled class name + * - $jsparent: mangled name of parent namespace + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_class", "templates") +%{ + $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_create_namespace: template for a statement that creates a namespace object. + * - $jsmangledname: mangled namespace name + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_create_namespace", "templates") +%{ + v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW(); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_namespace: template for a statement that registers a namespace in a parent namespace. + * - $jsname: name of namespace + * - $jsmangledname: mangled name of namespace + * - $jsparent: mangled name of parent namespace + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_namespace", "templates") +%{ + $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_member_function: template for a statement that registers a member function. + * - $jsmangledname: mangled class name + * - $jsname: name of the function + * - $jswrapper: wrapper of the member function + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_member_function", "templates") +%{ + SWIGV8_AddMemberFunction($jsmangledname_class, "$jsname", $jswrapper); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_member_variable: template for a statement that registers a member variable. + * - $jsmangledname: mangled class name + * - $jsname: name of the function + * - $jsgetter: wrapper of the getter function + * - $jssetter: wrapper of the setter function + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_member_variable", "templates") +%{ + SWIGV8_AddMemberVariable($jsmangledname_class, "$jsname", $jsgetter, $jssetter); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_static_function: template for a statement that registers a static class function. + * - $jsname: function name + * - $jswrapper: wrapper of the function + * - $jsparent: mangled name of parent namespace + * + * Note: this template is also used for global functions. + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_static_function", "templates") +%{ + SWIGV8_AddStaticFunction($jsparent_obj, "$jsname", $jswrapper); +%} + +/* ----------------------------------------------------------------------------- + * jsv8_register_static_variable: template for a statement that registers a static variable. + * - $jsname: variable name + * - $jsparent: mangled name of parent namespace + * - $jsgetter: wrapper of the getter function + * - $jssetter: wrapper of the setter function + * + * Note: this template is also used for global variables. + * ----------------------------------------------------------------------------- */ +%fragment("jsv8_register_static_variable", "templates") +%{ + SWIGV8_AddStaticVariable($jsparent_obj, "$jsname", $jsgetter, $jssetter); +%}
diff --git a/share/swig/3.0.12/javascript/v8/javascriptcomplex.swg b/share/swig/3.0.12/javascript/v8/javascriptcomplex.swg new file mode 100644 index 0000000..1c0107b --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptcomplex.swg
@@ -0,0 +1,124 @@ +/* + Defines the As/From converters for double/float complex, you need to + provide complex Type, the Name you want to use in the converters, + the complex Constructor method, and the Real and Imag complex + accessor methods. + + See the std_complex.i and ccomplex.i for concrete examples. +*/ + +/* the common from converter */ +%define %swig_fromcplx_conv(Type, Real, Imag) +%fragment(SWIG_From_frag(Type),"header", + fragment=SWIG_From_frag(double)) +{ +SWIGINTERNINLINE v8::Handle<v8::Value> +SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) +{ + SWIGV8_HANDLESCOPE_ESC(); + + v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(2); + + vals->Set(0, SWIG_From(double)(Real(c))); + vals->Set(1, SWIG_From(double)(Imag(c))); + SWIGV8_ESCAPE(vals); +} +} +%enddef + +/* the double case */ +%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(double)) +{ +SWIGINTERN int +SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val) +{ + SWIGV8_HANDLESCOPE(); + + if (o->IsArray()) { + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o); + + if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + double re, im; + int res; + + res = SWIG_AsVal(double)(array->Get(0), &re); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + res = SWIG_AsVal(double)(array->Get(1), &im); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + if (val) *val = Constructor(re, im); + return SWIG_OK; + } else if(o->IsNumber()){ + double d; + int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d)); + if (SWIG_IsOK(res)) { + if (val) *val = Constructor(d, 0.0); + return res; + } + } + return SWIG_TypeError; +} +} +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +/* the float case */ +%define %swig_cplxflt_conv(Type, Constructor, Real, Imag) +%fragment(SWIG_AsVal_frag(Type),"header", + fragment=SWIG_AsVal_frag(float)) { +SWIGINTERN int +SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val) +{ + SWIGV8_HANDLESCOPE(); + + if (o->IsArray()) { + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o); + + if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + double re, im; + int res; + + res = SWIG_AsVal(double)(array->Get(0), &re); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + res = SWIG_AsVal(double)(array->Get(1), &im); + if(!SWIG_IsOK(res)) { + return SWIG_TypeError; + } + + if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { + if (val) *val = Constructor(%numeric_cast(re, float), + %numeric_cast(im, float)); + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else if(o->IsNumber()){ + float re; + int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); + if (SWIG_IsOK(res)) { + if (val) *val = Constructor(re, 0.0); + return res; + } + } + return SWIG_TypeError; +} +} +%swig_fromcplx_conv(Type, Real, Imag); +%enddef + +#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \ +%swig_cplxflt_conv(Type, Constructor, Real, Imag) + + +#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \ +%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
diff --git a/share/swig/3.0.12/javascript/v8/javascriptfragments.swg b/share/swig/3.0.12/javascript/v8/javascriptfragments.swg new file mode 100644 index 0000000..4778bf0 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptfragments.swg
@@ -0,0 +1,23 @@ +/* + + Create a file with this name, 'javascriptfragments.swg', in your working + directory and add all the %fragments you want to take precedence + over the default ones defined by swig. + + For example, if you add: + + %fragment(SWIG_AsVal_frag(int),"header") { + SWIGINTERNINLINE int + SWIG_AsVal(int)(PyObject *obj, int *val) + { + <your code here>; + } + } + + this will replace the code used to retrieve an integer value for all + the typemaps that need it, including: + + int, std::vector<int>, std::list<std::pair<int,int> >, etc. + + +*/
diff --git a/share/swig/3.0.12/javascript/v8/javascripthelpers.swg b/share/swig/3.0.12/javascript/v8/javascripthelpers.swg new file mode 100644 index 0000000..091467d --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascripthelpers.swg
@@ -0,0 +1,89 @@ +%insert(runtime) %{ + +// Note: since 3.19 there are new CallBack types, since 03.21.9 the old ones have been removed +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) +typedef v8::InvocationCallback SwigV8FunctionCallback; +typedef v8::AccessorGetter SwigV8AccessorGetterCallback; +typedef v8::AccessorSetter SwigV8AccessorSetterCallback; +typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid; +#else +typedef v8::FunctionCallback SwigV8FunctionCallback; +typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback; +typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback; +typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid; +#endif + +/** + * Creates a class template for a class with specified initialization function. + */ +SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) { + SWIGV8_HANDLESCOPE_ESC(); + + v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID(); + class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol)); + + v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate(); + inst_templ->SetInternalFieldCount(1); + + v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate(); + equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals)); + + v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate(); + cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr)); + + SWIGV8_ESCAPE(class_templ); +} + +/** + * Registers a class method with given name for a given class template. + */ +SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, + SwigV8FunctionCallback _func) { + v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate(); + proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)); +} + +/** + * Registers a class property with given name for a given class template. + */ +SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, + SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { + v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate(); + proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); +} + +/** + * Registers a class method with given name for a given object. + */ +SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol, + const SwigV8FunctionCallback& _func) { + obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction()); +} + +/** + * Registers a class method with given name for a given object. + */ +SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol, + SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) { + obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); +} + +SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, + const SwigV8PropertyCallbackInfoVoid& info) +{ + char buffer[256]; + char msg[512]; + int res; + + property->WriteUtf8(buffer, 256); + res = sprintf(msg, "Tried to write read-only variable: %s.", buffer); + + if(res<0) { + SWIG_exception(SWIG_ERROR, "Tried to write read-only variable."); + } else { + SWIG_exception(SWIG_ERROR, msg); + } +fail: ; +} + +%} // v8_helper_functions
diff --git a/share/swig/3.0.12/javascript/v8/javascriptinit.swg b/share/swig/3.0.12/javascript/v8/javascriptinit.swg new file mode 100644 index 0000000..34befa7 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptinit.swg
@@ -0,0 +1,115 @@ +%insert(init) %{ + +#include <assert.h> + +SWIGRUNTIME void +SWIG_V8_SetModule(void *, swig_module_info *swig_module) { + v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); + v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module); + assert(!mod.IsEmpty()); + global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod); +} + +SWIGRUNTIME swig_module_info * +SWIG_V8_GetModule(void *) { + v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global(); + v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data")); + + if (moduleinfo.IsEmpty()) + { + // It's not yet loaded + return 0; + } + + v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo); + + if (moduleinfo_extern.IsEmpty()) + { + // Something's not right + return 0; + } + + void *ptr = moduleinfo_extern->Value(); + assert(ptr); + swig_module_info *retptr = static_cast<swig_module_info *>(ptr); + assert(retptr); + return retptr; +} + +#define SWIG_GetModule(clientdata) SWIG_V8_GetModule(clientdata) +#define SWIG_SetModule(clientdata, pointer) SWIG_V8_SetModule(clientdata, pointer) + +%} + +%insert(init) "swiginit.swg" + +// Open the initializer function definition here + +%fragment ("js_initializer_define", "templates") %{ +#define SWIGV8_INIT $jsname_initialize +%} + +%insert(init) %{ +// Note: 'extern "C"'' disables name mangling which makes it easier to load the symbol manually +// TODO: is it ok to do that? +extern "C" +#if (NODE_MODULE_VERSION < 0x000C) +void SWIGV8_INIT (v8::Handle<v8::Object> exports) +#else +void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/) +#endif +{ + SWIG_InitializeModule(static_cast<void *>(&exports)); + + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Object> exports_obj = exports; +%} + + +/* ----------------------------------------------------------------------------- + * js_initializer: template for the module initializer function + * - $jsname: module name + * - $jsv8nspaces: part with code creating namespace objects + * - $jsv8classtemplates: part with code creating class templates + * - $jsv8wrappers: part with code that registers wrapper functions + * - $jsv8inheritance: part with inherit statements + * - $jsv8classinstances: part with code creating class objects + * - $jsv8staticwrappers: part with code adding static functions to class objects + * - $jsv8registerclasses: part with code that registers class objects in namespaces + * - $jsv8registernspaces: part with code that registers namespaces in parent namespaces + * ----------------------------------------------------------------------------- */ +%fragment("js_initializer", "templates") +%{ + // a class template for creating proxies of undefined types + SWIGV8_SET_CLASS_TEMPL(SWIGV8_SWIGTYPE_Proxy_class_templ, SWIGV8_CreateClassTemplate("SwigProxy")); + + /* create objects for namespaces */ + $jsv8nspaces + + /* create class templates */ + $jsv8classtemplates + + /* register wrapper functions */ + $jsv8wrappers + + /* setup inheritances */ + $jsv8inheritance + + /* class instances */ + $jsv8classinstances + + /* add static class functions and variables */ + $jsv8staticwrappers + + /* register classes */ + $jsv8registerclasses + + /* create and register namespace objects */ + $jsv8registernspaces +} + +#if defined(BUILDING_NODE_EXTENSION) +NODE_MODULE($jsname, $jsname_initialize) +#endif +%}
diff --git a/share/swig/3.0.12/javascript/v8/javascriptkw.swg b/share/swig/3.0.12/javascript/v8/javascriptkw.swg new file mode 100644 index 0000000..c3c1183 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptkw.swg
@@ -0,0 +1,40 @@ +#ifndef JAVASCRIPT_JAVASCRIPTKW_SWG_ +#define JAVASCRIPT_JAVASCRIPTKW_SWG_ + +/* Warnings for Java keywords */ +#define JAVASCRIPTKW(x) %keywordwarn("'" `x` "' is a javascript keyword, renaming to '_"`x`"'",rename="_%s") `x` + +/* Taken from https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words */ + +JAVASCRIPTKW(break); +JAVASCRIPTKW(case); +JAVASCRIPTKW(catch); +JAVASCRIPTKW(continue); +JAVASCRIPTKW(default); +JAVASCRIPTKW(delete); +JAVASCRIPTKW(do); +JAVASCRIPTKW(else); +JAVASCRIPTKW(finally); +JAVASCRIPTKW(for); +JAVASCRIPTKW(function); +JAVASCRIPTKW(if); +JAVASCRIPTKW(in); +JAVASCRIPTKW(instanceof); +JAVASCRIPTKW(new); +JAVASCRIPTKW(return); +JAVASCRIPTKW(switch); +JAVASCRIPTKW(this); +JAVASCRIPTKW(throw); +JAVASCRIPTKW(try); +JAVASCRIPTKW(typeof); +JAVASCRIPTKW(var); +JAVASCRIPTKW(void); +JAVASCRIPTKW(while); +JAVASCRIPTKW(with); + +/* others bad names if any*/ +// for example %namewarn("321:clone() is a javascript bad method name") *::clone(); + +#undef JAVASCRIPTKW + +#endif //JAVASCRIPT_JAVASCRIPTKW_SWG_
diff --git a/share/swig/3.0.12/javascript/v8/javascriptprimtypes.swg b/share/swig/3.0.12/javascript/v8/javascriptprimtypes.swg new file mode 100644 index 0000000..c0055c4 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptprimtypes.swg
@@ -0,0 +1,206 @@ +/* ------------------------------------------------------------ + * Primitive Types + * ------------------------------------------------------------ */ + +/* boolean */ + +%fragment(SWIG_From_frag(bool),"header") { +SWIGINTERNINLINE +v8::Handle<v8::Value> +SWIG_From_dec(bool)(bool value) +{ + return SWIGV8_BOOLEAN_NEW(value); +} +} + +%fragment(SWIG_AsVal_frag(bool),"header", + fragment=SWIG_AsVal_frag(long)) { +SWIGINTERN +int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val) +{ + if(!obj->IsBoolean()) { + return SWIG_ERROR; + } + + if (val) *val = obj->BooleanValue(); + return SWIG_OK; +} +} + +/* int */ + +%fragment(SWIG_From_frag(int),"header") { +SWIGINTERNINLINE +v8::Handle<v8::Value> SWIG_From_dec(int)(int value) +{ + return SWIGV8_INT32_NEW(value); +} +} + +%fragment(SWIG_AsVal_frag(int),"header") { +SWIGINTERN +int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val) +{ + if (!valRef->IsNumber()) { + return SWIG_TypeError; + } + if(val) *val = valRef->IntegerValue(); + + return SWIG_OK; +} +} + +/* long */ + +%fragment(SWIG_From_frag(long),"header") { +SWIGINTERNINLINE +v8::Handle<v8::Value> SWIG_From_dec(long)(long value) +{ + return SWIGV8_NUMBER_NEW(value); +} +} + +%fragment(SWIG_AsVal_frag(long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN +int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val) +{ + if (!obj->IsNumber()) { + return SWIG_TypeError; + } + if(val) *val = (long) obj->IntegerValue(); + + return SWIG_OK; +} +} + +/* unsigned long */ + +%fragment(SWIG_From_frag(unsigned long),"header", + fragment=SWIG_From_frag(long)) { +SWIGINTERNINLINE +v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value) +{ + return (value > LONG_MAX) ? + SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long)); +} +} + +%fragment(SWIG_AsVal_frag(unsigned long),"header", + fragment="SWIG_CanCastAsInteger") { +SWIGINTERN +int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val) +{ + if(!obj->IsNumber()) { + return SWIG_TypeError; + } + + long longVal = (long) obj->NumberValue(); + + if(longVal < 0) { + return SWIG_OverflowError; + } + + if(val) *val = longVal; + + return SWIG_OK; +} +} + +/* long long */ +// Note: these are copied from 'long' and probably need fixing + +%fragment(SWIG_From_frag(long long),"header", + fragment=SWIG_From_frag(long), + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE +v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value) +{ + return SWIGV8_NUMBER_NEW(value); +} +%#endif +} + +%fragment(SWIG_AsVal_frag(long long),"header", + fragment=SWIG_AsVal_frag(long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val) +{ + if (!obj->IsNumber()) { + return SWIG_TypeError; + } + if(val) *val = (long long) obj->IntegerValue(); + + return SWIG_OK; +} +%#endif +} + +/* unsigned long long */ +// Note: these are copied from 'unsigned long' and probably need fixing + +%fragment(SWIG_From_frag(unsigned long long),"header", + fragment=SWIG_From_frag(long long), + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERNINLINE +v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value) +{ + return (value > LONG_MAX) ? + SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long)); +} +%#endif +} + +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment=SWIG_AsVal_frag(unsigned long), + fragment="SWIG_CanCastAsInteger", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE +SWIGINTERN +int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val) +{ + if(!obj->IsNumber()) { + return SWIG_TypeError; + } + + long long longVal = (long long) obj->NumberValue(); + + if(longVal < 0) { + return SWIG_OverflowError; + } + + if(val) *val = longVal; + + return SWIG_OK; +} +%#endif +} + +/* double */ + +%fragment(SWIG_From_frag(double),"header") { +SWIGINTERN +v8::Handle<v8::Value> SWIG_From_dec(double) (double val) +{ + return SWIGV8_NUMBER_NEW(val); +} +} + +%fragment(SWIG_AsVal_frag(double),"header") { +SWIGINTERN +int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val) +{ + if(!obj->IsNumber()) { + return SWIG_TypeError; + } + if(val) *val = obj->NumberValue(); + + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/javascript/v8/javascriptrun.swg b/share/swig/3.0.12/javascript/v8/javascriptrun.swg new file mode 100644 index 0000000..5ac52a5 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptrun.swg
@@ -0,0 +1,621 @@ +/* --------------------------------------------------------------------------- + * These typedefs and defines are used to deal with v8 API changes + * + * ---------------------------------------------------------------------------*/ + +// First v8 version that uses "SetWeak" and not "MakeWeak" + +#define SWIGV8_SETWEAK_VERSION 0x032224 + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803) +#define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len) +#else +#define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len) +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) +typedef v8::Handle<v8::Value> SwigV8ReturnValue; +typedef v8::Arguments SwigV8Arguments; +typedef v8::AccessorInfo SwigV8PropertyCallbackInfo; +#define SWIGV8_RETURN(val) return scope.Close(val) +#define SWIGV8_RETURN_INFO(val, info) return scope.Close(val) +#else +typedef void SwigV8ReturnValue; +typedef v8::FunctionCallbackInfo<v8::Value> SwigV8Arguments; +typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo; +#define SWIGV8_RETURN(val) args.GetReturnValue().Set(val); return +#define SWIGV8_RETURN_INFO(val, info) info.GetReturnValue().Set(val); return +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032117) +#define SWIGV8_HANDLESCOPE() v8::HandleScope scope +#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope +#define SWIGV8_ESCAPE(val) return scope.Close(val) +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224) +#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_HANDLESCOPE_ESC() v8::HandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_ESCAPE(val) return scope.Close(val) +#else +#define SWIGV8_HANDLESCOPE() v8::HandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_HANDLESCOPE_ESC() v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()); +#define SWIGV8_ESCAPE(val) return scope.Escape(val) +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032224) +#define SWIGV8_ADJUST_MEMORY(size) v8::V8::AdjustAmountOfExternalAllocatedMemory(size) +#define SWIGV8_CURRENT_CONTEXT() v8::Context::GetCurrent() +#define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err) +#define SWIGV8_STRING_NEW(str) v8::String::New(str) +#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym) +#else +#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size) +#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext() +#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err) +#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str) +#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym) +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318) +#define SWIGV8_ARRAY_NEW() v8::Array::New() +#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool) +#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val) +#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func) +#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New() +#define SWIGV8_INT32_NEW(num) v8::Int32::New(num) +#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(num) +#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(num) +#define SWIGV8_NUMBER_NEW(num) v8::Number::New(num) +#define SWIGV8_OBJECT_NEW() v8::Object::New() +#define SWIGV8_UNDEFINED() v8::Undefined() +#define SWIGV8_NULL() v8::Null() +#else +#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent()) +#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool) +#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val) +#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func) +#define SWIGV8_FUNCTEMPLATE_NEW_VOID() v8::FunctionTemplate::New(v8::Isolate::GetCurrent()) +#define SWIGV8_INT32_NEW(num) v8::Int32::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_INTEGER_NEW(num) v8::Integer::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_INTEGER_NEW_UNS(num) v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), num) +#define SWIGV8_NUMBER_NEW(num) v8::Number::New(v8::Isolate::GetCurrent(), num) +#define SWIGV8_OBJECT_NEW() v8::Object::New(v8::Isolate::GetCurrent()) +#define SWIGV8_UNDEFINED() v8::Undefined(v8::Isolate::GetCurrent()) +#define SWIGV8_NULL() v8::Null(v8::Isolate::GetCurrent()) +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(class); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) +#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ = v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), class); +#else +#define SWIGV8_SET_CLASS_TEMPL(class_templ, class) class_templ.Reset(v8::Isolate::GetCurrent(), class); +#endif + +/* --------------------------------------------------------------------------- + * Error handling + * + * ---------------------------------------------------------------------------*/ + +#define SWIG_Error(code, msg) SWIGV8_ErrorHandler.error(code, msg) +#define SWIG_exception(code, msg) do { SWIGV8_ErrorHandler.error(code, msg); SWIG_fail; } while (0) +#define SWIG_fail goto fail +#define SWIGV8_OVERLOAD false + +SWIGINTERN void SWIG_V8_Raise(const char *msg) { + SWIGV8_THROW_EXCEPTION(v8::Exception::Error(SWIGV8_STRING_NEW(msg))); +} + +/* + Note: There are two contexts for handling errors. + A static V8ErrorHandler is used in not overloaded methods. + For overloaded methods the throwing type checking mechanism is used + during dispatching. As V8 exceptions can not be resetted properly + the trick is to use a dynamic ErrorHandler with same local name as the global + one. + + - See defintion of SWIG_Error above. + - See code templates 'JS_function_dispatcher', 'JS_functionwrapper_overload', + and 'JS_function_dispatch_case' in javascriptcode.swg + +*/ +class V8ErrorHandler { +public: + virtual ~V8ErrorHandler() {} + virtual void error(int code, const char *msg) { + SWIG_V8_Raise(msg); + } +}; +// this is used in usually +SWIGRUNTIME V8ErrorHandler SWIGV8_ErrorHandler; + +// instances of this are used in overloaded functions +class OverloadErrorHandler: public V8ErrorHandler { +public: + virtual void error(int code, const char *msg) { + err = v8::Exception::Error(SWIGV8_STRING_NEW(msg)); + if(code != SWIG_TypeError) { + SWIGV8_THROW_EXCEPTION(err); + } + } + v8::Handle<v8::Value> err; +}; + +/* --------------------------------------------------------------------------- + * Basic Proxy object + * + * ---------------------------------------------------------------------------*/ + +// Note: to trigger the v8 gc more often one can tell v8 about the memory consumption +// TODO: we could add a v8 specific parameter to control this value +#define SWIGV8_AVG_OBJ_SIZE 1000 + +class SWIGV8_Proxy { +public: + SWIGV8_Proxy(): swigCMemOwn(false), swigCObject(0), info(0) { + SWIGV8_ADJUST_MEMORY(SWIGV8_AVG_OBJ_SIZE); + }; + + ~SWIGV8_Proxy() { +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + handle.ClearWeak(); + handle.Dispose(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + handle.ClearWeak(v8::Isolate::GetCurrent()); + handle.Dispose(v8::Isolate::GetCurrent()); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + handle.ClearWeak(); + handle.Dispose(); +#else + handle.ClearWeak(); + handle.Reset(); +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + handle.Clear(); +#endif + + SWIGV8_ADJUST_MEMORY(-SWIGV8_AVG_OBJ_SIZE); + } + + bool swigCMemOwn; + void *swigCObject; + swig_type_info *info; + v8::Persistent<v8::Object> handle; +}; + +class SWIGV8_ClientData { +public: + v8::Persistent<v8::FunctionTemplate> class_templ; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + void (*dtor) (v8::Persistent< v8::Value> object, void *parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy); +#else + void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data); +#endif +}; + +SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ; + +SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE(); + + if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0); + SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef)); +#else + SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0)); +#endif + + if(cdata == NULL) { + return SWIG_ERROR; + } + if(cdata->info != info) { + swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info); + if (!tc && cdata->info->name) { + tc = SWIG_TypeCheck(cdata->info->name, info); + } + bool type_valid = tc != 0; + if(!type_valid) { + return SWIG_TypeError; + } + } + *ptr = cdata->swigCObject; + if(flags & SWIG_POINTER_DISOWN) { + cdata->swigCMemOwn = false; + } + return SWIG_OK; +} + + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Value > object, void *parameter) { + SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) { +#else +SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) { + SWIGV8_Proxy *proxy = data.GetParameter(); +#endif + + delete proxy; +} + +SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) { + if(!valRef->IsObject()) { + return SWIG_TypeError; + } + v8::Handle<v8::Object> objRef = valRef->ToObject(); + + if(objRef->InternalFieldCount() < 1) return SWIG_ERROR; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0); + SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef)); +#else + SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0)); +#endif + + if(cdata == NULL) { + return SWIG_ERROR; + } + + *ptr = cdata->swigCObject; + + return SWIG_OK; +} + +SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) { + SWIGV8_Proxy *cdata = new SWIGV8_Proxy(); + cdata->swigCObject = ptr; + cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0; + cdata->info = info; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + obj->SetPointerInInternalField(0, cdata); +#else + obj->SetAlignedPointerInInternalField(0, cdata); +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + cdata->handle = v8::Persistent<v8::Object>::New(obj); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj); +#else + cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + // clientdata must be set for owned data as we need to register the dtor + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); + } else { + cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); + } +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918) + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); + } else { + cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, SWIGV8_Proxy_DefaultDtor); + } +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.MakeWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); + } else { + cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor); + } +#else + if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) { + cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor); + } else { + cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor); + } +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + cdata->handle.MarkIndependent(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + cdata->handle.MarkIndependent(v8::Isolate::GetCurrent()); +#else + cdata->handle.MarkIndependent(); +#endif + +} + +SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE(); + + /* special case: JavaScript null => C NULL pointer */ + if(valRef->IsNull()) { + *ptr=0; + return SWIG_OK; + } + if(!valRef->IsObject()) { + return SWIG_TypeError; + } + v8::Handle<v8::Object> objRef = valRef->ToObject(); + return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags); +} + +SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) { + SWIGV8_HANDLESCOPE_ESC(); + + v8::Handle<v8::FunctionTemplate> class_templ; + + if (ptr == NULL) { +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + SWIGV8_ESCAPE(SWIGV8_NULL()); +#else + v8::Local<v8::Primitive> result = SWIGV8_NULL(); + SWIGV8_ESCAPE(result); +#endif + } + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + if(info->clientdata != 0) { + class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ; + } else { + class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ; + } +#else + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + + if(info->clientdata != 0) { + class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, ((SWIGV8_ClientData*) info->clientdata)->class_templ); + } else { + class_templ = v8::Local<v8::FunctionTemplate>::New(isolate, SWIGV8_SWIGTYPE_Proxy_class_templ); + } +#endif + +// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(); + v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(); + SWIGV8_SetPrivateData(result, ptr, info, flags); + + SWIGV8_ESCAPE(result); +} + +#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags) +#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags) + +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags) + +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_V8_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_V8_NewPointerObj(ptr, type, 0) + +#define SWIG_GetInstancePtr(obj, ptr) SWIG_V8_GetInstancePtr(obj, ptr) + +SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + void *arg1 = (void *) 0 ; + void *arg2 = (void *) 0 ; + bool result; + int res1; + int res2; + + if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for equals."); + + res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ERROR, "Could not get pointer from 'this' object for equals."); + } + res2 = SWIG_GetInstancePtr(args[0], &arg2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "1"" of type '" "void *""'"); + } + + result = (bool)(arg1 == arg2); + jsresult = SWIGV8_BOOLEAN_NEW(result); + + SWIGV8_RETURN(jsresult); + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + +SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Value> jsresult; + void *arg1 = (void *) 0 ; + long result; + int res1; + + res1 = SWIG_GetInstancePtr(args.Holder(), &arg1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCPtr" "', argument " "1"" of type '" "void *""'"); + } + + result = (long)arg1; + jsresult = SWIGV8_NUMBER_NEW(result); + + SWIGV8_RETURN(jsresult); + goto fail; +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} + +/* --------------------------------------------------------------------------- + * PackedData object + * + * ---------------------------------------------------------------------------*/ + +class SwigV8PackedData { +public: + SwigV8PackedData(void *data, size_t size, swig_type_info *type): data(data), size(size), type(type) {}; + + ~SwigV8PackedData() { + }; + + void *data; + size_t size; + swig_type_info *type; + + v8::Persistent<v8::Object> handle; +}; + +SWIGRUNTIMEINLINE +int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) { + SWIGV8_HANDLESCOPE(); + + v8::Handle<v8::Object> objRef = valRef->ToObject(); + if(objRef->InternalFieldCount() < 1) return false; + v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__")); + return (flag->IsBoolean() && flag->BooleanValue()); +} + +SWIGRUNTIME +swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) { + if (SwigV8Packed_Check(valRef)) { + SWIGV8_HANDLESCOPE(); + + SwigV8PackedData *sobj; + + v8::Handle<v8::Object> objRef = valRef->ToObject(); + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0); + sobj = static_cast<SwigV8PackedData*>(v8::External::Unwrap(cdataRef)); +#else + sobj = static_cast<SwigV8PackedData*>(objRef->GetAlignedPointerFromInternalField(0)); +#endif + if (sobj == NULL || sobj->size != size) return 0; + memcpy(ptr, sobj->data, size); + return sobj->type; + } else { + return 0; + } +} + +SWIGRUNTIME +int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Persistent< v8::Value > object, void *parameter) { + SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Value> object, void *parameter) { + SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) { +#else +SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) { + v8::Local<v8::Object> object = data.GetValue(); + SwigV8PackedData *cdata = data.GetParameter(); +#endif + + delete cdata; + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + object.Clear(); + object.Dispose(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + object.Clear(); + object.Dispose(isolate); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + object->Dispose(isolate); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + object->Dispose(); +#else + object.Clear(); +#endif +} + +SWIGRUNTIME +v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) { + SWIGV8_HANDLESCOPE_ESC(); + + SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type); +// v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW(); + v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW(); + + obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true)); + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511) + obj->SetPointerInInternalField(0, cdata); +#else + obj->SetAlignedPointerInInternalField(0, cdata); +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + cdata->handle = v8::Persistent<v8::Object>::New(obj); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031900) + cdata->handle = v8::Persistent<v8::Object>::New(v8::Isolate::GetCurrent(), obj); +#else + cdata->handle.Reset(v8::Isolate::GetCurrent(), obj); +#endif + + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031918) + cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION) + cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete); +#else + cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete); +// v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete); +#endif + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710) + cdata->handle.MarkIndependent(); +#elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100) + cdata->handle.MarkIndependent(v8::Isolate::GetCurrent()); +#else + cdata->handle.MarkIndependent(); +#endif + + SWIGV8_ESCAPE(obj); +} + +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIGV8_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIGV8_NewPackedObj(ptr, sz, type) + + +/* --------------------------------------------------------------------------- + * Support for IN/OUTPUT typemaps (see Lib/typemaps/inoutlist.swg) + * + * ---------------------------------------------------------------------------*/ + +SWIGRUNTIME + +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) +v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) { +#else +v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) { +#endif + SWIGV8_HANDLESCOPE_ESC(); + + if (result->IsUndefined()) { + result = SWIGV8_ARRAY_NEW(); + } +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) + v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result); +#else + v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result); +#endif + arr->Set(arr->Length(), obj); + + SWIGV8_ESCAPE(arr); +}
diff --git a/share/swig/3.0.12/javascript/v8/javascriptruntime.swg b/share/swig/3.0.12/javascript/v8/javascriptruntime.swg new file mode 100644 index 0000000..0e40593 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptruntime.swg
@@ -0,0 +1,66 @@ +/* ----------------------------------------------------------------------------- + * javascriptruntime.swg + * + * ----------------------------------------------------------------------------- */ + +// V8 Version Macro +// ---------------- +// +// v8 added version macros V8_MAJOR_VERSION, V8_MINOR_VERSION, V8_BUILD_NUMBER +// and V8_PATCH_LEVEL in version 4.3.0. SWIG generated code uses these if +// they are defined - to support earlier versions you can specify the V8 version +// in use via the command line when you run SWIG: +// +// swig -c++ -javascript -v8 -DV8_VERSION=0x032530 example.i +// +// Or code in the interface file using SWIG_V8_VERSION: +// +// %begin %{#define SWIG_V8_VERSION 0x031110%} +// +// This is specified as a hex constant, but the constant is read as pairs of +// decimal digits, so for V8 3.25.30 use constant 0x032530. This scheme can't +// represent components > 99, but this constant is only useful for V8 < 4.3.0, +// and no V8 versions from that era had a component > 99. + +%define %swig_v8_define_version(version) +%insert("runtime") %{ +#ifndef SWIG_V8_VERSION +#define SWIG_V8_VERSION version +#endif +%} +%enddef + +#ifdef V8_VERSION +%swig_v8_define_version(V8_VERSION) +#else +// HACK: defining a default version +%swig_v8_define_version(0x031110) +#endif + + +// Node support +// ------------ + +#ifdef BUILDING_NODE_EXTENSION +%insert("runtime") %{ +#include <node.h> +%} +#endif + + +// V8 runtime +// ---------- + +%insert(runtime) %{ +#include <v8.h> + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> +%} + +%insert(runtime) "swigrun.swg"; /* SWIG API */ +%insert(runtime) "swigerrors.swg"; /* SWIG errors */ + +%insert(runtime) "javascriptrun.swg" +
diff --git a/share/swig/3.0.12/javascript/v8/javascriptstrings.swg b/share/swig/3.0.12/javascript/v8/javascriptstrings.swg new file mode 100644 index 0000000..65ba20e --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascriptstrings.swg
@@ -0,0 +1,59 @@ + +/* ------------------------------------------------------------ + * utility methods for char strings + * ------------------------------------------------------------ */ +%fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") { +SWIGINTERN int +SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc) +{ + if(valRef->IsString()) { + v8::Handle<v8::String> js_str = valRef->ToString(); + + size_t len = js_str->Utf8Length() + 1; + char* cstr = new char[len]; + js_str->WriteUtf8(cstr, len); + + if(alloc) *alloc = SWIG_NEWOBJ; + if(psize) *psize = len; + if(cptr) *cptr = cstr; + + return SWIG_OK; + } else { + if(valRef->IsObject()) { + v8::Handle<v8::Object> obj = valRef->ToObject(); + // try if the object is a wrapped char[] + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + return SWIG_TypeError; + } else { + return SWIG_TypeError; + } + } +} +} + +%fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") { +SWIGINTERNINLINE v8::Handle<v8::Value> +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + // TODO: handle extra long strings + return SWIGV8_UNDEFINED(); + } else { + v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size); + return js_str; + } + } else { + return SWIGV8_UNDEFINED(); + } +} +}
diff --git a/share/swig/3.0.12/javascript/v8/javascripttypemaps.swg b/share/swig/3.0.12/javascript/v8/javascripttypemaps.swg new file mode 100644 index 0000000..4601698 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/javascripttypemaps.swg
@@ -0,0 +1,43 @@ +/* ------------------------------------------------------------ + * Typemap specializations for Javascript + * ------------------------------------------------------------ */ + +/* ------------------------------------------------------------ + * Fragment section + * ------------------------------------------------------------ */ + +/* Include fundamental fragemt definitions */ +%include <typemaps/fragments.swg> + +/* Look for user fragments file. */ +%include <javascriptfragments.swg> + +/* Javascript fragments for fundamental types */ +%include <javascriptprimtypes.swg> + +/* Javascript fragments for char* strings */ +%include <javascriptstrings.swg> + + +/* ------------------------------------------------------------ + * Unified typemap section + * ------------------------------------------------------------ */ + +/* Javascript types */ + +#define SWIG_Object v8::Handle<v8::Value> +#define VOID_Object SWIGV8_UNDEFINED() + +/* Overload of the output/constant/exception/dirout handling */ + +/* append output */ +#define SWIG_AppendOutput(result, obj) SWIGV8_AppendOutput(result, obj) + +/* set constant */ +#define SWIG_SetConstant(name, obj) + +/* raise */ +#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type) + +/* Include the unified typemap library */ +%include <typemaps/swigtypemaps.swg>
diff --git a/share/swig/2.0.11/csharp/std_common.i b/share/swig/3.0.12/javascript/v8/std_common.i similarity index 100% copy from share/swig/2.0.11/csharp/std_common.i copy to share/swig/3.0.12/javascript/v8/std_common.i
diff --git a/share/swig/3.0.12/javascript/v8/std_complex.i b/share/swig/3.0.12/javascript/v8/std_complex.i new file mode 100644 index 0000000..088a4fe --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/std_complex.i
@@ -0,0 +1,19 @@ +/* + * STD C++ complex typemaps + */ + +%include <javascriptcomplex.swg> + +%{ +#include <complex> +%} + +/* defining the complex as/from converters */ + +%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag) +%swig_cplxflt_convn(std::complex<float>, std::complex<float>, std::real, std::imag) + +/* defining the typemaps */ + +%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>); +%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
diff --git a/share/swig/2.0.11/csharp/std_deque.i b/share/swig/3.0.12/javascript/v8/std_deque.i similarity index 100% copy from share/swig/2.0.11/csharp/std_deque.i copy to share/swig/3.0.12/javascript/v8/std_deque.i
diff --git a/share/swig/2.0.11/octave/std_except.i b/share/swig/3.0.12/javascript/v8/std_except.i similarity index 100% copy from share/swig/2.0.11/octave/std_except.i copy to share/swig/3.0.12/javascript/v8/std_except.i
diff --git a/share/swig/2.0.11/java/std_map.i b/share/swig/3.0.12/javascript/v8/std_map.i similarity index 100% copy from share/swig/2.0.11/java/std_map.i copy to share/swig/3.0.12/javascript/v8/std_map.i
diff --git a/share/swig/3.0.12/javascript/v8/std_pair.i b/share/swig/3.0.12/javascript/v8/std_pair.i new file mode 100644 index 0000000..8d60572 --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/std_pair.i
@@ -0,0 +1,33 @@ +/* ----------------------------------------------------------------------------- + * std_pair.i + * + * SWIG typemaps for std::pair + * ----------------------------------------------------------------------------- */ + +%include <std_common.i> + +// ------------------------------------------------------------------------ +// std::pair +// ------------------------------------------------------------------------ + +%{ +#include <utility> +%} + +namespace std { + + template<class T, class U> struct pair { + + pair(); + pair(T first, U second); + pair(const pair& p); + + template <class U1, class U2> pair(const pair<U1, U2> &p); + + T first; + U second; + }; + + // add specializations here + +}
diff --git a/share/swig/2.0.11/octave/std_string.i b/share/swig/3.0.12/javascript/v8/std_string.i similarity index 100% copy from share/swig/2.0.11/octave/std_string.i copy to share/swig/3.0.12/javascript/v8/std_string.i
diff --git a/share/swig/2.0.11/java/std_vector.i b/share/swig/3.0.12/javascript/v8/std_vector.i similarity index 97% copy from share/swig/2.0.11/java/std_vector.i copy to share/swig/3.0.12/javascript/v8/std_vector.i index 3f29b19..971b426 100644 --- a/share/swig/2.0.11/java/std_vector.i +++ b/share/swig/3.0.12/javascript/v8/std_vector.i
@@ -61,7 +61,7 @@ %rename(add) push_back; void push_back(const value_type& x); %extend { - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/java/stl.i b/share/swig/3.0.12/javascript/v8/stl.i similarity index 100% copy from share/swig/2.0.11/java/stl.i copy to share/swig/3.0.12/javascript/v8/stl.i
diff --git a/share/swig/3.0.12/javascript/v8/typemaps.i b/share/swig/3.0.12/javascript/v8/typemaps.i new file mode 100644 index 0000000..d3d8afb --- /dev/null +++ b/share/swig/3.0.12/javascript/v8/typemaps.i
@@ -0,0 +1,148 @@ +/* ----------------------------------------------------------------------------- + * typemaps.i + * + * Pointer handling + * These mappings provide support for input/output arguments and common + * uses for C/C++ pointers. + * ----------------------------------------------------------------------------- */ + +// INPUT typemaps. +// These remap a C pointer to be an "INPUT" value which is passed by value +// instead of reference. + +/* +The following methods can be applied to turn a pointer into a simple +"input" value. That is, instead of passing a pointer to an object, +you would use a real value instead. + + int *INPUT + short *INPUT + long *INPUT + long long *INPUT + unsigned int *INPUT + unsigned short *INPUT + unsigned long *INPUT + unsigned long long *INPUT + unsigned char *INPUT + bool *INPUT + float *INPUT + double *INPUT + +To use these, suppose you had a C function like this : + + double fadd(double *a, double *b) { + return *a+*b; + } + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + double fadd(double *INPUT, double *INPUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *INPUT { double *a, double *b }; + double fadd(double *a, double *b); + +*/ + +// OUTPUT typemaps. These typemaps are used for parameters that +// are output only. The output value is appended to the result as +// a list element. + +/* +The following methods can be applied to turn a pointer into an "output" +value. When calling a function, no input value would be given for +a parameter, but an output value would be returned. In the case of +multiple output values, they are returned in the form of a Python tuple. + + int *OUTPUT + short *OUTPUT + long *OUTPUT + long long *OUTPUT + unsigned int *OUTPUT + unsigned short *OUTPUT + unsigned long *OUTPUT + unsigned long long *OUTPUT + unsigned char *OUTPUT + bool *OUTPUT + float *OUTPUT + double *OUTPUT + +For example, suppose you were trying to wrap the modf() function in the +C math library which splits x into integral and fractional parts (and +returns the integer part in one of its parameters).K: + + double modf(double x, double *ip); + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + double modf(double x, double *OUTPUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *OUTPUT { double *ip }; + double modf(double x, double *ip); + +The Python output of the function would be a tuple containing both +output values. + +*/ + +// INOUT +// Mappings for an argument that is both an input and output +// parameter + +/* +The following methods can be applied to make a function parameter both +an input and output value. This combines the behavior of both the +"INPUT" and "OUTPUT" methods described earlier. Output values are +returned in the form of a Python tuple. + + int *INOUT + short *INOUT + long *INOUT + long long *INOUT + unsigned int *INOUT + unsigned short *INOUT + unsigned long *INOUT + unsigned long long *INOUT + unsigned char *INOUT + bool *INOUT + float *INOUT + double *INOUT + +For example, suppose you were trying to wrap the following function : + + void neg(double *x) { + *x = -(*x); + } + +You could wrap it with SWIG as follows : + + %include <typemaps.i> + void neg(double *INOUT); + +or you can use the %apply directive : + + %include <typemaps.i> + %apply double *INOUT { double *x }; + void neg(double *x); + +Unlike C, this mapping does not directly modify the input value (since +this makes no sense in Python). Rather, the modified input value shows +up as the return value of the function. Thus, to apply this function +to a Python variable you might do this : + + x = neg(x) + +Note : previous versions of SWIG used the symbol 'BOTH' to mark +input/output arguments. This is still supported, but will be slowly +phased out in future releases. + +*/ + +%include <typemaps/typemaps.swg>
diff --git a/share/swig/2.0.11/lua/_std_common.i b/share/swig/3.0.12/lua/_std_common.i similarity index 100% rename from share/swig/2.0.11/lua/_std_common.i rename to share/swig/3.0.12/lua/_std_common.i
diff --git a/share/swig/2.0.11/lua/carrays.i b/share/swig/3.0.12/lua/carrays.i similarity index 100% rename from share/swig/2.0.11/lua/carrays.i rename to share/swig/3.0.12/lua/carrays.i
diff --git a/share/swig/2.0.11/lua/factory.i b/share/swig/3.0.12/lua/factory.i similarity index 100% rename from share/swig/2.0.11/lua/factory.i rename to share/swig/3.0.12/lua/factory.i
diff --git a/share/swig/2.0.11/lua/lua.swg b/share/swig/3.0.12/lua/lua.swg similarity index 94% rename from share/swig/2.0.11/lua/lua.swg rename to share/swig/3.0.12/lua/lua.swg index d3b3351..9c21d08 100644 --- a/share/swig/2.0.11/lua/lua.swg +++ b/share/swig/3.0.12/lua/lua.swg
@@ -9,8 +9,9 @@ * includes * ----------------------------------------------------------------------------- */ -%include <luatypemaps.swg> /* The typemaps */ +%include <luatypemaps.swg> /* The typemaps */ %include <luaruntime.swg> /* The runtime stuff */ +%include <luakw.swg> /* Warnings for Lua keywords */ //%include <typemaps/swigmacros.swg> /* ----------------------------------------------------------------------------- @@ -40,12 +41,15 @@ %typemap(consttab) long long, unsigned long long {SWIG_LUA_CONSTTAB_STRING("$symname", "$value")} -%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE [] - { SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor} +%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] + { SWIG_LUA_CONSTTAB_POINTER("$symname",$value, $1_descriptor) } + +%typemap(consttab) SWIGTYPE + { SWIG_LUA_CONSTTAB_POINTER("$symname",&$value, $&1_descriptor) } // member function pointers %typemap(consttab) SWIGTYPE (CLASS::*) - { SWIG_LUA_BINARY, (char *)"$symname", sizeof($type), 0, (void *)&$value, &$1_descriptor} + { SWIG_LUA_CONSTTAB_BINARY("$symname", sizeof($type),&$value, $1_descriptor) } /* ----------------------------------------------------------------------------- @@ -181,7 +185,7 @@ // char is changed to a string %typemap(throws) char -%{lua_pushfstring(L,"%c",$1);SWIG_fail;%} +%{lua_pushlstring(L,&$1,1);SWIG_fail;%} /* Throwing object is a serious problem:
diff --git a/share/swig/2.0.11/lua/lua_fnptr.i b/share/swig/3.0.12/lua/lua_fnptr.i similarity index 98% rename from share/swig/2.0.11/lua/lua_fnptr.i rename to share/swig/3.0.12/lua/lua_fnptr.i index 4e2c8dc..481cfaf 100644 --- a/share/swig/2.0.11/lua/lua_fnptr.i +++ b/share/swig/3.0.12/lua/lua_fnptr.i
@@ -103,7 +103,6 @@ } void swiglua_ref_set(SWIGLUA_REF* pref,lua_State* L,int idx){ -// swiglua_ref_clear(pref); /* just in case */ pref->L=L; lua_pushvalue(L,idx); /* copy obj to top */ pref->ref=luaL_ref(L,LUA_REGISTRYINDEX); /* remove obj from top & put into registry */
diff --git a/share/swig/3.0.12/lua/luakw.swg b/share/swig/3.0.12/lua/luakw.swg new file mode 100644 index 0000000..fc2f92b --- /dev/null +++ b/share/swig/3.0.12/lua/luakw.swg
@@ -0,0 +1,67 @@ +/* + Warnings for Lua keywords, built-in names and bad names. +*/ + +#define LUAKW(x) %keywordwarn("'" `x` "' is a Lua keyword, renaming to 'c_" `x` "'", rename="c_%s") `x` +#define LUABN(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "'" `x` "' conflicts with a basic function in Lua"), %$not %$ismember) `x` + +/* + Warnings for Lua keywords + http://www.lua.org/manual/5.2/manual.html#3.1 +*/ + +LUAKW(and); +LUAKW(break); +LUAKW(do); +LUAKW(else); +LUAKW(elseif); +LUAKW(end); +LUAKW(false); +LUAKW(for); +LUAKW(function); +LUAKW(goto); +LUAKW(if); +LUAKW(in); +LUAKW(local); +LUAKW(nil); +LUAKW(not); +LUAKW(or); +LUAKW(repeat); +LUAKW(return); +LUAKW(then); +LUAKW(true); +LUAKW(until); +LUAKW(while); + +/* + Basic functions + http://www.lua.org/manual/5.2/manual.html#6.1 +*/ + +LUABN(assert); +LUABN(collectgarbage); +LUABN(dofile); +LUABN(error); +LUABN(_G); // Not actually a function +LUABN(getmetatable); +LUABN(ipairs); +LUABN(load); +LUABN(loadfile); +LUABN(next); +LUABN(pairs); +LUABN(pcall); +LUABN(print); +LUABN(rawequal); +LUABN(rawget); +LUABN(rawlen); +LUABN(rawset); +LUABN(select); +LUABN(setmetatable); +LUABN(tonumber); +LUABN(tostring); +LUABN(type); +LUABN(_VERSION); // Not actually a function +LUABN(xpcall); + +#undef LUABN +#undef LUAKW
diff --git a/share/swig/3.0.12/lua/luarun.swg b/share/swig/3.0.12/lua/luarun.swg new file mode 100644 index 0000000..660dbbf --- /dev/null +++ b/share/swig/3.0.12/lua/luarun.swg
@@ -0,0 +1,1934 @@ +/* ----------------------------------------------------------------------------- + * luarun.swg + * + * This file contains the runtime support for Lua modules + * and includes code for managing global variables and pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lua.h" +#include "lauxlib.h" +#include <stdlib.h> /* for malloc */ +#include <assert.h> /* for a few sanity tests */ + +/* ----------------------------------------------------------------------------- + * Lua flavors + * ----------------------------------------------------------------------------- */ + +#define SWIG_LUA_FLAVOR_LUA 1 +#define SWIG_LUA_FLAVOR_ELUA 2 +#define SWIG_LUA_FLAVOR_ELUAC 3 + +#if !defined(SWIG_LUA_TARGET) +# error SWIG_LUA_TARGET not defined +#endif + +#if defined(SWIG_LUA_ELUA_EMULATE) + +struct swig_elua_entry; + +typedef struct swig_elua_key { + int type; + union { + const char* strkey; + lua_Number numkey; + } key; +} swig_elua_key; + +typedef struct swig_elua_val { + int type; + union { + lua_Number number; + const struct swig_elua_entry *table; + const char *string; + lua_CFunction function; + struct { + char member; + long lvalue; + void *pvalue; + swig_type_info **ptype; + } userdata; + } value; +} swig_elua_val; + +typedef struct swig_elua_entry { + swig_elua_key key; + swig_elua_val value; +} swig_elua_entry; + +#define LSTRKEY(x) {LUA_TSTRING, {.strkey = x} } +#define LNUMKEY(x) {LUA_TNUMBER, {.numkey = x} } +#define LNILKEY {LUA_TNIL, {.strkey = 0} } + +#define LNUMVAL(x) {LUA_TNUMBER, {.number = x} } +#define LFUNCVAL(x) {LUA_TFUNCTION, {.function = x} } +#define LROVAL(x) {LUA_TTABLE, {.table = x} } +#define LNILVAL {LUA_TNIL, {.string = 0} } +#define LSTRVAL(x) {LUA_TSTRING, {.string = x} } + +#define LUA_REG_TYPE swig_elua_entry + +#define SWIG_LUA_ELUA_EMUL_METATABLE_KEY "__metatable" + +#define lua_pushrotable(L,p)\ + lua_newtable(L);\ + assert(p);\ + SWIG_Lua_elua_emulate_register(L,(swig_elua_entry*)(p)); + +#define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\ + LSTRKEY(B), {LUA_TUSERDATA, { .userdata={0,0,(void*)(C),&D} } } + +#define SWIG_LUA_CONSTTAB_BINARY(B,S,C,D)\ + LSTRKEY(B), {LUA_TUSERDATA, { .userdata={1,S,(void*)(C),&D} } } +#endif + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +# define SWIG_LUA_CONSTTAB_INT(B, C) LSTRKEY(B), LNUMVAL(C) +# define SWIG_LUA_CONSTTAB_FLOAT(B, C) LSTRKEY(B), LNUMVAL(C) +# define SWIG_LUA_CONSTTAB_STRING(B, C) LSTRKEY(B), LSTRVAL(C) +# define SWIG_LUA_CONSTTAB_CHAR(B, C) LSTRKEY(B), LNUMVAL(C) + /* Those two types of constants are not supported in elua */ + +#ifndef SWIG_LUA_CONSTTAB_POINTER +#warning eLua does not support pointers as constants. By default, nil will be used as value +#define SWIG_LUA_CONSTTAB_POINTER(B,C,D) LSTRKEY(B), LNILVAL +#endif + +#ifndef SWIG_LUA_CONSTTAB_BINARY +#warning eLua does not support pointers to member as constants. By default, nil will be used as value +#define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D) LSTRKEY(B), LNILVAL +#endif +#else /* SWIG_LUA_FLAVOR_LUA */ +# define SWIG_LUA_CONSTTAB_INT(B, C) SWIG_LUA_INT, (char *)B, (long)C, 0, 0, 0 +# define SWIG_LUA_CONSTTAB_FLOAT(B, C) SWIG_LUA_FLOAT, (char *)B, 0, (double)C, 0, 0 +# define SWIG_LUA_CONSTTAB_STRING(B, C) SWIG_LUA_STRING, (char *)B, 0, 0, (void *)C, 0 +# define SWIG_LUA_CONSTTAB_CHAR(B, C) SWIG_LUA_CHAR, (char *)B, (long)C, 0, 0, 0 +# define SWIG_LUA_CONSTTAB_POINTER(B,C,D)\ + SWIG_LUA_POINTER, (char *)B, 0, 0, (void *)C, &D +# define SWIG_LUA_CONSTTAB_BINARY(B, S, C, D)\ + SWIG_LUA_BINARY, (char *)B, S, 0, (void *)C, &D +#endif + +#ifndef SWIG_LUA_ELUA_EMULATE +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +# define LRO_STRVAL(v) {{.p = (char *) v}, LUA_TSTRING} +# define LSTRVAL LRO_STRVAL +#endif +#endif /* SWIG_LUA_ELUA_EMULATE*/ + +#ifndef SWIG_LUA_ELUA_EMULATE +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) + +#ifndef MIN_OPT_LEVEL +#define MIN_OPT_LEVEL 2 +#endif + +#include "lrodefs.h" +#include "lrotable.h" +#endif +#endif /* SWIG_LUA_ELUA_EMULATE*/ +/* ----------------------------------------------------------------------------- + * compatibility defines + * ----------------------------------------------------------------------------- */ + +/* History of Lua C API length functions: In Lua 5.0 (and before?) + there was "lua_strlen". In Lua 5.1, this was renamed "lua_objlen", + but a compatibility define of "lua_strlen" was added. In Lua 5.2, + this function was again renamed, to "lua_rawlen" (to emphasize that + it doesn't call the "__len" metamethod), and the compatibility + define of lua_strlen was removed. All SWIG uses have been updated + to "lua_rawlen", and we add our own defines of that here for older + versions of Lua. */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 +# define lua_rawlen lua_strlen +#elif LUA_VERSION_NUM == 501 +# define lua_rawlen lua_objlen +#endif + + +/* lua_pushglobaltable is the recommended "future-proof" way to get + the global table for Lua 5.2 and later. Here we define + lua_pushglobaltable ourselves for Lua versions before 5.2. */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 +# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) +#endif + +/* lua_absindex was introduced in Lua 5.2 */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 +# define lua_absindex(L,i) ((i)>0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1) +#endif + +/* lua_rawsetp was introduced in Lua 5.2 */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502 +#define lua_rawsetp(L,index,ptr)\ + lua_pushlightuserdata(L,(void*)(ptr));\ + lua_insert(L,-2);\ + lua_rawset(L,index); + +#define lua_rawgetp(L,index,ptr)\ + lua_pushlightuserdata(L,(void*)(ptr));\ + lua_rawget(L,index); + +#endif + +/* -------------------------------------------------------------------------- + * Helper functions for error handling + * -------------------------------------------------------------------------- */ + +/* Push the string STR on the Lua stack, like lua_pushstring, but + prefixed with the the location of the innermost Lua call-point + (as formated by luaL_where). */ +SWIGRUNTIME void +SWIG_Lua_pusherrstring (lua_State *L, const char *str) +{ + luaL_where (L, 1); + lua_pushstring (L, str); + lua_concat (L, 2); +} + +/* Push a formatted string generated from FMT and following args on + the Lua stack, like lua_pushfstring, but prefixed with the the + location of the innermost Lua call-point (as formated by luaL_where). */ +SWIGRUNTIME void +SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...) +{ + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); +} + + +/* ----------------------------------------------------------------------------- + * global swig types + * ----------------------------------------------------------------------------- */ +/* Constant table */ +#define SWIG_LUA_INT 1 +#define SWIG_LUA_FLOAT 2 +#define SWIG_LUA_STRING 3 +#define SWIG_LUA_POINTER 4 +#define SWIG_LUA_BINARY 5 +#define SWIG_LUA_CHAR 6 + +/* Structure for variable linking table */ +typedef struct { + const char *name; + lua_CFunction get; + lua_CFunction set; +} swig_lua_var_info; + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +typedef const LUA_REG_TYPE swig_lua_method; +typedef const LUA_REG_TYPE swig_lua_const_info; +#else /* Normal lua */ +typedef luaL_Reg swig_lua_method; + +/* Constant information structure */ +typedef struct { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_lua_const_info; + +#endif + +typedef struct { + const char *name; + lua_CFunction getmethod; + lua_CFunction setmethod; +} swig_lua_attribute; + + +struct swig_lua_class; +/* Can be used to create namespaces. Currently used to wrap class static methods/variables/constants */ +typedef struct swig_lua_namespace { + const char *name; + swig_lua_method *ns_methods; + swig_lua_attribute *ns_attributes; + swig_lua_const_info *ns_constants; + struct swig_lua_class **ns_classes; + struct swig_lua_namespace **ns_namespaces; +} swig_lua_namespace; + +typedef struct swig_lua_class { + const char *name; /* Name that this class has in Lua */ + const char *fqname; /* Fully qualified name - Scope + class name */ + swig_type_info **type; + lua_CFunction constructor; + void (*destructor)(void *); + swig_lua_method *methods; + swig_lua_attribute *attributes; + swig_lua_namespace *cls_static; + swig_lua_method *metatable; /* 0 for -eluac */ + struct swig_lua_class **bases; + const char **base_names; +} swig_lua_class; + +/* this is the struct for wrapping all pointers in SwigLua +*/ +typedef struct { + swig_type_info *type; + int own; /* 1 if owned & must be destroyed */ + void *ptr; +} swig_lua_userdata; + +/* this is the struct for wrapping arbitrary packed binary data +(currently it is only used for member function pointers) +the data ordering is similar to swig_lua_userdata, but it is currently not possible +to tell the two structures apart within SWIG, other than by looking at the type +*/ +typedef struct { + swig_type_info *type; + int own; /* 1 if owned & must be destroyed */ + char data[1]; /* arbitary amount of data */ +} swig_lua_rawdata; + +/* Common SWIG API */ +#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) +#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) +#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) +#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) + +/* Runtime API */ +#define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) +#define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer) +#define SWIG_MODULE_CLIENTDATA_TYPE lua_State* + +/* Contract support */ +#define SWIG_contract_assert(expr, msg) \ + if (!(expr)) { SWIG_Lua_pusherrstring(L, (char *) msg); goto fail; } else + + +/* helper #defines */ +#define SWIG_fail {goto fail;} +#define SWIG_fail_arg(func_name,argnum,type) \ + {SWIG_Lua_pushferrstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ + func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ + goto fail;} +#define SWIG_fail_ptr(func_name,argnum,type) \ + SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") +#define SWIG_check_num_args(func_name,a,b) \ + if (lua_gettop(L)<a || lua_gettop(L)>b) \ + {SWIG_Lua_pushferrstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ + goto fail;} + + +#define SWIG_Lua_get_table(L,n) \ + (lua_pushstring(L, n), lua_rawget(L,-2)) + +#define SWIG_Lua_add_function(L,n,f) \ + (lua_pushstring(L, n), \ + lua_pushcfunction(L, f), \ + lua_rawset(L,-3)) + +#define SWIG_Lua_add_boolean(L,n,b) \ + (lua_pushstring(L, n), \ + lua_pushboolean(L, b), \ + lua_rawset(L,-3)) + +/* special helper for allowing 'nil' for usertypes */ +#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) + +#ifdef __cplusplus +/* Special helper for member function pointers +it gets the address, casts it, then dereferences it */ +/*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */ +#endif + +/* storing/access of swig_module_info */ +SWIGRUNTIME swig_module_info * +SWIG_Lua_GetModule(lua_State *L) { + swig_module_info *ret = 0; + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_rawget(L,LUA_REGISTRYINDEX); + if (lua_islightuserdata(L,-1)) + ret=(swig_module_info*)lua_touserdata(L,-1); + lua_pop(L,1); /* tidy */ + return ret; +} + +SWIGRUNTIME void +SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) { + /* add this all into the Lua registry: */ + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_pushlightuserdata(L,(void*)module); + lua_rawset(L,LUA_REGISTRYINDEX); +} + +/* ----------------------------------------------------------------------------- + * global variable support code: modules + * ----------------------------------------------------------------------------- */ + +/* this function is called when trying to set an immutable. +default action is to print an error. +This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ +SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L) +{ +/* there should be 1 param passed in: the new value */ +#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE + lua_pop(L,1); /* remove it */ + luaL_error(L,"This variable is immutable"); +#endif + return 0; /* should not return anything */ +} + +#ifdef SWIG_LUA_ELUA_EMULATE + +SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own); +SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type); +static int swig_lua_elua_emulate_unique_key; + +/* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */ +SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table) +{ + int i, table_parsed, parsed_tables_array, target_table; + assert(lua_istable(L,-1)); + target_table = lua_gettop(L); + /* Get the registry where we put all parsed tables to avoid loops */ + lua_rawgetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key); + if(lua_isnil(L,-1)) { + lua_pop(L,1); + lua_newtable(L); + lua_pushvalue(L,-1); + lua_rawsetp(L,LUA_REGISTRYINDEX,(void*)(&swig_lua_elua_emulate_unique_key)); + } + parsed_tables_array = lua_gettop(L); + lua_pushvalue(L,target_table); + lua_rawsetp(L, parsed_tables_array, table); + table_parsed = 0; + const int SWIGUNUSED pairs_start = lua_gettop(L); + for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++) + { + const swig_elua_entry *entry = table + i; + int is_metatable = 0; + switch(entry->key.type) { + case LUA_TSTRING: + lua_pushstring(L,entry->key.key.strkey); + if(strcmp(entry->key.key.strkey, SWIG_LUA_ELUA_EMUL_METATABLE_KEY) == 0) + is_metatable = 1; + break; + case LUA_TNUMBER: + lua_pushnumber(L,entry->key.key.numkey); + break; + case LUA_TNIL: + lua_pushnil(L); + break; + default: + assert(0); + } + switch(entry->value.type) { + case LUA_TSTRING: + lua_pushstring(L,entry->value.value.string); + break; + case LUA_TNUMBER: + lua_pushnumber(L,entry->value.value.number); + break; + case LUA_TFUNCTION: + lua_pushcfunction(L,entry->value.value.function); + break; + case LUA_TTABLE: + lua_rawgetp(L,parsed_tables_array, entry->value.value.table); + table_parsed = !lua_isnil(L,-1); + if(!table_parsed) { + lua_pop(L,1); /*remove nil */ + lua_newtable(L); + SWIG_Lua_elua_emulate_register(L,entry->value.value.table); + } + if(is_metatable) { + assert(lua_istable(L,-1)); + lua_pushvalue(L,-1); + lua_setmetatable(L,target_table); + } + + break; + case LUA_TUSERDATA: + if(entry->value.value.userdata.member) + SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue, + entry->value.value.userdata.lvalue, + *(entry->value.value.userdata.ptype)); + else + SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue, + *(entry->value.value.userdata.ptype),0); + break; + case LUA_TNIL: + lua_pushnil(L); + break; + default: + assert(0); + } + assert(lua_gettop(L) == pairs_start + 2); + lua_rawset(L,target_table); + } + lua_pop(L,1); /* Removing parsed tables storage */ + assert(lua_gettop(L) == target_table); +} + +SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L) +{ + lua_pushnil(L); + lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key); +} + +SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L); + +SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L) +{ + SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1); + SWIG_Lua_get_class_registry(L); + lua_getfield(L,-1,"lua_getmetatable"); + lua_remove(L,-2); /* remove the registry*/ + assert(!lua_isnil(L,-1)); + lua_pushvalue(L,1); + assert(lua_gettop(L) == 3); /* object | function | object again */ + lua_call(L,1,1); + if(!lua_isnil(L,-1)) /*There is an ordinary metatable */ + return 1; + /*if it is a table, then emulate elua behaviour - check for __metatable attribute of a table*/ + assert(lua_gettop(L) == 2); + if(lua_istable(L,-2)) { + lua_pop(L,1); /*remove the nil*/ + lua_getfield(L,-1, SWIG_LUA_ELUA_EMUL_METATABLE_KEY); + } + assert(lua_gettop(L) == 2); + return 1; + +fail: + lua_error(L); + return 0; +} + +SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L) +{ + SWIG_Lua_get_class_registry(L); + lua_pushglobaltable(L); + lua_pushstring(L,"lua_getmetatable"); + lua_getfield(L,-2,"getmetatable"); + assert(!lua_isnil(L,-1)); + lua_rawset(L,-4); + lua_pushstring(L, "getmetatable"); + lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable); + lua_rawset(L,-3); + lua_pop(L,2); + +} +/* END OF REMOVE */ + +#endif +/* ----------------------------------------------------------------------------- + * global variable support code: namespaces and modules (which are the same thing) + * ----------------------------------------------------------------------------- */ + +SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L) +{ +/* there should be 2 params passed in + (1) table (not the meta table) + (2) string name of the attribute +*/ + assert(lua_istable(L,-2)); /* just in case */ + lua_getmetatable(L,-2); + assert(lua_istable(L,-1)); + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */ + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + return 0; +} + +SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L) +{ +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value +*/ + + assert(lua_istable(L,1)); + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,3); /* value */ + lua_call(L,1,0); + return 0; + } + lua_pop(L,1); /* remove the value */ + } + lua_pop(L,1); /* remove the value .set table */ + lua_pop(L,1); /* remote metatable */ + lua_rawset(L,-3); + return 0; +} + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */ +SWIGINTERN void SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]); /* forward declaration */ +SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn); /* forward declaration */ +SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss); + +/* helper function - register namespace methods and attributes into namespace */ +SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns) +{ + int i; + /* There must be namespace table (not metatable) at the top of the stack */ + assert(lua_istable(L,-1)); + SWIG_Lua_InstallConstants(L, ns->ns_constants); + + /* add methods to the namespace/module table */ + for(i=0;ns->ns_methods[i].name;i++){ + SWIG_Lua_add_function(L,ns->ns_methods[i].name,ns->ns_methods[i].func); + } + lua_getmetatable(L,-1); + + /* add fns */ + for(i=0;ns->ns_attributes[i].name;i++){ + SWIG_Lua_add_variable(L,ns->ns_attributes[i].name,ns->ns_attributes[i].getmethod,ns->ns_attributes[i].setmethod); + } + + /* clear stack - remove metatble */ + lua_pop(L,1); + return 0; +} + +/* Register all classes in the namespace */ +SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns) +{ + swig_lua_class **classes; + + /* There must be a module/namespace table at the top of the stack */ + assert(lua_istable(L,-1)); + + classes = ns->ns_classes; + + if( classes != 0 ) { + while(*classes != 0) { + SWIG_Lua_class_register(L, *classes); + classes++; + } + } +} + +/* Helper function. Creates namespace table and adds it to module table + if 'reg' is true, then will register namespace table to parent one (must be on top of the stack + when function is called). + Function always returns newly registered table on top of the stack. +*/ +SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg) +{ + swig_lua_namespace **sub_namespace; + /* 1 argument - table on the top of the stack */ + const int SWIGUNUSED begin = lua_gettop(L); + assert(lua_istable(L,-1)); /* just in case. This is supposed to be module table or parent namespace table */ + lua_checkstack(L,5); + lua_newtable(L); /* namespace itself */ + lua_newtable(L); /* metatable for namespace */ + + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + lua_rawset(L,-3); + + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_namespace_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_namespace_set); + + lua_setmetatable(L,-2); /* set metatable */ + + /* Register all functions, variables etc */ + SWIG_Lua_add_namespace_details(L,ns); + /* Register classes */ + SWIG_Lua_add_namespace_classes(L,ns); + + sub_namespace = ns->ns_namespaces; + if( sub_namespace != 0) { + while(*sub_namespace != 0) { + SWIG_Lua_namespace_register(L, *sub_namespace, 1); + lua_pop(L,1); /* removing sub-namespace table */ + sub_namespace++; + } + } + + if (reg) { + lua_pushstring(L,ns->name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); /* add namespace to module table */ + } + assert(lua_gettop(L) == begin+1); +} +#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */ + +/* ----------------------------------------------------------------------------- + * global variable support code: classes + * ----------------------------------------------------------------------------- */ + +SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname); + +typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret); + +SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type, + int first_arg, swig_lua_base_iterator_func func, int *const ret) +{ + /* first_arg - position of the object in stack. Everything that is above are arguments + * and is passed to every evocation of the func */ + int last_arg = lua_gettop(L);/* position of last argument */ + int original_metatable = last_arg + 1; + size_t bases_count; + int result = SWIG_ERROR; + int bases_table; + (void)swig_type; + lua_getmetatable(L,first_arg); + + /* initialise base search */ +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) + SWIG_Lua_get_table(L,".bases"); + assert(lua_istable(L,-1)); + bases_count = lua_rawlen(L,-1); + bases_table = lua_gettop(L); +#else + /* In elua .bases table doesn't exist. Use table from swig_lua_class */ + (void)bases_table; + assert(swig_type!=0); + swig_module_info *module=SWIG_GetModule(L); + swig_lua_class **bases= ((swig_lua_class*)(swig_type->clientdata))->bases; + const char **base_names= ((swig_lua_class*)(swig_type->clientdata))->base_names; + bases_count = 0; + for(;base_names[bases_count]; + bases_count++);/* get length of bases */ +#endif + + if(ret) + *ret = 0; + if(bases_count>0) + { + int to_remove; + size_t i; + int j; + int subcall_last_arg; + int subcall_first_arg = lua_gettop(L) + 1;/* Here a copy of first_arg and arguments begin */ + int valid = 1; + swig_type_info *base_swig_type = 0; + for(j=first_arg;j<=last_arg;j++) + lua_pushvalue(L,j); + subcall_last_arg = lua_gettop(L); + + /* Trick: temporarily replacing original metatable with metatable for base class and call getter */ + for(i=0;i<bases_count;i++) { + /* Iteration through class bases */ +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) + lua_rawgeti(L,bases_table,i+1); + base_swig_type = 0; + if(lua_isnil(L,-1)) { + valid = 0; + lua_pop(L,1); + } else { + valid = 1; + } +#else /* In elua .bases table doesn't exist. Use table from swig_lua_class */ + swig_lua_class *base_class = bases[i]; + if(!base_class) { + valid = 0; + } else { + valid = 1; + SWIG_Lua_get_class_metatable(L,base_class->fqname); + base_swig_type = SWIG_TypeQueryModule(module,module,base_names[i]); + assert(base_swig_type != 0); + } +#endif + + if(!valid) + continue; + assert(lua_isuserdata(L, subcall_first_arg)); + assert(lua_istable(L,-1)); + lua_setmetatable(L,subcall_first_arg); /* Set new metatable */ + assert(lua_gettop(L) == subcall_last_arg); + result = func(L, base_swig_type,subcall_first_arg, ret); /* Forward call */ + if(result != SWIG_ERROR) { + break; + } + } + /* Restore original metatable */ + lua_pushvalue(L,original_metatable); + lua_setmetatable(L,first_arg); + /* Clear - remove everything between last_arg and subcall_last_arg including */ + to_remove = subcall_last_arg - last_arg; + for(j=0;j<to_remove;j++) + lua_remove(L,last_arg+1); + } else { + /* Remove everything after last_arg */ + lua_pop(L, lua_gettop(L) - last_arg); + } + if(ret) assert(lua_gettop(L) == last_arg + *ret); + return result; +} + +/* The class.get method helper, performs the lookup of class attributes. + * It returns an error code. Number of function return values is passed inside 'ret'. + * first_arg is not used in this function because function always has 2 arguments. + */ +SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret) +{ +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute +*/ + int bases_search_result; + int substack_start = lua_gettop(L)-2; + assert(first_arg == substack_start+1); + lua_checkstack(L,5); + assert(lua_isuserdata(L,-2)); /* just in case */ + lua_getmetatable(L,-2); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + /* NEW: looks for the __getitem() fn + this is a user provided get fn */ + SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,substack_start+1); /* the userdata */ + lua_pushvalue(L,substack_start+2); /* the parameter */ + lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + if(ret) *ret = 1; + return SWIG_OK; + } + lua_pop(L,1); + /* Remove the metatable */ + lua_pop(L,1); + /* Search in base classes */ + bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get_item,ret); + return bases_search_result; /* sorry not known */ +} + + +/* The class.get method helper, performs the lookup of class attributes. + * It returns an error code. Number of function return values is passed inside 'ret'. + * first_arg is not used in this function because function always has 2 arguments. + */ +SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret) +{ +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute +*/ + int bases_search_result; + int substack_start = lua_gettop(L)-2; + assert(first_arg == substack_start+1); + lua_checkstack(L,5); + assert(lua_isuserdata(L,-2)); /* just in case */ + lua_getmetatable(L,-2); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + /* look for the key in the .get table */ + lua_pushvalue(L,substack_start+2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,substack_start+1); /* the userdata */ + lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + if(ret) + *ret = 1; + return SWIG_OK; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,substack_start+2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + if(ret) + *ret = 1; + return SWIG_OK; + } + lua_pop(L,1); /* remove whatever was there */ + /* Remove the metatable */ + lua_pop(L,1); + /* Search in base classes */ + bases_search_result = SWIG_Lua_iterate_bases(L,type,substack_start+1,SWIG_Lua_class_do_get,ret); + return bases_search_result; /* sorry not known */ +} + +/* the class.get method, performs the lookup of class attributes + */ +SWIGINTERN int SWIG_Lua_class_get(lua_State *L) +{ +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute +*/ + int result; + swig_lua_userdata *usr; + swig_type_info *type; + int ret = 0; + assert(lua_isuserdata(L,1)); + usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + type = usr->type; + result = SWIG_Lua_class_do_get(L,type,1,&ret); + if(result == SWIG_OK) + return ret; + + result = SWIG_Lua_class_do_get_item(L,type,1,&ret); + if(result == SWIG_OK) + return ret; + + return 0; +} + +/* helper for the class.set method, performs the lookup of class attributes + * It returns error code. Number of function return values is passed inside 'ret' + */ +SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret) +{ +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value + */ + + int bases_search_result; + int substack_start = lua_gettop(L) - 3; + lua_checkstack(L,5); + assert(lua_isuserdata(L,substack_start+1)); /* just in case */ + lua_getmetatable(L,substack_start+1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + if(ret) + *ret = 0; /* it is setter - number of return values is always 0 */ + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,substack_start+2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* tidy stack, remove .set table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,substack_start+1); /* userdata */ + lua_pushvalue(L,substack_start+3); /* value */ + lua_call(L,2,0); + lua_remove(L,substack_start+4); /*remove metatable*/ + return SWIG_OK; + } + lua_pop(L,1); /* remove the value */ + } else { + lua_pop(L,1); /* remove the answer for .set table request*/ + } + /* NEW: looks for the __setitem() fn + this is a user provided set fn */ + SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,substack_start+1); /* the userdata */ + lua_pushvalue(L,substack_start+2); /* the parameter */ + lua_pushvalue(L,substack_start+3); /* the value */ + lua_call(L,3,0); /* 3 values in ,0 out */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return SWIG_OK; + } + lua_pop(L,1); /* remove value */ + + lua_pop(L,1); /* remove metatable */ + /* Search among bases */ + bases_search_result = SWIG_Lua_iterate_bases(L,type,first_arg,SWIG_Lua_class_do_set,ret); + if(ret) + assert(*ret == 0); + assert(lua_gettop(L) == substack_start + 3); + return bases_search_result; +} + +/* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly + * handles return values. + */ +SWIGINTERN int SWIG_Lua_class_set(lua_State *L) +{ +/* There should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value + */ + int ret = 0; + int result; + swig_lua_userdata *usr; + swig_type_info *type; + assert(lua_isuserdata(L,1)); + usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + type = usr->type; + result = SWIG_Lua_class_do_set(L,type,1,&ret); + if(result != SWIG_OK) { + SWIG_Lua_pushferrstring(L,"Assignment not possible. No setter/member with this name. For custom assignments implement __setitem method."); + lua_error(L); + } else { + assert(ret==0); + } + return 0; +} + +/* the class.destruct method called by the interpreter */ +SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L) +{ +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata *usr; + swig_lua_class *clss; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + /* if must be destroyed & has a destructor */ + if (usr->own) /* if must be destroyed */ + { + clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ + if (clss && clss->destructor) /* there is a destroy fn */ + { + clss->destructor(usr->ptr); /* bye bye */ + } + } + return 0; +} + +/* the class.__tostring method called by the interpreter and print */ +SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L) +{ +/* there should be 1 param passed in + (1) userdata (not the metatable) */ + const char *className; + void* userData; + assert(lua_isuserdata(L,1)); /* just in case */ + userData = lua_touserdata(L,1); /* get the userdata address for later */ + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + + lua_getfield(L, -1, ".type"); + className = lua_tostring(L, -1); + + lua_pushfstring(L, "<%s userdata: %p>", className, userData); + return 1; +} + +/* to manually disown some userdata */ +SWIGINTERN int SWIG_Lua_class_disown(lua_State *L) +{ +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata *usr; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + + usr->own = 0; /* clear our ownership */ + return 0; +} + +/* lua callable function to compare userdata's value +the issue is that two userdata may point to the same thing +but to lua, they are different objects */ +SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L) +{ + int result; + swig_lua_userdata *usr1,*usr2; + if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ + return 0; /* nil reply */ + usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ + /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ + result=(usr1->ptr==usr2->ptr); + lua_pushboolean(L,result); + return 1; +} + +/* populate table at the top of the stack with metamethods that ought to be inherited */ +SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L) +{ + SWIG_Lua_add_boolean(L, "__add", 1); + SWIG_Lua_add_boolean(L, "__sub", 1); + SWIG_Lua_add_boolean(L, "__mul", 1); + SWIG_Lua_add_boolean(L, "__div", 1); + SWIG_Lua_add_boolean(L, "__mod", 1); + SWIG_Lua_add_boolean(L, "__pow", 1); + SWIG_Lua_add_boolean(L, "__unm", 1); + SWIG_Lua_add_boolean(L, "__len", 1 ); + SWIG_Lua_add_boolean(L, "__concat", 1 ); + SWIG_Lua_add_boolean(L, "__eq", 1); + SWIG_Lua_add_boolean(L, "__lt", 1); + SWIG_Lua_add_boolean(L, "__le", 1); + SWIG_Lua_add_boolean(L, "__call", 1); + SWIG_Lua_add_boolean(L, "__tostring", 1); + SWIG_Lua_add_boolean(L, "__gc", 0); +} + +/* creates the swig registry */ +SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L) +{ + /* create main SWIG registry table */ + lua_pushstring(L,"SWIG"); + lua_newtable(L); + /* populate it with some predefined data */ + + /* .library table. Placeholder */ + lua_pushstring(L,".library"); + lua_newtable(L); + { + /* list of metamethods that class inherits from its bases */ + lua_pushstring(L,"inheritable_metamethods"); + lua_newtable(L); + /* populate with list of metamethods */ + SWIG_Lua_populate_inheritable_metamethods(L); + lua_rawset(L,-3); + } + lua_rawset(L,-3); + + lua_rawset(L,LUA_REGISTRYINDEX); +} + +/* gets the swig registry (or creates it) */ +SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L) +{ + /* add this all into the swig registry: */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ + if (!lua_istable(L,-1)) /* not there */ + { /* must be first time, so add it */ + lua_pop(L,1); /* remove the result */ + SWIG_Lua_create_class_registry(L); + /* then get it */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); + } +} + +SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L) +{ + SWIG_Lua_get_class_registry(L); + lua_pushstring(L, ".library"); + lua_rawget(L,-2); + assert( !lua_isnil(L,-1) ); + lua_pushstring(L, "inheritable_metamethods"); + lua_rawget(L,-2); + + /* Remove class registry and library table */ + lua_remove(L,-2); + lua_remove(L,-2); +} + +/* Helper function to get the classes metatable from the register */ +SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname) +{ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,cname); /* get the name */ + lua_rawget(L,-2); /* get it */ + lua_remove(L,-2); /* tidy up (remove registry) */ +} + +/* Set up the base classes pointers. +Each class structure has a list of pointers to the base class structures. +This function fills them. +It cannot be done at compile time, as this will not work with hireachies +spread over more than one swig file. +Therefore it must be done at runtime, querying the SWIG type system. +*/ +SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss) +{ + int i=0; + swig_module_info *module=SWIG_GetModule(L); + for(i=0;clss->base_names[i];i++) + { + if (clss->bases[i]==0) /* not found yet */ + { + /* lookup and cache the base class */ + swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); + if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; + } + } +} + +#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) +/* Merges two tables */ +SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source) +{ + /* iterating */ + lua_pushnil(L); + while (lua_next(L,source) != 0) { + /* -1 - value, -2 - index */ + /* have to copy to assign */ + lua_pushvalue(L,-2); /* copy of index */ + lua_pushvalue(L,-2); /* copy of value */ + lua_rawset(L, target); + lua_pop(L,1); + /* only key is left */ + } +} + +/* Merges two tables with given name. original - index of target metatable, base - index of source metatable */ +SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base) +{ + /* push original[name], then base[name] */ + lua_pushstring(L,name); + lua_rawget(L,original); + int original_table = lua_gettop(L); + lua_pushstring(L,name); + lua_rawget(L,base); + int base_table = lua_gettop(L); + SWIG_Lua_merge_tables_by_index(L, original_table, base_table); + /* clearing stack */ + lua_pop(L,2); +} + +/* Function takes all symbols from base and adds it to derived class. It's just a helper. */ +SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls) +{ + /* There is one parameter - original, i.e. 'derived' class metatable */ + assert(lua_istable(L,-1)); + int original = lua_gettop(L); + SWIG_Lua_get_class_metatable(L,base_cls->fqname); + int base = lua_gettop(L); + SWIG_Lua_merge_tables(L, ".fn", original, base ); + SWIG_Lua_merge_tables(L, ".set", original, base ); + SWIG_Lua_merge_tables(L, ".get", original, base ); + lua_pop(L,1); +} + +/* Function squashes all symbols from 'clss' bases into itself */ +SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss) +{ + int i; + SWIG_Lua_get_class_metatable(L,clss->fqname); + for(i=0;clss->base_names[i];i++) + { + if (clss->bases[i]==0) /* Somehow it's not found. Skip it */ + continue; + /* Thing is: all bases are already registered. Thus they have already executed + * this function. So we just need to squash them into us, because their bases + * are already squashed into them. No need for recursion here! + */ + SWIG_Lua_class_squash_base(L, clss->bases[i]); + } + lua_pop(L,1); /*tidy stack*/ +} +#endif + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */ +/* helper add a variable to a registered class */ +SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn) +{ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } +} + +/* helper to recursively add class static details (static attributes, operations and constants) */ +SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss) +{ + int i = 0; + /* The class namespace table must be on the top of the stack */ + assert(lua_istable(L,-1)); + /* call all the base classes first: we can then override these later: */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_add_class_static_details(L,clss->bases[i]); + } + + SWIG_Lua_add_namespace_details(L, clss->cls_static); +} + +SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */ + +/* helper to recursively add class details (attributes & operations) */ +SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss) +{ + int i; + size_t bases_count = 0; + /* Add bases to .bases table */ + SWIG_Lua_get_table(L,".bases"); + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname); + /* Base class must be already registered */ + assert(lua_istable(L,-1)); + lua_rawseti(L,-2,i+1); /* In lua indexing starts from 1 */ + bases_count++; + } + assert(lua_rawlen(L,-1) == bases_count); + lua_pop(L,1); /* remove .bases table */ + /* add attributes */ + for(i=0;clss->attributes[i].name;i++){ + SWIG_Lua_add_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); + } + /* add methods to the metatable */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;clss->methods[i].name;i++){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].func); + } + lua_pop(L,1); /* tidy stack (remove table) */ + /* add operator overloads + This adds methods from metatable array to metatable. Can mess up garbage + collectind if someone defines __gc method + */ + if(clss->metatable) { + for(i=0;clss->metatable[i].name;i++) { + SWIG_Lua_add_function(L,clss->metatable[i].name,clss->metatable[i].func); + } + } + +#if !defined(SWIG_LUA_SQUASH_BASES) + /* Adding metamethods that are defined in base classes. If bases were squashed + * then it is obviously unnecessary + */ + SWIG_Lua_add_class_user_metamethods(L, clss); +#endif +} + +/* Helpers to add user defined class metamedhods - __add, __sub etc. The helpers are needed + for the following issue: Lua runtime checks for metamethod existence with rawget function + ignoring our SWIG-provided __index and __newindex functions. Thus our inheritance-aware method + search algorithm doesn't work in such case. (Not to say that Lua runtime queries metamethod directly + in metatable and not in object). + Current solution is this: if somewhere in hierarchy metamethod __x is defined, then all descendants + are automatically given a special proxy __x that calls the real __x method. + Obvious idea - to copy __x instead of creating __x-proxy is wrong because if someone changes __x in runtime, + those changes must be reflected in all descendants. +*/ + +SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/ + +/* The real function that resolves a metamethod. + * Function searches given class and all it's bases(recursively) for first instance of something that is + * not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation + * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the + * answer. + * Returns 1 if found, 0 otherwise. + * clss is class which metatable we will search for method + * metamethod_name_idx is index in L where metamethod name (as string) lies + * skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check + * is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from + * SWIG_Lua_resolve_metamethod + * */ +SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx, + int skip_check) +{ + /* This function is called recursively */ + int result = 0; + int i = 0; + + if (!skip_check) { + SWIG_Lua_get_class_metatable(L, clss->fqname); + lua_pushvalue(L, metamethod_name_idx); + lua_rawget(L,-2); + /* If this is cfunction and it is equal to SWIG_Lua_resolve_metamethod then + * this isn't the function we are looking for :) + * lua_tocfunction will return NULL if not cfunction + */ + if (!lua_isnil(L,-1) && lua_tocfunction(L,-1) != SWIG_Lua_resolve_metamethod ) { + lua_remove(L,-2); /* removing class metatable */ + return 1; + } + lua_pop(L,2); /* remove class metatable and query result */ + } + + /* Forwarding calls to bases */ + for(i=0;clss->bases[i];i++) + { + result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0); + if (result) + break; + } + + return result; +} + +/* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method + * and calls it */ +SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L) +{ + int numargs; + int metamethod_name_idx; + const swig_lua_class* clss; + int result; + + lua_checkstack(L,5); + numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */ + + /* Get upvalues from closure */ + lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/ + metamethod_name_idx = lua_gettop(L); + + lua_pushvalue(L, lua_upvalueindex(2)); + clss = (const swig_lua_class*)(lua_touserdata(L,-1)); + lua_pop(L,1); /* remove lightuserdata with clss from stack */ + + /* Actual work */ + result = SWIG_Lua_do_resolve_metamethod(L, clss, metamethod_name_idx, 1); + if (!result) { + SWIG_Lua_pushferrstring(L,"The metamethod proxy is set, but it failed to find actual metamethod. Memory corruption is most likely explanation."); + lua_error(L); + return 0; + } + + lua_remove(L,-2); /* remove metamethod key */ + lua_insert(L,1); /* move function to correct position */ + lua_call(L, numargs, LUA_MULTRET); + return lua_gettop(L); /* return all results */ +} + + +/* If given metamethod must be present in given class, then creates appropriate proxy + * Returns 1 if successfully added, 0 if not added because no base class has it, -1 + * if method is defined in the class metatable itself + */ +SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index) +{ + int key_index; + int success = 0; + int i = 0; + + /* metamethod name - on the top of the stack */ + assert(lua_isstring(L,-1)); + + key_index = lua_gettop(L); + + /* Check whether method is already defined in metatable */ + lua_pushvalue(L,key_index); /* copy of the key */ + lua_gettable(L,metatable_index); + if( !lua_isnil(L,-1) ) { + lua_pop(L,1); + return -1; + } + lua_pop(L,1); + + /* Iterating over immediate bases */ + for(i=0;clss->bases[i];i++) + { + const swig_lua_class *base = clss->bases[i]; + SWIG_Lua_get_class_metatable(L, base->fqname); + lua_pushvalue(L, key_index); + lua_rawget(L, -2); + if( !lua_isnil(L,-1) ) { + lua_pushvalue(L, key_index); + + /* Add proxy function */ + lua_pushvalue(L, key_index); /* first closure value is function name */ + lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */ + lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2); + + lua_rawset(L, metatable_index); + success = 1; + } + lua_pop(L,1); /* remove function or nil */ + lua_pop(L,1); /* remove base class metatable */ + + if( success ) + break; + } + + return success; +} + +SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss) +{ + int metatable_index; + int metamethods_info_index; + int tostring_undefined; + int eq_undefined = 0; + + SWIG_Lua_get_class_metatable(L, clss->fqname); + metatable_index = lua_gettop(L); + SWIG_Lua_get_inheritable_metamethods(L); + assert(lua_istable(L,-1)); + metamethods_info_index = lua_gettop(L); + lua_pushnil(L); /* first key */ + while(lua_next(L, metamethods_info_index) != 0 ) { + /* key at index -2, value at index -1 */ + const int is_inheritable = lua_toboolean(L,-2); + lua_pop(L,1); /* remove value - we don't need it anymore */ + + if(is_inheritable) { /* if metamethod is inheritable */ + SWIG_Lua_add_class_user_metamethod(L,clss,metatable_index); + } + } + + lua_pop(L,1); /* remove inheritable metatmethods table */ + + /* Special handling for __tostring method */ + lua_pushstring(L, "__tostring"); + lua_pushvalue(L,-1); + lua_rawget(L,metatable_index); + tostring_undefined = lua_isnil(L,-1); + lua_pop(L,1); + if( tostring_undefined ) { + lua_pushcfunction(L, SWIG_Lua_class_tostring); + lua_rawset(L, metatable_index); + } else { + lua_pop(L,1); /* remove copy of the key */ + } + + /* Special handling for __eq method */ + lua_pushstring(L, "__eq"); + lua_pushvalue(L,-1); + lua_rawget(L,metatable_index); + eq_undefined = lua_isnil(L,-1); + lua_pop(L,1); + if( eq_undefined ) { + lua_pushcfunction(L, SWIG_Lua_class_equal); + lua_rawset(L, metatable_index); + } else { + lua_pop(L,1); /* remove copy of the key */ + } + /* Warning: __index and __newindex are SWIG-defined. For user-defined operator[] + * a __getitem/__setitem method should be defined + */ + lua_pop(L,1); /* pop class metatable */ +} + +/* Register class static methods,attributes etc as well as constructor proxy */ +SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss) +{ + const int SWIGUNUSED begin = lua_gettop(L); + lua_checkstack(L,5); /* just in case */ + assert(lua_istable(L,-1)); /* just in case */ + assert(strcmp(clss->name, clss->cls_static->name) == 0); /* in class those 2 must be equal */ + + SWIG_Lua_namespace_register(L,clss->cls_static, 1); + + assert(lua_istable(L,-1)); /* just in case */ + + /* add its constructor to module with the name of the class + so you can do MyClass(...) as well as new_MyClass(...) + BUT only if a constructor is defined + (this overcomes the problem of pure virtual classes without constructors)*/ + if (clss->constructor) + { + lua_getmetatable(L,-1); + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,"__call", clss->constructor); + lua_pop(L,1); + } + + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_class_static_details(L, clss); + + /* clear stack */ + lua_pop(L,1); + assert( lua_gettop(L) == begin ); +} + +/* Performs the instance (non-static) class registration process. Metatable for class is created + * and added to the class registry. + */ +SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss) +{ + const int SWIGUNUSED begin = lua_gettop(L); + int i; + /* if name already there (class is already registered) then do nothing */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->fqname); /* get the name */ + lua_rawget(L,-2); + if(!lua_isnil(L,-1)) { + lua_pop(L,2); + assert(lua_gettop(L)==begin); + return; + } + lua_pop(L,2); /* tidy stack */ + /* Recursively initialize all bases */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_class_register_instance(L,clss->bases[i]); + } + /* Again, get registry and push name */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->fqname); /* get the name */ + lua_newtable(L); /* create the metatable */ +#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) + /* If squashing is requested, then merges all bases metatable into this one. + * It would get us all special methods: __getitem, __add etc. + * This would set .fn, .type, and other .xxx incorrectly, but we will overwrite it right away + */ + { + int new_metatable_index = lua_absindex(L,-1); + for(i=0;clss->bases[i];i++) + { + int base_metatable; + SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname); + base_metatable = lua_absindex(L,-1); + SWIG_Lua_merge_tables_by_index(L,new_metatable_index, base_metatable); + lua_pop(L,1); + } + } + /* And now we will overwrite all incorrectly set data */ +#endif + /* add string of class name called ".type" */ + lua_pushstring(L,".type"); + lua_pushstring(L,clss->fqname); + lua_rawset(L,-3); + /* add a table called bases */ + lua_pushstring(L,".bases"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + /* add manual disown method */ + SWIG_Lua_add_function(L,"__disown",SWIG_Lua_class_disown); + lua_rawset(L,-3); + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); + SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); + /* add it */ + lua_rawset(L,-3); /* metatable into registry */ + lua_pop(L,1); /* tidy stack (remove registry) */ + assert(lua_gettop(L) == begin); + +#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) + /* Now merge all symbols from .fn, .set, .get etc from bases to our tables */ + SWIG_Lua_class_squash_bases(L,clss); +#endif + SWIG_Lua_get_class_metatable(L,clss->fqname); + SWIG_Lua_add_class_instance_details(L,clss); /* recursive adding of details (atts & ops) */ + lua_pop(L,1); /* tidy stack (remove class metatable) */ + assert( lua_gettop(L) == begin ); +} + +SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss) +{ + int SWIGUNUSED begin; + assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */ + SWIG_Lua_class_register_instance(L,clss); + SWIG_Lua_class_register_static(L,clss); + + /* Add links from static part to instance part and vice versa */ + /* [SWIG registry] [Module] + * "MyClass" ----> [MyClass metatable] <===== "MyClass" -+> [static part] + * ".get" ----> ... | | getmetatable()----| + * ".set" ----> ... | | | + * ".static" --------------)----------------/ [static part metatable] + * | ".get" --> ... + * | ".set" --> .... + * |=============================== ".instance" + */ + begin = lua_gettop(L); + lua_pushstring(L,clss->cls_static->name); + lua_rawget(L,-2); /* get class static table */ + assert(lua_istable(L,-1)); + lua_getmetatable(L,-1); + assert(lua_istable(L,-1)); /* get class static metatable */ + lua_pushstring(L,".instance"); /* prepare key */ + + SWIG_Lua_get_class_metatable(L,clss->fqname); /* get class metatable */ + assert(lua_istable(L,-1)); + lua_pushstring(L,".static"); /* prepare key */ + lua_pushvalue(L, -4); /* push static class TABLE */ + assert(lua_istable(L,-1)); + lua_rawset(L,-3); /* assign static class table(!NOT metatable) as ".static" member of class metatable */ + lua_rawset(L,-3); /* assign class metatable as ".instance" member of class static METATABLE */ + lua_pop(L,2); + assert(lua_gettop(L) == begin); +} +#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */ + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) +SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss) +{ + const int SWIGUNUSED begin = lua_gettop(L); + int i; + /* if name already there (class is already registered) then do nothing */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->fqname); /* get the name */ + lua_rawget(L,-2); + if(!lua_isnil(L,-1)) { + lua_pop(L,2); + assert(lua_gettop(L)==begin); + return; + } + lua_pop(L,2); /* tidy stack */ + /* Recursively initialize all bases */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_elua_class_register_instance(L,clss->bases[i]); + } + /* Again, get registry and push name */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->fqname); /* get the name */ + assert(clss->metatable); + lua_pushrotable(L, (void*)(clss->metatable)); /* create the metatable */ + lua_rawset(L,-3); + lua_pop(L,1); + assert(lua_gettop(L) == begin); +} +#endif /* elua && eluac */ + +/* ----------------------------------------------------------------------------- + * Class/structure conversion fns + * ----------------------------------------------------------------------------- */ + +/* helper to add metatable to new lua object */ +SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type) +{ + if (type->clientdata) /* there is clientdata: so add the metatable */ + { + SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname); + if (lua_istable(L,-1)) + { + lua_setmetatable(L,-2); + } + else + { + lua_pop(L,1); + } + } +} + +/* pushes a new object into the lua stack */ +SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own) +{ + swig_lua_userdata *usr; + if (!ptr){ + lua_pushnil(L); + return; + } + usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ + usr->ptr=ptr; /* set the ptr */ + usr->type=type; + usr->own=own; +#if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) + SWIG_Lua_AddMetatable(L,type); /* add metatable */ +#endif +} + +/* takes a object from the lua stack & converts it into an object of the correct type + (if possible) */ +SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags) +{ + swig_lua_userdata *usr; + swig_cast_info *cast; + if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ + usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ + if (usr) + { + if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ + { + usr->own=0; + } + if (!type) /* special cast void*, no casting fn */ + { + *ptr=usr->ptr; + return SWIG_OK; /* ok */ + } + cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + return SWIG_OK; /* ok */ + } + } + return SWIG_ERROR; /* error */ +} + +SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State *L,int index,swig_type_info *type,int flags, + int argnum,const char *func_name){ + void *result; + if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ + luaL_error (L,"Error in %s, expected a %s at argument number %d\n", + func_name,(type && type->str)?type->str:"void*",argnum); + } + return result; +} + +/* pushes a packed userdata. user for member fn pointers only */ +SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata *raw; + assert(ptr); /* not acceptable to pass in a NULL value */ + raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ + raw->type=type; + raw->own=0; + memcpy(raw->data,ptr,size); /* copy the data */ + SWIG_Lua_AddMetatable(L,type); /* add metatable */ +} + +/* converts a packed userdata. user for member fn pointers only */ +SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata *raw; + raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ + if (!raw) return SWIG_ERROR; /* error */ + if (type==0 || type==raw->type) /* void* or identical type */ + { + memcpy(ptr,raw->data,size); /* copy it */ + return SWIG_OK; /* ok */ + } + return SWIG_ERROR; /* error */ +} + +/* a function to get the typestring of a piece of data */ +SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) +{ + swig_lua_userdata *usr; + if (lua_isuserdata(L,tp)) + { + usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */ + if (usr && usr->type && usr->type->str) + return usr->type->str; + return "userdata (unknown type)"; + } + return lua_typename(L,lua_type(L,tp)); +} + +/* lua callable function to get the userdata's type */ +SWIGRUNTIME int SWIG_Lua_type(lua_State *L) +{ + lua_pushstring(L,SWIG_Lua_typename(L,1)); + return 1; +} + +/* ----------------------------------------------------------------------------- + * global variable support code: class/struct typemap functions + * ----------------------------------------------------------------------------- */ + +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) +/* Install Constants */ +SWIGINTERN void +SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) { + int i; + for (i = 0; constants[i].type; i++) { + switch(constants[i].type) { + case SWIG_LUA_INT: + lua_pushstring(L,constants[i].name); + lua_pushinteger(L,(lua_Number)constants[i].lvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_FLOAT: + lua_pushstring(L,constants[i].name); + lua_pushnumber(L,(lua_Number)constants[i].dvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_CHAR: + lua_pushstring(L,constants[i].name); + { + char c = constants[i].lvalue; + lua_pushlstring(L,&c,1); + } + lua_rawset(L,-3); + break; + case SWIG_LUA_STRING: + lua_pushstring(L,constants[i].name); + lua_pushstring(L,(char *) constants[i].pvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_POINTER: + lua_pushstring(L,constants[i].name); + SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0); + lua_rawset(L,-3); + break; + case SWIG_LUA_BINARY: + lua_pushstring(L,constants[i].name); + SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); + lua_rawset(L,-3); + break; + default: + break; + } + } +} +#endif + +/* ----------------------------------------------------------------------------- + * executing lua code from within the wrapper + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ +#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) +#endif +/* Executes a C string in Lua which is a really simple way of calling lua from C +Unfortunately lua keeps changing its APIs, so we need a conditional compile +In lua 5.0.X it's lua_dostring() +In lua 5.1.X it's luaL_dostring() +*/ +SWIGINTERN int +SWIG_Lua_dostring(lua_State *L, const char *str) { + int ok,top; + if (str==0 || str[0]==0) return 0; /* nothing to do */ + top=lua_gettop(L); /* save stack */ +#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) + ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ +#else + ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ +#endif + if (ok!=0) { + SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); + } + lua_settop(L,top); /* restore the stack */ + return ok; +} + +#ifdef __cplusplus +} +#endif + +/* ------------------------------ end luarun.swg ------------------------------ */
diff --git a/share/swig/2.0.11/lua/luaruntime.swg b/share/swig/3.0.12/lua/luaruntime.swg similarity index 71% rename from share/swig/2.0.11/lua/luaruntime.swg rename to share/swig/3.0.12/lua/luaruntime.swg index 423c719..8df46e8 100644 --- a/share/swig/2.0.11/lua/luaruntime.swg +++ b/share/swig/3.0.12/lua/luaruntime.swg
@@ -29,27 +29,18 @@ { #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) /* valid for both Lua and eLua */ int i; + int globalRegister = 0; /* start with global table */ lua_pushglobaltable (L); - /* SWIG's internal initalisation */ + /* SWIG's internal initialisation */ SWIG_InitializeModule((void*)L); SWIG_PropagateClientData(); #endif -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) +#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) || defined(SWIG_LUA_ELUA_EMULATE) /* add a global fn */ SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); - SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); - /* begin the module (its a table with the same name as the module) */ - SWIG_Lua_module_begin(L,SWIG_name); - /* add commands/functions */ - for (i = 0; swig_commands[i].name; i++){ - SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); - } - /* add variables */ - for (i = 0; swig_variables[i].name; i++){ - SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); - } + SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_class_equal); #endif #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC) @@ -59,17 +50,34 @@ SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata)); } } - /* additional registration structs & classes in lua */ +#ifdef SWIG_LUA_MODULE_GLOBAL + globalRegister = 1; +#endif + + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) + SWIG_Lua_namespace_register(L,&swig_SwigModule, globalRegister); +#endif + +#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC) for (i = 0; swig_types[i]; i++){ if (swig_types[i]->clientdata){ - SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); + SWIG_Lua_elua_class_register_instance(L,(swig_lua_class*)(swig_types[i]->clientdata)); } } #endif -#if ((SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUA) && (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)) - /* constants */ - SWIG_Lua_InstallConstants(L,swig_constants); +#if defined(SWIG_LUA_ELUA_EMULATE) + lua_newtable(L); + SWIG_Lua_elua_emulate_register(L,swig_SwigModule.ns_methods); + SWIG_Lua_elua_emulate_register_clear(L); + if(globalRegister) { + lua_pushstring(L,swig_SwigModule.name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } +#endif + #endif #if (SWIG_LUA_TARGET != SWIG_LUA_FLAVOR_ELUAC)
diff --git a/share/swig/2.0.11/lua/luatypemaps.swg b/share/swig/3.0.12/lua/luatypemaps.swg similarity index 93% rename from share/swig/2.0.11/lua/luatypemaps.swg rename to share/swig/3.0.12/lua/luatypemaps.swg index f6791a2..5d98e61 100644 --- a/share/swig/2.0.11/lua/luatypemaps.swg +++ b/share/swig/3.0.12/lua/luatypemaps.swg
@@ -68,8 +68,12 @@ // and const refs %typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &($basetype temp) %{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%} +%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &&($basetype temp) +%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%} %typemap(out) const enum SWIGTYPE & %{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%} +%typemap(out) const enum SWIGTYPE && +%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%} // boolean (which is a special type in lua) @@ -118,14 +122,14 @@ %{$1 = (lua_tostring(L, $input))[0];%} %typemap(out) char -%{ lua_pushfstring(L,"%c",$1); SWIG_arg++;%} +%{ lua_pushlstring(L, &$1, 1); SWIG_arg++;%} // by const ref %typemap(in,checkfn="SWIG_lua_isnilstring",fragment="SWIG_lua_isnilstring") const char& (char temp) %{temp = (lua_tostring(L, $input))[0]; $1=&temp;%} %typemap(out) const char& -%{ lua_pushfstring(L,"%c",*$1); SWIG_arg++;%} +%{ lua_pushlstring(L, $1, 1); SWIG_arg++;%} // pointers and references // under SWIG rules, it is ok, to have a pass in a lua nil, @@ -147,9 +151,18 @@ } %} +%typemap(in,checkfn="lua_isuserdata") SWIGTYPE&& +%{ + if (!SWIG_IsOK(SWIG_ConvertPtr(L,$input,(void**)&$1,$descriptor,$disown))){ + SWIG_fail_ptr("$symname",$argnum,$descriptor); + } +%} + // out is simple %typemap(out) SWIGTYPE*,SWIGTYPE& %{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %} +%typemap(out) SWIGTYPE*,SWIGTYPE&& +%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %} // dynamic casts // this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is @@ -284,7 +297,7 @@ const unsigned int &, const unsigned short &, const unsigned long &, const signed char&, const unsigned char&, const long long &, const unsigned long long &, - enum SWIGTYPE, const enum SWIGTYPE&, + enum SWIGTYPE, const enum SWIGTYPE&, const enum SWIGTYPE &&, float, double, const float &, const double& { $1 = lua_isnumber(L,$input); @@ -323,6 +336,15 @@ } } +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && { + void *ptr; + if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) { + $1 = 0; + } else { + $1 = 1; + } +} + %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { void *ptr; if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) { @@ -360,6 +382,7 @@ // Array reference typemaps %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/lua/std_common.i b/share/swig/3.0.12/lua/std_common.i similarity index 100% rename from share/swig/2.0.11/lua/std_common.i rename to share/swig/3.0.12/lua/std_common.i
diff --git a/share/swig/2.0.11/lua/std_deque.i b/share/swig/3.0.12/lua/std_deque.i similarity index 100% rename from share/swig/2.0.11/lua/std_deque.i rename to share/swig/3.0.12/lua/std_deque.i
diff --git a/share/swig/2.0.11/lua/std_except.i b/share/swig/3.0.12/lua/std_except.i similarity index 94% rename from share/swig/2.0.11/lua/std_except.i rename to share/swig/3.0.12/lua/std_except.i index 1608287..34ab6a1 100644 --- a/share/swig/2.0.11/lua/std_except.i +++ b/share/swig/3.0.12/lua/std_except.i
@@ -8,6 +8,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <typeinfo> #include <stdexcept> %} %include <exception.i> @@ -27,6 +28,7 @@ // normally objects which are thrown are returned to the interpreter as errors // (which potentially may have problems if they are not copied) // therefore all classes based upon std::exception are converted to their strings & returned as errors +%typemap(throws) std::bad_cast "SWIG_exception(SWIG_TypeError, $1.what());" %typemap(throws) std::bad_exception "SWIG_exception(SWIG_RuntimeError, $1.what());" %typemap(throws) std::domain_error "SWIG_exception(SWIG_ValueError, $1.what());" %typemap(throws) std::exception "SWIG_exception(SWIG_SystemError, $1.what());"
diff --git a/share/swig/2.0.11/lua/std_map.i b/share/swig/3.0.12/lua/std_map.i similarity index 100% rename from share/swig/2.0.11/lua/std_map.i rename to share/swig/3.0.12/lua/std_map.i
diff --git a/share/swig/2.0.11/lua/std_pair.i b/share/swig/3.0.12/lua/std_pair.i similarity index 100% rename from share/swig/2.0.11/lua/std_pair.i rename to share/swig/3.0.12/lua/std_pair.i
diff --git a/share/swig/2.0.11/lua/std_string.i b/share/swig/3.0.12/lua/std_string.i similarity index 100% rename from share/swig/2.0.11/lua/std_string.i rename to share/swig/3.0.12/lua/std_string.i
diff --git a/share/swig/2.0.11/lua/std_vector.i b/share/swig/3.0.12/lua/std_vector.i similarity index 100% rename from share/swig/2.0.11/lua/std_vector.i rename to share/swig/3.0.12/lua/std_vector.i
diff --git a/share/swig/2.0.11/lua/stl.i b/share/swig/3.0.12/lua/stl.i similarity index 100% rename from share/swig/2.0.11/lua/stl.i rename to share/swig/3.0.12/lua/stl.i
diff --git a/share/swig/2.0.11/lua/typemaps.i b/share/swig/3.0.12/lua/typemaps.i similarity index 99% rename from share/swig/2.0.11/lua/typemaps.i rename to share/swig/3.0.12/lua/typemaps.i index 7a095a1..c662cd3 100644 --- a/share/swig/2.0.11/lua/typemaps.i +++ b/share/swig/3.0.12/lua/typemaps.i
@@ -296,7 +296,7 @@ for array handling */ %define SWIG_TYPEMAP_NUM_ARR(NAME,TYPE) -%{SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE);%} +%{SWIG_DECLARE_TYPEMAP_ARR_FN(NAME,TYPE)%} // fixed size array's %typemap(in) TYPE INPUT[ANY]
diff --git a/share/swig/2.0.11/lua/wchar.i b/share/swig/3.0.12/lua/wchar.i similarity index 91% rename from share/swig/2.0.11/lua/wchar.i rename to share/swig/3.0.12/lua/wchar.i index 141ecc4..9f3be6f 100644 --- a/share/swig/2.0.11/lua/wchar.i +++ b/share/swig/3.0.12/lua/wchar.i
@@ -16,9 +16,9 @@ { wchar_t* p; if (str==0 || len<1) return 0; - p=(wchar *)malloc((len+1)*sizeof(wchar_t)); + p=(wchar_t *)malloc((len+1)*sizeof(wchar_t)); if (p==0) return 0; - if (mbstowcs(p, str, len)==-1) + if (mbstowcs(p, str, len)==(size_t)-1) { free(p); return 0;
diff --git a/share/swig/2.0.11/math.i b/share/swig/3.0.12/math.i similarity index 100% rename from share/swig/2.0.11/math.i rename to share/swig/3.0.12/math.i
diff --git a/share/swig/2.0.11/modula3/modula3.swg b/share/swig/3.0.12/modula3/modula3.swg similarity index 93% rename from share/swig/2.0.11/modula3/modula3.swg rename to share/swig/3.0.12/modula3/modula3.swg index 3affdd0..262f8ea 100644 --- a/share/swig/2.0.11/modula3/modula3.swg +++ b/share/swig/3.0.12/modula3/modula3.swg
@@ -344,6 +344,23 @@ %typemap(m3wrapouttype) SWIGTYPE & "$1_basetype" %typemap(m3wraprettype) SWIGTYPE & "UNTRACED REF $1_basetype" +%typemap(ctype) SWIGTYPE && "$1_type" +%typemap(m3rawtype) const SWIGTYPE && "UNTRACED REF $1_basetype" +%typemap(m3rawtype) SWIGTYPE && "UNTRACED REF $1_basetype" +%typemap(m3rawintype) const SWIGTYPE && "$1_basetype" +%typemap(m3rawinmode) const SWIGTYPE && "READONLY" +%typemap(m3rawintype) SWIGTYPE && "$1_basetype" +%typemap(m3rawinmode) SWIGTYPE && "VAR" +%typemap(m3rawrettype) const SWIGTYPE && "UNTRACED REF $1_basetype" +%typemap(m3rawrettype) SWIGTYPE && "UNTRACED REF $1_basetype" +%typemap(m3wraptype) SWIGTYPE && "$1_basetype" +%typemap(m3wrapintype) const SWIGTYPE && "$1_basetype" +%typemap(m3wrapinmode) const SWIGTYPE && "READONLY" +%typemap(m3wrapintype) SWIGTYPE && "$1_basetype" +%typemap(m3wrapinmode) SWIGTYPE && "VAR" +%typemap(m3wrapouttype) SWIGTYPE && "$1_basetype" +%typemap(m3wraprettype) SWIGTYPE && "UNTRACED REF $1_basetype" + %typemap(ctype) enum SWIGTYPE "$1_type" %typemap(m3rawtype) enum SWIGTYPE "C.int" %typemap(m3rawintype) enum SWIGTYPE "C.int (* $1_type *)" @@ -468,7 +485,12 @@ //SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); RETURN $null; } %} -%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %} +%typemap(in) SWIGTYPE && %{ $1 = *($&1_ltype)&$input; + if(!$1) { + //SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null"); + RETURN $null; + } %} +%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %} /* Default array handling */ @@ -552,6 +574,7 @@ SWIGTYPE, SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" @@ -605,7 +628,7 @@ enum SWIGTYPE "$input" %typemap(m3in) SWIGTYPE "$&*1_type.getCPtr($input)" -%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)" +%typemap(m3in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "$1_basetype.getCPtr($input)" /* The m3out typemap is used for converting function return types from the return type * used in the PInvoke class to the type returned by the proxy, module or type wrapper class. */ @@ -636,13 +659,16 @@ %typemap(m3out) SWIGTYPE & %{ RETURN NEW($1_basetype, $imcall, $owner); %} +%typemap(m3out) SWIGTYPE && %{ + RETURN NEW($1_basetype, $imcall, $owner); +%} %typemap(m3out) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ cPtr := $imcall; RETURN (cPtr = IntPtr.Zero) ? null : NEW($1_basetype, cPtr, $owner); %} /* Properties */ -%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ +%typemap(m3varin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ PROCEDURE Set$var (value: $vartype) = BEGIN $imcall; @@ -684,6 +710,10 @@ get { RETURN new $1_basetype($imcall, $owner); } %} +%typemap(m3varout) SWIGTYPE && %{ + get { + RETURN new $1_basetype($imcall, $owner); + } %} %typemap(m3varout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ get { IntPtr cPtr = $imcall; @@ -691,13 +721,13 @@ } %} /* Typemaps used for the generation of proxy and type wrapper class code */ -%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public" -%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;" +%typemap(m3base) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(m3classmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public" +%typemap(m3code) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(m3imports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;" %typemap(m3interfaces) SWIGTYPE "IDisposable" -%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal" +%typemap(m3interfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "" +%typemap(m3ptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal" %typemap(m3finalize) SWIGTYPE %{ ~$1_basetype() { @@ -724,7 +754,7 @@ base.Dispose(); } -%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ +%typemap(m3getcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ internal static IntPtr getCPtr($1_basetype obj) { RETURN (obj == null) ? IntPtr.Zero : obj.swigCPtr; } @@ -748,6 +778,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/modula3/modula3head.swg b/share/swig/3.0.12/modula3/modula3head.swg similarity index 100% rename from share/swig/2.0.11/modula3/modula3head.swg rename to share/swig/3.0.12/modula3/modula3head.swg
diff --git a/share/swig/2.0.11/modula3/typemaps.i b/share/swig/3.0.12/modula3/typemaps.i similarity index 100% rename from share/swig/2.0.11/modula3/typemaps.i rename to share/swig/3.0.12/modula3/typemaps.i
diff --git a/share/swig/2.0.11/mzscheme/mzrun.swg b/share/swig/3.0.12/mzscheme/mzrun.swg similarity index 100% rename from share/swig/2.0.11/mzscheme/mzrun.swg rename to share/swig/3.0.12/mzscheme/mzrun.swg
diff --git a/share/swig/2.0.11/mzscheme/mzscheme.swg b/share/swig/3.0.12/mzscheme/mzscheme.swg similarity index 100% rename from share/swig/2.0.11/mzscheme/mzscheme.swg rename to share/swig/3.0.12/mzscheme/mzscheme.swg
diff --git a/share/swig/2.0.11/mzscheme/std_common.i b/share/swig/3.0.12/mzscheme/std_common.i similarity index 73% rename from share/swig/2.0.11/mzscheme/std_common.i rename to share/swig/3.0.12/mzscheme/std_common.i index 1f1ae1a..a83e273 100644 --- a/share/swig/2.0.11/mzscheme/std_common.i +++ b/share/swig/3.0.12/mzscheme/std_common.i
@@ -11,10 +11,13 @@ %{ #include <string> -std::string swig_scm_to_string(Scheme_Object* x) { +SWIGINTERNINLINE +std::string swig_scm_to_string(Scheme_Object *x) { return std::string(SCHEME_STR_VAL(x)); } -Scheme_Object* swig_make_string(const std::string& s) { + +SWIGINTERNINLINE +Scheme_Object *swig_make_string(const std::string &s) { return scheme_make_string(s.c_str()); } %}
diff --git a/share/swig/2.0.11/mzscheme/std_deque.i b/share/swig/3.0.12/mzscheme/std_deque.i similarity index 100% rename from share/swig/2.0.11/mzscheme/std_deque.i rename to share/swig/3.0.12/mzscheme/std_deque.i
diff --git a/share/swig/2.0.11/mzscheme/std_map.i b/share/swig/3.0.12/mzscheme/std_map.i similarity index 100% rename from share/swig/2.0.11/mzscheme/std_map.i rename to share/swig/3.0.12/mzscheme/std_map.i
diff --git a/share/swig/2.0.11/mzscheme/std_pair.i b/share/swig/3.0.12/mzscheme/std_pair.i similarity index 100% rename from share/swig/2.0.11/mzscheme/std_pair.i rename to share/swig/3.0.12/mzscheme/std_pair.i
diff --git a/share/swig/2.0.11/mzscheme/std_string.i b/share/swig/3.0.12/mzscheme/std_string.i similarity index 100% rename from share/swig/2.0.11/mzscheme/std_string.i rename to share/swig/3.0.12/mzscheme/std_string.i
diff --git a/share/swig/2.0.11/mzscheme/std_vector.i b/share/swig/3.0.12/mzscheme/std_vector.i similarity index 100% rename from share/swig/2.0.11/mzscheme/std_vector.i rename to share/swig/3.0.12/mzscheme/std_vector.i
diff --git a/share/swig/2.0.11/mzscheme/stl.i b/share/swig/3.0.12/mzscheme/stl.i similarity index 100% rename from share/swig/2.0.11/mzscheme/stl.i rename to share/swig/3.0.12/mzscheme/stl.i
diff --git a/share/swig/2.0.11/mzscheme/typemaps.i b/share/swig/3.0.12/mzscheme/typemaps.i similarity index 96% rename from share/swig/2.0.11/mzscheme/typemaps.i rename to share/swig/3.0.12/mzscheme/typemaps.i index 4078026..9346349 100644 --- a/share/swig/2.0.11/mzscheme/typemaps.i +++ b/share/swig/3.0.12/mzscheme/typemaps.i
@@ -23,6 +23,10 @@ $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); } +%typemap(varin) SWIGTYPE && { + $1 = *(($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0)); +} + %typemap(varin) SWIGTYPE [ANY] { void *temp; int ii; @@ -54,16 +58,20 @@ $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); } +%typemap(varout) SWIGTYPE && { + $result = SWIG_NewPointerObj((void *) &$1, $1_descriptor, 0); +} + /* C++ References */ #ifdef __cplusplus -%typemap(in) SWIGTYPE &, const SWIGTYPE & { +%typemap(in) SWIGTYPE &, SWIGTYPE && { $1 = ($ltype) SWIG_MustGetPtr($input, $descriptor, $argnum, 0); if ($1 == NULL) scheme_signal_error("swig-type-error (null reference)"); } -%typemap(out) SWIGTYPE &, const SWIGTYPE & { +%typemap(out) SWIGTYPE &, SWIGTYPE && { $result = SWIG_NewPointerObj ($1, $descriptor, $owner); } @@ -321,7 +329,7 @@ $1 = (SCHEME_STRINGP($input)) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; if (SWIG_ConvertPtr($input, (void **) &ptr, $1_descriptor, 0)) { $1 = 0; @@ -351,6 +359,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/ocaml/carray.i b/share/swig/3.0.12/ocaml/carray.i similarity index 100% rename from share/swig/2.0.11/ocaml/carray.i rename to share/swig/3.0.12/ocaml/carray.i
diff --git a/share/swig/2.0.11/ocaml/class.swg b/share/swig/3.0.12/ocaml/class.swg similarity index 100% rename from share/swig/2.0.11/ocaml/class.swg rename to share/swig/3.0.12/ocaml/class.swg
diff --git a/share/swig/2.0.11/ocaml/cstring.i b/share/swig/3.0.12/ocaml/cstring.i similarity index 100% rename from share/swig/2.0.11/ocaml/cstring.i rename to share/swig/3.0.12/ocaml/cstring.i
diff --git a/share/swig/2.0.11/ocaml/director.swg b/share/swig/3.0.12/ocaml/director.swg similarity index 63% rename from share/swig/2.0.11/ocaml/director.swg rename to share/swig/3.0.12/ocaml/director.swg index 77b2fd3..158cbfe 100644 --- a/share/swig/2.0.11/ocaml/director.swg +++ b/share/swig/3.0.12/ocaml/director.swg
@@ -1,45 +1,47 @@ /* ----------------------------------------------------------------------------- * director.swg * - * This file contains support for director classes that proxy - * method calls from C++ to Ocaml extensions. - * + * This file contains support for director classes so that Ocaml proxy + * methods can be called from C++. * ----------------------------------------------------------------------------- */ -#ifdef __cplusplus - #include <string> +#include <exception> # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) namespace Swig { /* base class for director exceptions */ - class DirectorException { + class DirectorException : public std::exception { protected: std::string swig_msg; - public: - DirectorException(const char* msg="") { - } - const char *getMessage() const { - return swig_msg.c_str(); - } - virtual ~DirectorException() {} - }; - /* type mismatch in the return value from a python method call */ - class DirectorTypeMismatchException : public Swig::DirectorException { public: - DirectorTypeMismatchException(const char* msg="") { + DirectorException(const char *msg="") : swig_msg(msg) { + } + + virtual ~DirectorException() throw() { + } + + const char *what() const throw() { + return swig_msg.c_str(); } }; - /* any python exception that occurs during a director method call */ - class DirectorMethodException : public Swig::DirectorException {}; + /* type mismatch in the return value from a Ocaml method call */ + class DirectorTypeMismatchException : public DirectorException { + public: + DirectorTypeMismatchException(const char *msg="") : DirectorException(msg) { + } + }; + + /* any Ocaml exception that occurs during a director method call */ + class DirectorMethodException : public DirectorException {}; /* attempt to call a pure virtual method via a director method */ - class DirectorPureVirtualException : public Swig::DirectorException { + class DirectorPureVirtualException : public DirectorException { public: - DirectorPureVirtualException(const char* msg="") { + DirectorPureVirtualException(const char *msg="") : DirectorException(msg) { } static void raise(const char *msg) { @@ -57,7 +59,7 @@ #define MUTEX_INIT(var) CRITICAL_SECTION var #else #include <pthread.h> -#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER +#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER #endif #endif @@ -70,7 +72,7 @@ mutable bool swig_disown_flag; public: - /* wrap a ocaml object, optionally taking ownership */ + /* wrap a ocaml object. */ Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) { register_global_root(&swig_self); } @@ -78,25 +80,22 @@ /* discard our reference at destruction */ virtual ~Director() { remove_global_root(&swig_self); - swig_disown(); - // Disown is safe here because we're just divorcing a reference that - // points to us. + swig_disown(); + // Disown is safe here because we're just divorcing a reference that points to us. } /* return a pointer to the wrapped ocaml object */ - CAML_VALUE swig_get_self() const { + CAML_VALUE swig_get_self() const { return swig_self; } - /* acquire ownership of the wrapped ocaml object (the sense of "disown" - * is from ocaml) */ - void swig_disown() const { - if (!swig_disown_flag) { + /* acquire ownership of the wrapped ocaml object (the sense of "disown" is from ocaml) */ + void swig_disown() const { + if (!swig_disown_flag) { swig_disown_flag=true; callback(*caml_named_value("caml_obj_disown"),swig_self); - } + } } }; } -#endif /* __cplusplus */
diff --git a/share/swig/2.0.11/ocaml/ocaml.i b/share/swig/3.0.12/ocaml/ocaml.i similarity index 100% rename from share/swig/2.0.11/ocaml/ocaml.i rename to share/swig/3.0.12/ocaml/ocaml.i
diff --git a/share/swig/2.0.11/ocaml/ocaml.swg b/share/swig/3.0.12/ocaml/ocaml.swg similarity index 100% rename from share/swig/2.0.11/ocaml/ocaml.swg rename to share/swig/3.0.12/ocaml/ocaml.swg
diff --git a/share/swig/2.0.11/ocaml/ocamldec.swg b/share/swig/3.0.12/ocaml/ocamldec.swg similarity index 98% rename from share/swig/2.0.11/ocaml/ocamldec.swg rename to share/swig/3.0.12/ocaml/ocamldec.swg index e6b8939..96e1cd2 100644 --- a/share/swig/2.0.11/ocaml/ocamldec.swg +++ b/share/swig/3.0.12/ocaml/ocamldec.swg
@@ -130,7 +130,7 @@ SWIGSTATIC CAML_VALUE caml_array_new( int n ); SWIGSTATIC void caml_array_set( CAML_VALUE arr, int n, CAML_VALUE item ); SWIGSTATIC CAML_VALUE caml_array_nth( CAML_VALUE arr, int n ); - SWIGSTATIC int caml_array_length( CAML_VALUE arr ); + SWIGSTATIC int caml_array_len( CAML_VALUE arr ); SWIGSTATIC CAML_VALUE caml_val_char( char c ); SWIGSTATIC CAML_VALUE caml_val_uchar( unsigned char c ); @@ -165,5 +165,3 @@ #ifdef __cplusplus } #endif - -/* mzschemedec.swg ends here */
diff --git a/share/swig/2.0.11/ocaml/ocamlkw.swg b/share/swig/3.0.12/ocaml/ocamlkw.swg similarity index 100% rename from share/swig/2.0.11/ocaml/ocamlkw.swg rename to share/swig/3.0.12/ocaml/ocamlkw.swg
diff --git a/share/swig/2.0.11/ocaml/preamble.swg b/share/swig/3.0.12/ocaml/preamble.swg similarity index 100% rename from share/swig/2.0.11/ocaml/preamble.swg rename to share/swig/3.0.12/ocaml/preamble.swg
diff --git a/share/swig/3.0.12/ocaml/std_common.i b/share/swig/3.0.12/ocaml/std_common.i new file mode 100644 index 0000000..6523af0 --- /dev/null +++ b/share/swig/3.0.12/ocaml/std_common.i
@@ -0,0 +1,22 @@ +/* ----------------------------------------------------------------------------- + * std_common.i + * + * SWIG typemaps for STL - common utilities + * ----------------------------------------------------------------------------- */ + +%include <std/std_except.i> + +%apply size_t { std::size_t }; + +%{ +#include <string> +SWIGINTERNINLINE +CAML_VALUE SwigString_FromString(const std::string &s) { + return caml_val_string((char *)s.c_str()); +} + +SWIGINTERNINLINE +std::string SwigString_AsString(CAML_VALUE o) { + return std::string((char *)caml_ptr_val(o,0)); +} +%}
diff --git a/share/swig/2.0.11/ocaml/std_complex.i b/share/swig/3.0.12/ocaml/std_complex.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_complex.i rename to share/swig/3.0.12/ocaml/std_complex.i
diff --git a/share/swig/2.0.11/ocaml/std_deque.i b/share/swig/3.0.12/ocaml/std_deque.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_deque.i rename to share/swig/3.0.12/ocaml/std_deque.i
diff --git a/share/swig/2.0.11/ocaml/std_list.i b/share/swig/3.0.12/ocaml/std_list.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_list.i rename to share/swig/3.0.12/ocaml/std_list.i
diff --git a/share/swig/2.0.11/ocaml/std_map.i b/share/swig/3.0.12/ocaml/std_map.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_map.i rename to share/swig/3.0.12/ocaml/std_map.i
diff --git a/share/swig/2.0.11/ocaml/std_pair.i b/share/swig/3.0.12/ocaml/std_pair.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_pair.i rename to share/swig/3.0.12/ocaml/std_pair.i
diff --git a/share/swig/2.0.11/ocaml/std_string.i b/share/swig/3.0.12/ocaml/std_string.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_string.i rename to share/swig/3.0.12/ocaml/std_string.i
diff --git a/share/swig/2.0.11/ocaml/std_vector.i b/share/swig/3.0.12/ocaml/std_vector.i similarity index 100% rename from share/swig/2.0.11/ocaml/std_vector.i rename to share/swig/3.0.12/ocaml/std_vector.i
diff --git a/share/swig/2.0.11/ocaml/stl.i b/share/swig/3.0.12/ocaml/stl.i similarity index 100% rename from share/swig/2.0.11/ocaml/stl.i rename to share/swig/3.0.12/ocaml/stl.i
diff --git a/share/swig/2.0.11/ocaml/swig.ml b/share/swig/3.0.12/ocaml/swig.ml similarity index 100% rename from share/swig/2.0.11/ocaml/swig.ml rename to share/swig/3.0.12/ocaml/swig.ml
diff --git a/share/swig/2.0.11/ocaml/swig.mli b/share/swig/3.0.12/ocaml/swig.mli similarity index 100% rename from share/swig/2.0.11/ocaml/swig.mli rename to share/swig/3.0.12/ocaml/swig.mli
diff --git a/share/swig/3.0.12/ocaml/swigp4.ml b/share/swig/3.0.12/ocaml/swigp4.ml new file mode 100644 index 0000000..2f6074a --- /dev/null +++ b/share/swig/3.0.12/ocaml/swigp4.ml
@@ -0,0 +1,135 @@ +open Camlp4 + +module Id : Sig.Id = +struct + let name = "swigp4" + let version = "0.1" +end + +module Make (Syntax : Sig.Camlp4Syntax) = +struct + open Sig + include Syntax + + let _loc = Loc.ghost + let lap x y = x :: y + let c_ify e loc = + match e with + <:expr< $int:_$ >> -> <:expr< (C_int $e$) >> + | <:expr< $str:_$ >> -> <:expr< (C_string $e$) >> + | <:expr< $chr:_$ >> -> <:expr< (C_char $e$) >> + | <:expr< $flo:_$ >> -> <:expr< (C_double $e$) >> + | <:expr< True >> -> <:expr< (C_bool $e$) >> + | <:expr< False >> -> <:expr< (C_bool $e$) >> + | _ -> <:expr< $e$ >> + let mk_list args loc f = + let rec mk_list_inner args loc f = + match args with + [] -> <:expr< [] >> + | x :: xs -> + (let loc = Ast.loc_of_expr x in + <:expr< [ ($f x _loc$) ] @ ($mk_list_inner xs loc f$) >>) in + match args with + [] -> <:expr< (Obj.magic C_void) >> + | [ a ] -> <:expr< (Obj.magic $f a _loc$) >> + | _ -> <:expr< (Obj.magic (C_list ($mk_list_inner args loc f$))) >> ;; + + EXTEND Gram + GLOBAL: expr; + + expr: LEVEL "top" + [ [ e1 = expr ; "'" ; "[" ; e2 = expr ; "]" -> + <:expr< (invoke $e1$) "[]" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "->" ; l = LIDENT ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke $e1$) $str:l$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "->" ; u = UIDENT ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke $e1$) $str:u$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "->" ; s = expr LEVEL "simple" ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke $e1$) $s$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "'" ; "." ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke $e1$) "()" ($mk_list args _loc c_ify$) >> + | e1 = expr ; "'" ; "->" ; l = LIDENT ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke ((invoke $e1$) "->" C_void)) $str:l$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "'" ; "->" ; u = UIDENT ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke ((invoke $e1$) "->" C_void)) $str:u$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "'" ; "->" ; s = expr LEVEL "simple" ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< (invoke ((invoke $e1$) "->" C_void)) $s$ ($mk_list args _loc c_ify$) >> + | e1 = expr ; "'" ; "++" -> + <:expr< (invoke $e1$) "++" C_void >> + | e1 = expr ; "'" ; "--" -> + <:expr< (invoke $e1$) "--" C_void >> + | e1 = expr ; "'" ; "-" ; e2 = expr -> + <:expr< (invoke $e1$) "-" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "+" ; e2 = expr -> <:expr< (invoke $e1$) "+" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "*" ; e2 = expr -> <:expr< (invoke $e1$) "*" (C_list [ $c_ify e2 _loc$ ]) >> + | "'" ; "&" ; e1 = expr -> + <:expr< (invoke $e1$) "&" C_void >> + | "'" ; "!" ; e1 = expr -> + <:expr< (invoke $e1$) "!" C_void >> + | "'" ; "~" ; e1 = expr -> + <:expr< (invoke $e1$) "~" C_void >> + | e1 = expr ; "'" ; "/" ; e2 = expr -> + <:expr< (invoke $e1$) "/" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "%" ; e2 = expr -> + <:expr< (invoke $e1$) "%" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "lsl" ; e2 = expr -> + <:expr< (invoke $e1$) ("<" ^ "<") (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "lsr" ; e2 = expr -> + <:expr< (invoke $e1$) (">" ^ ">") (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "<" ; e2 = expr -> + <:expr< (invoke $e1$) "<" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "<=" ; e2 = expr -> + <:expr< (invoke $e1$) "<=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; ">" ; e2 = expr -> + <:expr< (invoke $e1$) ">" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; ">=" ; e2 = expr -> + <:expr< (invoke $e1$) ">=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "==" ; e2 = expr -> + <:expr< (invoke $e1$) "==" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "!=" ; e2 = expr -> + <:expr< (invoke $e1$) "!=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "&" ; e2 = expr -> + <:expr< (invoke $e1$) "&" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "^" ; e2 = expr -> + <:expr< (invoke $e1$) "^" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "|" ; e2 = expr -> + <:expr< (invoke $e1$) "|" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "&&" ; e2 = expr -> + <:expr< (invoke $e1$) "&&" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "||" ; e2 = expr -> + <:expr< (invoke $e1$) "||" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "=" ; e2 = expr -> + <:expr< (invoke $e1$) "=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "+=" ; e2 = expr -> + <:expr< (invoke $e1$) "+=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "-=" ; e2 = expr -> + <:expr< (invoke $e1$) "-=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "*=" ; e2 = expr -> + <:expr< (invoke $e1$) "*=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "/=" ; e2 = expr -> + <:expr< (invoke $e1$) "/=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "%=" ; e2 = expr -> + <:expr< (invoke $e1$) "%=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "lsl" ; "=" ; e2 = expr -> + <:expr< (invoke $e1$) ("<" ^ "<=") (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "lsr" ; "=" ; e2 = expr -> + <:expr< (invoke $e1$) (">" ^ ">=") (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "&=" ; e2 = expr -> + <:expr< (invoke $e1$) "&=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "^=" ; e2 = expr -> + <:expr< (invoke $e1$) "^=" (C_list [ $c_ify e2 _loc$ ]) >> + | e1 = expr ; "'" ; "|=" ; e2 = expr -> + <:expr< (invoke $e1$) "|=" (C_list [ $c_ify e2 _loc$ ]) >> + | "'" ; e = expr -> c_ify e _loc + | c = expr ; "as" ; id = LIDENT -> <:expr< $lid:"get_" ^ id$ $c$ >> + | c = expr ; "to" ; id = LIDENT -> <:expr< $uid:"C_" ^ id$ $c$ >> + | "`" ; "`" ; l = LIDENT -> <:expr< C_enum `$lid:l$ >> + | "`" ; "`" ; u = UIDENT -> <:expr< C_enum `$uid:u$ >> + | f = expr ; "'" ; "(" ; args = LIST0 (expr LEVEL "simple") SEP "," ; ")" -> + <:expr< $f$ ($mk_list args _loc c_ify$) >> + ] ] ; + END ;; + +end + +module M = Register.OCamlSyntaxExtension(Id)(Make)
diff --git a/share/swig/2.0.11/ocaml/typecheck.i b/share/swig/3.0.12/ocaml/typecheck.i similarity index 99% rename from share/swig/2.0.11/ocaml/typecheck.i rename to share/swig/3.0.12/ocaml/typecheck.i index 4c35006..a13e155 100644 --- a/share/swig/2.0.11/ocaml/typecheck.i +++ b/share/swig/3.0.12/ocaml/typecheck.i
@@ -129,7 +129,7 @@ } } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; $1 = !caml_ptr_val_internal($input, &ptr,$descriptor); }
diff --git a/share/swig/2.0.11/ocaml/typemaps.i b/share/swig/3.0.12/ocaml/typemaps.i similarity index 89% rename from share/swig/2.0.11/ocaml/typemaps.i rename to share/swig/3.0.12/ocaml/typemaps.i index a15dc16..7602ad6 100644 --- a/share/swig/2.0.11/ocaml/typemaps.i +++ b/share/swig/3.0.12/ocaml/typemaps.i
@@ -34,11 +34,21 @@ $1 = ($ltype) caml_ptr_val($input,$1_descriptor); } +%typemap(in) SWIGTYPE && { + /* %typemap(in) SWIGTYPE && */ + $1 = ($ltype) caml_ptr_val($input,$1_descriptor); +} + %typemap(varin) SWIGTYPE & { /* %typemap(varin) SWIGTYPE & */ $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); } +%typemap(varin) SWIGTYPE && { + /* %typemap(varin) SWIGTYPE && */ + $1 = *(($ltype) caml_ptr_val($input,$1_descriptor)); +} + %typemap(out) SWIGTYPE & { /* %typemap(out) SWIGTYPE & */ CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); @@ -49,6 +59,16 @@ } } +%typemap(out) SWIGTYPE && { + /* %typemap(out) SWIGTYPE && */ + CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); + if( fromval ) { + $result = callback(*fromval,caml_val_ptr((void *) &$1,$1_descriptor)); + } else { + $result = caml_val_ptr ((void *) &$1,$1_descriptor); + } +} + #if 0 %typemap(argout) SWIGTYPE & { CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); @@ -63,9 +83,23 @@ caml_val_ptr ((void *) $1,$1_descriptor)); } } +%typemap(argout) SWIGTYPE && { + CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr"); + if( fromval ) { + swig_result = + caml_list_append(swig_result, + callback(*fromval,caml_val_ptr((void *) $1, + $1_descriptor))); + } else { + swig_result = + caml_list_append(swig_result, + caml_val_ptr ((void *) $1,$1_descriptor)); + } +} #endif %typemap(argout) const SWIGTYPE & { } +%typemap(argout) const SWIGTYPE && { } %typemap(in) SWIGTYPE { $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; @@ -112,6 +146,7 @@ } %apply SWIGTYPE { const SWIGTYPE & }; +%apply SWIGTYPE { const SWIGTYPE && }; #endif @@ -329,6 +364,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/ocaml/typeregister.swg b/share/swig/3.0.12/ocaml/typeregister.swg similarity index 100% rename from share/swig/2.0.11/ocaml/typeregister.swg rename to share/swig/3.0.12/ocaml/typeregister.swg
diff --git a/share/swig/2.0.11/octave/attribute.i b/share/swig/3.0.12/octave/attribute.i similarity index 100% rename from share/swig/2.0.11/octave/attribute.i rename to share/swig/3.0.12/octave/attribute.i
diff --git a/share/swig/2.0.11/octave/boost_shared_ptr.i b/share/swig/3.0.12/octave/boost_shared_ptr.i similarity index 95% rename from share/swig/2.0.11/octave/boost_shared_ptr.i rename to share/swig/3.0.12/octave/boost_shared_ptr.i index 93b1a89..e918620 100644 --- a/share/swig/2.0.11/octave/boost_shared_ptr.i +++ b/share/swig/3.0.12/octave/boost_shared_ptr.i
@@ -29,7 +29,8 @@ } } %typemap(out) CONST TYPE { - %set_output(SWIG_NewPointerObj(new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + %set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } %typemap(varin) CONST TYPE { @@ -40,14 +41,15 @@ %variable_fail(res, "$type", "$name"); } if (!argp) { - %argument_nullref("$type", $symname, $argnum); + %variable_nullref("$type", "$name"); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); } } %typemap(varout) CONST TYPE { - %set_varoutput(SWIG_NewPointerObj(new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); + %set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN)); } // plain pointer @@ -124,7 +126,9 @@ %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; - if (!argp) { %argument_nullref("$type", $symname, $argnum); } + if (!argp) { + %variable_nullref("$type", "$name"); + } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
diff --git a/share/swig/2.0.11/octave/carrays.i b/share/swig/3.0.12/octave/carrays.i similarity index 100% rename from share/swig/2.0.11/octave/carrays.i rename to share/swig/3.0.12/octave/carrays.i
diff --git a/share/swig/2.0.11/octave/cdata.i b/share/swig/3.0.12/octave/cdata.i similarity index 100% rename from share/swig/2.0.11/octave/cdata.i rename to share/swig/3.0.12/octave/cdata.i
diff --git a/share/swig/2.0.11/octave/cmalloc.i b/share/swig/3.0.12/octave/cmalloc.i similarity index 100% rename from share/swig/2.0.11/octave/cmalloc.i rename to share/swig/3.0.12/octave/cmalloc.i
diff --git a/share/swig/2.0.11/octave/director.swg b/share/swig/3.0.12/octave/director.swg similarity index 84% rename from share/swig/2.0.11/octave/director.swg rename to share/swig/3.0.12/octave/director.swg index 5e5d6f1..e80877e 100644 --- a/share/swig/2.0.11/octave/director.swg +++ b/share/swig/3.0.12/octave/director.swg
@@ -1,6 +1,14 @@ +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that Octave proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) +#include <exception> + namespace Swig { class Director { @@ -62,7 +70,7 @@ } }; - SWIGINTERN rtdir_map* get_rtdir_map() { + SWIGINTERN rtdir_map *get_rtdir_map() { static swig_module_info *module = 0; if (!module) module = SWIG_GetModule(0); @@ -74,19 +82,19 @@ } SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) { - rtdir_map* rm = get_rtdir_map(); + rtdir_map *rm = get_rtdir_map(); if (rm) (*rm)[vptr] = d; } SWIGINTERNINLINE void erase_rtdir(void *vptr) { - rtdir_map* rm = get_rtdir_map(); + rtdir_map *rm = get_rtdir_map(); if (rm) (*rm).erase(vptr); } SWIGINTERNINLINE Director *get_rtdir(void *vptr) { - rtdir_map* rm = get_rtdir_map(); + rtdir_map *rm = get_rtdir_map(); if (!rm) return 0; rtdir_map::const_iterator pos = rm->find(vptr);
diff --git a/share/swig/3.0.12/octave/exception.i b/share/swig/3.0.12/octave/exception.i new file mode 100644 index 0000000..2f0f489 --- /dev/null +++ b/share/swig/3.0.12/octave/exception.i
@@ -0,0 +1,14 @@ +%include <typemaps/exception.swg> + +%insert("runtime") { + %define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; )) +} + +%define SWIG_RETHROW_OCTAVE_EXCEPTIONS + /* rethrow any exceptions thrown by Octave */ +%#if SWIG_OCTAVE_PREREQ(4,2,0) + catch (octave::execution_exception& _e) { throw; } + catch (octave::exit_exception& _e) { throw; } + catch (octave::interrupt_exception& _e) { throw; } +%#endif +%enddef
diff --git a/share/swig/2.0.11/octave/factory.i b/share/swig/3.0.12/octave/factory.i similarity index 100% rename from share/swig/2.0.11/octave/factory.i rename to share/swig/3.0.12/octave/factory.i
diff --git a/share/swig/2.0.11/octave/implicit.i b/share/swig/3.0.12/octave/implicit.i similarity index 100% rename from share/swig/2.0.11/octave/implicit.i rename to share/swig/3.0.12/octave/implicit.i
diff --git a/share/swig/2.0.11/octave/octave.swg b/share/swig/3.0.12/octave/octave.swg similarity index 100% rename from share/swig/2.0.11/octave/octave.swg rename to share/swig/3.0.12/octave/octave.swg
diff --git a/share/swig/2.0.11/octave/octcomplex.swg b/share/swig/3.0.12/octave/octcomplex.swg similarity index 100% rename from share/swig/2.0.11/octave/octcomplex.swg rename to share/swig/3.0.12/octave/octcomplex.swg
diff --git a/share/swig/2.0.11/octave/octcontainer.swg b/share/swig/3.0.12/octave/octcontainer.swg similarity index 98% rename from share/swig/2.0.11/octave/octcontainer.swg rename to share/swig/3.0.12/octave/octcontainer.swg index b14b8c1..771edbd 100644 --- a/share/swig/2.0.11/octave/octcontainer.swg +++ b/share/swig/3.0.12/octave/octcontainer.swg
@@ -12,6 +12,7 @@ * ----------------------------------------------------------------------------- */ %{ +#include <climits> #include <iostream> %} @@ -26,9 +27,7 @@ // The Octave C++ Wrap -%insert(header) %{ -#include <stdexcept> -%} +%fragment("<stdexcept>"); %include <std_except.i> @@ -69,7 +68,7 @@ namespace std { template <> - struct less <octave_value>: public binary_function<octave_value, octave_value, bool> + struct less <octave_value> { bool operator()(const octave_value& v, const octave_value& w) const @@ -563,8 +562,8 @@ static int asptr(const octave_value& obj, sequence **seq) { if (!obj.is_defined() || Swig::swig_value_deref(obj)) { sequence *p; - if (SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<sequence>(),0) == SWIG_OK) { + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { if (seq) *seq = p; return SWIG_OLDOBJ; }
diff --git a/share/swig/2.0.11/octave/octfragments.swg b/share/swig/3.0.12/octave/octfragments.swg similarity index 100% rename from share/swig/2.0.11/octave/octfragments.swg rename to share/swig/3.0.12/octave/octfragments.swg
diff --git a/share/swig/2.0.11/octave/octiterators.swg b/share/swig/3.0.12/octave/octiterators.swg similarity index 100% rename from share/swig/2.0.11/octave/octiterators.swg rename to share/swig/3.0.12/octave/octiterators.swg
diff --git a/share/swig/2.0.11/octave/octopers.swg b/share/swig/3.0.12/octave/octopers.swg similarity index 95% rename from share/swig/2.0.11/octave/octopers.swg rename to share/swig/3.0.12/octave/octopers.swg index c38e64d..665b703 100644 --- a/share/swig/2.0.11/octave/octopers.swg +++ b/share/swig/3.0.12/octave/octopers.swg
@@ -25,8 +25,6 @@ // __div__ a / b // __pow__ a ^ b // __ldiv__ a \ b -// __lshift__ a << b -// __rshift__ a >> b // __lt__ a < b // __le__ a <= b // __eq__ a == b @@ -51,8 +49,6 @@ %rename(__mul__) *::operator*; %rename(__div__) *::operator/; %rename(__mod__) *::operator%; -%rename(__lshift__) *::operator<<; -%rename(__rshift__) *::operator>>; %rename(__el_and__) *::operator&&; %rename(__el_or__) *::operator||; %rename(__xor__) *::operator^; @@ -84,5 +80,7 @@ // Ignored operators %ignoreoperator(EQ) operator=; %ignoreoperator(ARROWSTAR) operator->*; +%ignoreoperator(LSHIFT) operator<<; +%ignoreoperator(RSHIFT) operator>>; #endif /* __cplusplus */
diff --git a/share/swig/2.0.11/octave/octprimtypes.swg b/share/swig/3.0.12/octave/octprimtypes.swg similarity index 90% rename from share/swig/2.0.11/octave/octprimtypes.swg rename to share/swig/3.0.12/octave/octprimtypes.swg index 6f43f21..663d1fe 100644 --- a/share/swig/2.0.11/octave/octprimtypes.swg +++ b/share/swig/3.0.12/octave/octprimtypes.swg
@@ -97,15 +97,20 @@ // long long -%fragment(SWIG_From_frag(long long),"header") { +%fragment(SWIG_From_frag(long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE octave_value SWIG_From_dec(long long) (long long value) { return octave_int64(value); } +%#endif } -%fragment(SWIG_AsVal_frag(long long),"header") { +%fragment(SWIG_AsVal_frag(long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(long long)(const octave_value& ov, long long* val) { if (!ov.is_scalar_type()) @@ -127,16 +132,22 @@ } return SWIG_OK; } +%#endif } -%fragment(SWIG_From_frag(unsigned long long),"header") { +%fragment(SWIG_From_frag(unsigned long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE octave_value SWIG_From_dec(unsigned long long) (unsigned long long value) { return octave_uint64(value); } +%#endif } -%fragment(SWIG_AsVal_frag(unsigned long long),"header") { +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(unsigned long long)(const octave_value& ov, unsigned long long* val) { if (!ov.is_scalar_type()) @@ -171,6 +182,7 @@ } return SWIG_OK; } +%#endif } // double
diff --git a/share/swig/2.0.11/octave/octrun.swg b/share/swig/3.0.12/octave/octrun.swg similarity index 87% rename from share/swig/2.0.11/octave/octrun.swg rename to share/swig/3.0.12/octave/octrun.swg index 41d1c7a..57a888f 100644 --- a/share/swig/2.0.11/octave/octrun.swg +++ b/share/swig/3.0.12/octave/octrun.swg
@@ -1,20 +1,4 @@ - -#include <octave/version.h> -#ifndef OCTAVE_API_VERSION_NUMBER - - // Hack to distinguish between Octave 3.2 and earlier versions before OCTAVE_API_VERSION_NUMBER existed - #define ComplexLU __ignore - #include <octave/CmplxLU.h> - #undef ComplexLU - #ifdef octave_Complex_LU_h - # define OCTAVE_API_VERSION_NUMBER 36 - #else - # define OCTAVE_API_VERSION_NUMBER 37 - #endif - -#endif - -#if OCTAVE_API_VERSION_NUMBER < 37 +#if !SWIG_OCTAVE_PREREQ(3,2,0) #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, FS ## cname, args, nargout, doc) #else #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, G ## cname, args, nargout, doc) @@ -295,41 +279,44 @@ return octave_value_list(); } - bool dispatch_unary_op(const std::string &symbol, octave_value &ret) { - member_value_pair *m = find_member(symbol, false); + bool dispatch_unary_op(const std::string &symbol, octave_value &ret) const { + octave_swig_type *nc_this = const_cast < octave_swig_type *>(this); + member_value_pair *m = nc_this->find_member(symbol, false); if (!m || m->first->is_static() || m->first->is_global()) return false; octave_value_list args; - args.append(as_value()); - octave_value_list argout(member_invoke(m, args, 1)); + args.append(nc_this->as_value()); + octave_value_list argout(nc_this->member_invoke(m, args, 1)); if (argout.length() < 1) return false; ret = argout(0); return true; } - bool dispatch_binary_op(const std::string &symbol, const octave_base_value &rhs, octave_value &ret) { - member_value_pair *m = find_member(symbol, false); + bool dispatch_binary_op(const std::string &symbol, const octave_base_value &rhs, octave_value &ret) const { + octave_swig_type *nc_this = const_cast < octave_swig_type *>(this); + member_value_pair *m = nc_this->find_member(symbol, false); if (!m || m->first->is_static() || m->first->is_global()) return false; octave_value_list args; - args.append(as_value()); + args.append(nc_this->as_value()); args.append(make_value_hack(rhs)); - octave_value_list argout(member_invoke(m, args, 1)); + octave_value_list argout(nc_this->member_invoke(m, args, 1)); if (argout.length() < 1) return false; ret = argout(0); return true; } - bool dispatch_index_op(const std::string &symbol, const octave_value_list &rhs, octave_value_list &ret) { - member_value_pair *m = find_member(symbol, false); + bool dispatch_index_op(const std::string &symbol, const octave_value_list &rhs, octave_value_list &ret) const { + octave_swig_type *nc_this = const_cast < octave_swig_type *>(this); + member_value_pair *m = nc_this->find_member(symbol, false); if (!m || m->first->is_static() || m->first->is_global()) return false; octave_value_list args; - args.append(as_value()); + args.append(nc_this->as_value()); args.append(rhs); - octave_value_list argout(member_invoke(m, args, 1)); + octave_value_list argout(nc_this->member_invoke(m, args, 1)); if (argout.length() >= 1) ret = argout(0); return true; @@ -391,22 +378,9 @@ } dim_vector dims(void) const { - octave_swig_type *nc_this = const_cast < octave_swig_type *>(this); - - // Find the __dims__ method of this object - member_value_pair *m = nc_this->find_member("__dims__", false); - - if (!m) return dim_vector(1,1); - - // Call the __dims__ method of this object - octave_value_list inarg; - inarg.append(nc_this->as_value()); - octave_value_list outarg = nc_this->member_invoke(m, inarg, 1); - - // __dims__ should return (at least) one output argument - if (outarg.length() < 1) return dim_vector(1,1); - - octave_value & out = outarg(0); + octave_value out; + if (!dispatch_unary_op("__dims__", out)) + return dim_vector(1,1); // Return value should be cell or matrix of integers if (out.is_cell()) { @@ -427,7 +401,7 @@ if (error_state) return dim_vector(1,1); } return d; - } else if (out.is_matrix_type() || out.is_real_nd_array() || out.is_numeric_type() ) { + } else if (out.is_matrix_type() || out.is_numeric_type() ) { if (out.rows()==1 || out.columns()==1) { Array<int> a = out.int_vector_value(); if (error_state) return dim_vector(1,1); @@ -510,26 +484,40 @@ swig_member_const_iterator swig_members_begin() { return members.begin(); } swig_member_const_iterator swig_members_end() { return members.end(); } - void *cast(swig_type_info *type, int *_own, int flags) { + int cast(void **vptr, swig_type_info *type, int *_own, int flags) { + int res = SWIG_ERROR; if (_own) *_own = own; if (flags &SWIG_POINTER_DISOWN) own = 0; - if (!type && types.size()) - return types[0].second.ptr; + if (!type && types.size()) { + if(vptr) + *vptr = types[0].second.ptr; + return SWIG_OK; + } for (unsigned int j = 0; j < types.size(); ++j) - if (type == types[j].first) - return types[j].second.ptr; + if (type == types[j].first) { + if(vptr) + *vptr = types[j].second.ptr; + return SWIG_OK; + } for (unsigned int j = 0; j < types.size(); ++j) { swig_cast_info *tc = SWIG_TypeCheck(types[j].first->name, type); if (!tc) continue; - int newmemory = 0; - void *vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory); - assert(!newmemory); // newmemory handling not yet implemented - return vptr; + if(vptr) { + int newmemory = 0; + *vptr = SWIG_TypeCast(tc, types[j].second.ptr, &newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(_own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (_own) + *_own = *_own | SWIG_CAST_NEW_MEMORY; + } + } + res = SWIG_OK; + break; } - return 0; + return res; } bool is_owned() const { @@ -732,21 +720,57 @@ } virtual std::string string_value(bool force = false) const { - octave_swig_type *nc_this = const_cast < octave_swig_type *>(this); - member_value_pair *m = nc_this->find_member("__str__", false); - if (!m) { - error("__str__ method not defined"); - return std::string(); + octave_value ret; + if (!dispatch_unary_op("__str__", ret)) { + error("__str__ method not defined"); + return std::string(); } - octave_value_list outarg = nc_this->member_invoke(m, octave_value_list(nc_this->as_value()), 1); - if (outarg.length() < 1 || !outarg(0).is_string()) { + if (!ret.is_string()) { error("__str__ method did not return a string"); return std::string(); } - return outarg(0).string_value(); + return ret.string_value(); } -#if OCTAVE_API_VERSION_NUMBER >= 40 + virtual double scalar_value(bool frc_str_conv = false) const { + octave_value ret; + if (!dispatch_unary_op("__float__", ret)) { + error("__float__ method not defined"); + } + return ret.scalar_value(); + } + +#if SWIG_OCTAVE_PREREQ(4,2,0) + virtual octave_value as_double(void) const { + octave_value ret; + if (!dispatch_unary_op("__float__", ret)) { + error("__float__ method not defined"); + } + return ret.as_double(); + } + + virtual octave_value as_single(void) const { + octave_value ret; + if (!dispatch_unary_op("__float__", ret)) { + error("__float__ method not defined"); + } + return ret.as_single(); + } +#endif + +#if SWIG_OCTAVE_PREREQ(3,8,0) + virtual octave_value map(octave_base_value::unary_mapper_t umap) const { + const std::string opname = std::string("__") + octave_base_value::get_umap_name(umap) + std::string("__"); + octave_value ret; + if (!dispatch_unary_op(opname, ret)) { + error((opname + std::string(" method not found")).c_str()); + return octave_value(); + } + return ret; + } +#endif + +#if SWIG_OCTAVE_PREREQ(3,3,52) virtual octave_map map_value() const { return octave_map(); } @@ -786,6 +810,17 @@ } #if defined (HAVE_HDF5) +# if SWIG_OCTAVE_PREREQ(4,0,0) + virtual bool + save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats) { + return true; + } + + virtual bool + load_hdf5 (octave_hdf5_id loc_id, const char *name, bool have_h5giterate_bug) { + return true; + } +# else virtual bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) { return true; @@ -795,6 +830,7 @@ load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug) { return true; } +# endif #endif virtual octave_value convert_to_str(bool pad = false, bool force = false, char type = '"') const { @@ -887,7 +923,12 @@ return octave_value(); } - void print(std::ostream &os, bool pr_as_read_syntax = false) const { +#if SWIG_OCTAVE_PREREQ(4,0,0) + void print(std::ostream &os, bool pr_as_read_syntax = false) +#else + void print(std::ostream &os, bool pr_as_read_syntax = false) const +#endif + { if (is_string()) { os << string_value(); return; @@ -982,7 +1023,23 @@ virtual std::string string_value(bool force = false) const { return ptr->string_value(force); } -#if OCTAVE_API_VERSION_NUMBER >= 40 + virtual double scalar_value(bool frc_str_conv = false) const + { return ptr->scalar_value(frc_str_conv); } + +#if SWIG_OCTAVE_PREREQ(4,2,0) + virtual octave_value as_double(void) const + { return ptr->as_double(); } + + virtual octave_value as_single(void) const + { return ptr->as_single(); } +#endif + +#if SWIG_OCTAVE_PREREQ(3,8,0) + virtual octave_value map(octave_base_value::unary_mapper_t umap) const + { return ptr->map(umap); } +#endif + +#if SWIG_OCTAVE_PREREQ(3,3,52) virtual octave_map map_value() const { return ptr->map_value(); } #else @@ -1007,6 +1064,15 @@ { return ptr->load_binary(is, swap, fmt); } #if defined (HAVE_HDF5) +# if SWIG_OCTAVE_PREREQ(4,0,0) + virtual bool + save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats) + { return ptr->save_hdf5(loc_id, name, save_as_floats); } + + virtual bool + load_hdf5 (octave_hdf5_id loc_id, const char *name, bool have_h5giterate_bug) + { return ptr->load_hdf5(loc_id, name, have_h5giterate_bug); } +# else virtual bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) { return ptr->save_hdf5(loc_id, name, save_as_floats); } @@ -1014,6 +1080,7 @@ virtual bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug) { return ptr->load_hdf5(loc_id, name, have_h5giterate_bug); } +# endif #endif virtual octave_value convert_to_str(bool pad = false, bool force = false, char type = '"') const @@ -1022,14 +1089,32 @@ virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const { return ptr->convert_to_str_internal(pad, force, type); } +#if SWIG_OCTAVE_PREREQ(4,0,0) + void print(std::ostream &os, bool pr_as_read_syntax = false) +#else void print(std::ostream &os, bool pr_as_read_syntax = false) const +#endif { return ptr->print(os, pr_as_read_syntax); } + virtual type_conv_info numeric_conversion_function(void) const { + return octave_base_value::type_conv_info (default_numeric_conversion_function, + octave_scalar::static_type_id ()); + } + private: + static octave_base_value *default_numeric_conversion_function (const octave_base_value& a) { + const octave_swig_ref& v = dynamic_cast<const octave_swig_ref&>(a); + return new octave_scalar(v.scalar_value()); + } + +#if !SWIG_OCTAVE_PREREQ(4,0,0) DECLARE_OCTAVE_ALLOCATOR; +#endif DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA; }; +#if !SWIG_OCTAVE_PREREQ(4,0,0) DEFINE_OCTAVE_ALLOCATOR(octave_swig_ref); +#endif DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_ref, "swig_ref", "swig_ref"); class octave_swig_packed:public octave_base_value { @@ -1061,7 +1146,12 @@ return true; } - void print(std::ostream &os, bool pr_as_read_syntax = false) const { +#if SWIG_OCTAVE_PREREQ(4,0,0) + void print(std::ostream &os, bool pr_as_read_syntax = false) +#else + void print(std::ostream &os, bool pr_as_read_syntax = false) const +#endif + { indent(os); os << "swig packed type: name = " << (type ? type->name : std::string()) << ", len = " << buf.size(); newline(os); } @@ -1085,6 +1175,17 @@ } #if defined (HAVE_HDF5) +# if SWIG_OCTAVE_PREREQ(4,0,0) + virtual bool + save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats) { + return true; + } + + virtual bool + load_hdf5 (octave_hdf5_id loc_id, const char *name, bool have_h5giterate_bug) { + return true; + } +# else virtual bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) { return true; @@ -1094,16 +1195,21 @@ load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug) { return true; } +# endif #endif private: +#if !SWIG_OCTAVE_PREREQ(4,0,0) DECLARE_OCTAVE_ALLOCATOR; +#endif DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA; }; +#if !SWIG_OCTAVE_PREREQ(4,0,0) DEFINE_OCTAVE_ALLOCATOR(octave_swig_packed); +#endif DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_packed, "swig_packed", "swig_packed"); - static octave_value_list octave_set_immutable(const octave_value_list &args, int nargout) { + SWIGRUNTIME octave_value_list octave_set_immutable(const octave_value_list &args, int nargout) { error("attempt to set immutable member variable"); return octave_value_list(); } @@ -1176,8 +1282,10 @@ swig_binary_op(div); swig_binary_op(pow); swig_binary_op(ldiv); +#if !SWIG_OCTAVE_PREREQ(4,2,0) swig_binary_op(lshift); swig_binary_op(rshift); +#endif swig_binary_op(lt); swig_binary_op(le); swig_binary_op(eq); @@ -1207,8 +1315,10 @@ swigreg_binary_op(div); swigreg_binary_op(pow); swigreg_binary_op(ldiv); +#if !SWIG_OCTAVE_PREREQ(4,2,0) swigreg_binary_op(lshift); swigreg_binary_op(rshift); +#endif swigreg_binary_op(lt); swigreg_binary_op(le); swigreg_binary_op(eq); @@ -1259,12 +1369,7 @@ return SWIG_ERROR; octave_swig_ref *osr = static_cast < octave_swig_ref *>(ov.internal_rep()); octave_swig_type *ost = osr->get_ptr(); - void *vptr = ost->cast(type, own, flags); - if (!vptr) - return SWIG_ERROR; - if (ptr) - *ptr = vptr; - return SWIG_OK; + return ost->cast(ptr, type, own, flags); } SWIGRUNTIME octave_value SWIG_Octave_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { @@ -1293,10 +1398,12 @@ } SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) { -#if OCTAVE_API_VERSION_NUMBER < 37 +#if !SWIG_OCTAVE_PREREQ(3,2,0) link_to_global_variable(curr_sym_tab->lookup(name, true)); #else +#if !SWIG_OCTAVE_PREREQ(3,8,0) symbol_table::varref(name); +#endif symbol_table::mark_global(name); #endif }
diff --git a/share/swig/3.0.12/octave/octruntime.swg b/share/swig/3.0.12/octave/octruntime.swg new file mode 100644 index 0000000..f5e6871 --- /dev/null +++ b/share/swig/3.0.12/octave/octruntime.swg
@@ -0,0 +1,452 @@ +%insert(runtime) %{ + +#include <cstdlib> +#include <iostream> + +#include <octave/oct.h> +#include <octave/version.h> + +// Macro for enabling features which require Octave version >= major.minor.patch +// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers +#define SWIG_OCTAVE_PREREQ(major, minor, patch) \ + ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((major)<<16) + ((minor)<<8) + (patch) ) + +// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1 +#if !defined(OCTAVE_MAJOR_VERSION) + +# if !defined(OCTAVE_API_VERSION_NUMBER) + +// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet +// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER +# include <octave/ov.h> +# if defined(octave_ov_h) +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 8 +# define OCTAVE_PATCH_VERSION 0 +# else + +// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed +# define ComplexLU __ignore +# include <octave/CmplxLU.h> +# undef ComplexLU +# if defined(octave_Complex_LU_h) + +// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 1 +# define OCTAVE_PATCH_VERSION 99 + +# else + +// OCTAVE_API_VERSION_NUMBER == 37 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 2 +# define OCTAVE_PATCH_VERSION 0 + +# endif // defined(octave_Complex_LU_h) + +# endif // defined(octave_ov_h) + +// Correlation between Octave API and version numbers extracted from Octave's +// ChangeLogs; version is the *earliest* released Octave with that API number +# elif OCTAVE_API_VERSION_NUMBER >= 48 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 6 +# define OCTAVE_PATCH_VERSION 0 + +# elif OCTAVE_API_VERSION_NUMBER >= 45 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 4 +# define OCTAVE_PATCH_VERSION 1 + +# elif OCTAVE_API_VERSION_NUMBER >= 42 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 54 + +# elif OCTAVE_API_VERSION_NUMBER >= 41 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 53 + +# elif OCTAVE_API_VERSION_NUMBER >= 40 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 52 + +# elif OCTAVE_API_VERSION_NUMBER >= 39 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 51 + +# else // OCTAVE_API_VERSION_NUMBER == 38 +# define OCTAVE_MAJOR_VERSION 3 +# define OCTAVE_MINOR_VERSION 3 +# define OCTAVE_PATCH_VERSION 50 + +# endif // !defined(OCTAVE_API_VERSION_NUMBER) + +#endif // !defined(OCTAVE_MAJOR_VERSION) + +#include <octave/Cell.h> +#include <octave/dynamic-ld.h> +#include <octave/oct-env.h> +#include <octave/oct-map.h> +#include <octave/ov-scalar.h> +#include <octave/ov-fcn-handle.h> +#include <octave/parse.h> +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include <octave/interpreter.h> +#else +#include <octave/toplev.h> +#endif +#include <octave/unwind-prot.h> +#if SWIG_OCTAVE_PREREQ(4,2,0) +#include <octave/call-stack.h> +#endif + +%} + +%insert(runtime) "swigrun.swg"; +%insert(runtime) "swigerrors.swg"; +%insert(runtime) "octrun.swg"; + +%insert(initbeforefunc) "swiginit.swg" + +%insert(initbeforefunc) %{ + +static bool SWIG_init_user(octave_swig_type* module_ns); + +SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) { + bool retn = false; + { +#if SWIG_OCTAVE_PREREQ(4,2,0) + octave::unwind_protect frame; + frame.protect_var(discard_error_messages); discard_error_messages = true; + frame.protect_var(discard_warning_messages); discard_warning_messages = true; +#elif SWIG_OCTAVE_PREREQ(3,3,50) + unwind_protect frame; + frame.protect_var(error_state); error_state = 0; + frame.protect_var(warning_state); warning_state = 0; + frame.protect_var(discard_error_messages); discard_error_messages = true; + frame.protect_var(discard_warning_messages); discard_warning_messages = true; +#else + unwind_protect::begin_frame("SWIG_Octave_LoadModule"); + unwind_protect_int(error_state); error_state = 0; + unwind_protect_int(warning_state); warning_state = 0; + unwind_protect_bool(discard_error_messages); discard_error_messages = true; + unwind_protect_bool(discard_warning_messages); discard_warning_messages = true; +#endif +#if SWIG_OCTAVE_PREREQ(4,2,0) + try { + feval(name, octave_value_list(), 0); + retn = true; + } catch (octave::execution_exception&) { } +#else + feval(name, octave_value_list(), 0); + retn = (error_state == 0); +#endif +#if !SWIG_OCTAVE_PREREQ(3,3,50) + unwind_protect::run_frame("SWIG_Octave_LoadModule"); +#endif + } + if (!retn) { + error(SWIG_name_d ": could not load module `%s'", name.c_str()); + } + return retn; +} + +SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) { + bool retn = false; + { +#if SWIG_OCTAVE_PREREQ(4,2,0) + octave::unwind_protect frame; + frame.protect_var(discard_error_messages); discard_error_messages = true; + frame.protect_var(discard_warning_messages); discard_warning_messages = true; +#elif SWIG_OCTAVE_PREREQ(3,3,50) + unwind_protect frame; + frame.protect_var(error_state); error_state = 0; + frame.protect_var(warning_state); warning_state = 0; + frame.protect_var(discard_error_messages); discard_error_messages = true; + frame.protect_var(discard_warning_messages); discard_warning_messages = true; +#else + unwind_protect::begin_frame("SWIG_Octave_LoadModule"); + unwind_protect_int(error_state); error_state = 0; + unwind_protect_int(warning_state); warning_state = 0; + unwind_protect_bool(discard_error_messages); discard_error_messages = true; + unwind_protect_bool(discard_warning_messages); discard_warning_messages = true; +#endif + octave_value_list args; + args.append(name); + args.append(octloadfcn->fcn_file_name()); +#if SWIG_OCTAVE_PREREQ(4,2,0) + try { + feval("autoload", args, 0); + retn = true; + } catch (octave::execution_exception&) { } +#else + feval("autoload", args, 0); + retn = (error_state == 0); +#endif +#if !SWIG_OCTAVE_PREREQ(3,3,50) + unwind_protect::run_frame("SWIG_Octave_InstallFunction"); +#endif + } + if (!retn) { + error(SWIG_name_d ": could not load function `%s'", name.c_str()); + } + return retn; +} + +static const char *const subclass_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} subclass()\n\ +@deftypefnx{Loadable Function} {} subclass(@var{swigclass}, @var{name}, @var{fcn}, @dots{})\n\ +Subclass a C++ class from within Octave, and provide implementations of its virtual methods.\n\ +\n\ +See the SWIG manual for usage examples.\n\ +@end deftypefn"; + +DEFUN_DLD( subclass, args, nargout, subclass_usage ) { + octave_swig_type *top = new octave_swig_type; + for (int j = 0; j < args.length(); ++j) { + if (args(j).type_id() == octave_swig_ref::static_type_id()) { + octave_swig_ref *osr = static_cast < octave_swig_ref *>(args(j).internal_rep()); + octave_swig_type *ost = osr->get_ptr(); + if (!ost->is_owned()) { + error("subclass: cannot subclass object not constructed on octave side"); + return octave_value_list(); + } + top->merge(*ost); + } else if (args(j).is_function_handle()) { + top->assign(args(j).fcn_handle_value()->fcn_name(), args(j)); + } else if (args(j).is_string()) { + if (j + 1 >= args.length()) { + error("subclass: member assignments must be of string,value form"); + return octave_value_list(); + } + top->assign(args(j).string_value(), args(j + 1)); + ++j; + } else { + error("subclass: invalid arguments to subclass()"); + return octave_value_list(); + } + } + return octave_value(Swig::swig_value_ref(top)); +} + +static const char *const swig_type_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} swig_type(@var{swigref})\n\ +Return the underlying C/C++ type name of a SWIG-wrapped object.\n\ +@end deftypefn"; + +DEFUN_DLD( swig_type, args, nargout, swig_type_usage ) { + if (args.length() != 1) { + error("swig_type: must be called with only a single object"); + return octave_value_list(); + } + octave_swig_type *ost = Swig::swig_value_deref(args(0)); + if (!ost) { + error("swig_type: object is not a swig_ref"); + return octave_value_list(); + } + return octave_value(ost->swig_type_name()); +} + +static const char *const swig_typequery_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} swig_typequery(@var{string})\n\ +Return @var{string} if it is a recognised SWIG-wrapped C/C++ type name;\n\ +otherwise return `<unknown>'.\n\ +@end deftypefn"; + +DEFUN_DLD( swig_typequery, args, nargout, swig_typequery_usage ) { + if (args.length() != 1 || !args(0).is_string()) { + error("swig_typequery: must be called with single string argument"); + return octave_value_list(); + } + swig_module_info *module = SWIG_GetModule(0); + swig_type_info *type = SWIG_TypeQueryModule(module, module, args(0).string_value().c_str()); + if (!type) + return octave_value("<unknown>"); + return octave_value(type->name); +} + +static const char *const swig_this_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} swig_this(@var{swigref})\n\ +Return the underlying C/C++ pointer of a SWIG-wrapped object.\n\ +@end deftypefn"; + +DEFUN_DLD( swig_this, args, nargout, swig_this_usage ) { + if (args.length() != 1) { + error("swig_this: must be called with only a single object"); + return octave_value_list(); + } + if (args(0).is_matrix_type() && args(0).rows() == 0 && args(0).columns() == 0) + return octave_value(octave_uint64(0)); + octave_swig_type *ost = Swig::swig_value_deref(args(0)); + if (!ost) { + error("swig_this: object is not a swig_ref"); + return octave_value_list(); + } + return octave_value(octave_uint64((unsigned long long) ost->swig_this())); +} + +static const char *const swig_octave_prereq_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Function} {} swig_octave_prereq(@var{major}, @var{minor}, @var{patch})\n\ +Return true if the version of Octave is at least @var{major}.@var{minor}.@var{patch}.\n\ +@end deftypefn"; + +DEFUN_DLD( swig_octave_prereq, args, nargout, swig_octave_prereq_usage ) { + if (args.length() != 3) { + error("swig_octave_prereq: must be called with 3 arguments"); + return octave_value_list(); + } + const int major = args(0).int_value(); + const int minor = args(1).int_value(); + const int patch = args(2).int_value(); + const bool prereq = SWIG_OCTAVE_PREREQ(major, minor, patch); + return octave_value(prereq); +} + +static const char *const SWIG_name_usage = "-*- texinfo -*- \n\ +@deftypefn {Loadable Module} {} " SWIG_name_d "\n\ +Loads the SWIG-generated module `" SWIG_name_d "'.\n\ +@end deftypefn"; + +DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) { + + static octave_swig_type* module_ns = 0; + + // workaround to prevent octave seg-faulting on exit: set Octave exit function + // octave_exit to _Exit, which exits immediately without trying to cleanup memory. + // definitely affected version 3.2.*, not sure about 3.3.*, seems to be fixed in + // version 3.4.*, but reappeared in 4.2.*, so turn on for all versions after 3.2.*. + // can be turned off with macro definition. +#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK +#if SWIG_OCTAVE_PREREQ(3,2,0) + octave_exit = ::_Exit; +#endif +#endif + + // check for no input and output args + if (args.length() != 0 || nargout != 0) { + print_usage(); + return octave_value_list(); + } + + // create module on first function call + if (!module_ns) { + + // workaround bug in octave where installing global variable of custom type and then + // exiting without explicitly clearing the variable causes octave to segfault. +#if SWIG_OCTAVE_PREREQ(3,2,0) + octave_value_list eval_args; + eval_args.append("base"); + eval_args.append("function __swig_atexit__; " + " if mislocked() " + " clear -all; " + " else " + " mlock(); " + " endif; " + "endfunction; " + "__swig_atexit__; " + "atexit(\"__swig_atexit__\", false); " + "atexit(\"__swig_atexit__\")"); + feval("evalin", eval_args, 0); +#endif + + octave_swig_ref::register_type(); + octave_swig_packed::register_type(); + SWIG_InitializeModule(0); + SWIG_PropagateClientData(); + + octave_function *me = octave_call_stack::current(); + + if (!SWIG_Octave_InstallFunction(me, "subclass")) { + return octave_value_list(); + } + if (!SWIG_Octave_InstallFunction(me, "swig_type")) { + return octave_value_list(); + } + if (!SWIG_Octave_InstallFunction(me, "swig_typequery")) { + return octave_value_list(); + } + if (!SWIG_Octave_InstallFunction(me, "swig_this")) { + return octave_value_list(); + } + if (!SWIG_Octave_InstallFunction(me, "swig_octave_prereq")) { + return octave_value_list(); + } + + octave_swig_type* cvar_ns=0; + if (std::string(SWIG_global_name) != ".") { + cvar_ns=new octave_swig_type; + for (int j=0;swig_globals[j].name;++j) + if (swig_globals[j].get_method) + cvar_ns->assign(swig_globals[j].name,&swig_globals[j]); + } + + module_ns=new octave_swig_type(0, 0, 0, true); + if (std::string(SWIG_global_name) != ".") { + module_ns->assign(SWIG_global_name,Swig::swig_value_ref(cvar_ns)); + } + else { + for (int j=0;swig_globals[j].name;++j) + if (swig_globals[j].get_method) + module_ns->assign(swig_globals[j].name,&swig_globals[j]); + } + for (int j=0;swig_globals[j].name;++j) + if (swig_globals[j].method) + module_ns->assign(swig_globals[j].name,&swig_globals[j]); + + // * need better solution here; swig_type -> octave_class mapping is + // * really n-to-1, in some cases such as template partial spec, etc. + // * see failing tests. + for (int j=0;swig_types[j];++j) + if (swig_types[j]->clientdata) { + swig_octave_class* c=(swig_octave_class*)swig_types[j]->clientdata; + module_ns->assign(c->name, + Swig::swig_value_ref + (new octave_swig_type(0,swig_types[j]))); + } + + if (!SWIG_init_user(module_ns)) { + delete module_ns; + module_ns=0; + return octave_value_list(); + } + + SWIG_InstallOps(octave_swig_ref::static_type_id()); + + octave_swig_type::swig_member_const_iterator mb; + for (mb = module_ns->swig_members_begin(); mb != module_ns->swig_members_end(); ++mb) { + if (mb->second.first && mb->second.first->method) { + if (!SWIG_Octave_InstallFunction(me, mb->first)) { + return octave_value_list(); + } + } + } + +#if !SWIG_OCTAVE_PREREQ(3,2,0) + mlock(me->name()); +#else + mlock(); +#endif + + } + + octave_swig_type::swig_member_const_iterator mb; + for (mb = module_ns->swig_members_begin(); mb != module_ns->swig_members_end(); ++mb) { + if (mb->second.second.is_defined()) { + SWIG_Octave_SetGlobalValue(mb->first, mb->second.second); + SWIG_Octave_LinkGlobalValue(mb->first); + } + } + + SWIG_Octave_SetGlobalValue(SWIG_name_d, module_ns->as_value()); + SWIG_Octave_LinkGlobalValue(SWIG_name_d); + + return octave_value_list(); + +} + +%}
diff --git a/share/swig/2.0.11/octave/octstdcommon.swg b/share/swig/3.0.12/octave/octstdcommon.swg similarity index 97% rename from share/swig/2.0.11/octave/octstdcommon.swg rename to share/swig/3.0.12/octave/octstdcommon.swg index 96923f4..799d369 100644 --- a/share/swig/2.0.11/octave/octstdcommon.swg +++ b/share/swig/3.0.12/octave/octstdcommon.swg
@@ -42,7 +42,8 @@ struct traits_asptr { static int asptr(const octave_value& obj, Type **val) { Type *p; - int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = p; }
diff --git a/share/swig/2.0.11/octave/octtypemaps.swg b/share/swig/3.0.12/octave/octtypemaps.swg similarity index 97% rename from share/swig/2.0.11/octave/octtypemaps.swg rename to share/swig/3.0.12/octave/octtypemaps.swg index e331cf4..4acf8e0 100644 --- a/share/swig/2.0.11/octave/octtypemaps.swg +++ b/share/swig/3.0.12/octave/octtypemaps.swg
@@ -1,5 +1,5 @@ -// Include fundamental fragemt definitions +// Include fundamental fragment definitions %include <typemaps/fragments.swg> // Look for user fragments file.
diff --git a/share/swig/2.0.11/octave/octuserdir.swg b/share/swig/3.0.12/octave/octuserdir.swg similarity index 100% rename from share/swig/2.0.11/octave/octuserdir.swg rename to share/swig/3.0.12/octave/octuserdir.swg
diff --git a/share/swig/2.0.11/octave/std_alloc.i b/share/swig/3.0.12/octave/std_alloc.i similarity index 100% rename from share/swig/2.0.11/octave/std_alloc.i rename to share/swig/3.0.12/octave/std_alloc.i
diff --git a/share/swig/2.0.11/octave/std_basic_string.i b/share/swig/3.0.12/octave/std_basic_string.i similarity index 100% rename from share/swig/2.0.11/octave/std_basic_string.i rename to share/swig/3.0.12/octave/std_basic_string.i
diff --git a/share/swig/3.0.12/octave/std_carray.i b/share/swig/3.0.12/octave/std_carray.i new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/share/swig/3.0.12/octave/std_carray.i
diff --git a/share/swig/2.0.11/octave/std_char_traits.i b/share/swig/3.0.12/octave/std_char_traits.i similarity index 100% rename from share/swig/2.0.11/octave/std_char_traits.i rename to share/swig/3.0.12/octave/std_char_traits.i
diff --git a/share/swig/2.0.11/octave/std_common.i b/share/swig/3.0.12/octave/std_common.i similarity index 85% rename from share/swig/2.0.11/octave/std_common.i rename to share/swig/3.0.12/octave/std_common.i index 9aebf7f..c8f17ba 100644 --- a/share/swig/2.0.11/octave/std_common.i +++ b/share/swig/3.0.12/octave/std_common.i
@@ -11,17 +11,17 @@ fragment=SWIG_From_frag(Type), fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef value_category category; static const char* type_name() { return #Type; } - }; - template <> struct traits_asval<Type > { + }; + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(octave_value obj, value_type *val) { + static int asval(octave_value obj, value_type *val) { return SWIG_AsVal(Type)(obj, val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static octave_value from(const value_type& val) { return SWIG_From(Type)(val); @@ -44,13 +44,13 @@ fragment=SWIG_From_frag(int), fragment="StdTraits") { namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(octave_value obj, value_type *val) { + static int asval(octave_value obj, value_type *val) { return SWIG_AsVal(int)(obj, (int *)val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static octave_value from(const value_type& val) { return SWIG_From(int)((int)val);
diff --git a/share/swig/2.0.11/octave/std_complex.i b/share/swig/3.0.12/octave/std_complex.i similarity index 100% rename from share/swig/2.0.11/octave/std_complex.i rename to share/swig/3.0.12/octave/std_complex.i
diff --git a/share/swig/2.0.11/octave/std_container.i b/share/swig/3.0.12/octave/std_container.i similarity index 100% rename from share/swig/2.0.11/octave/std_container.i rename to share/swig/3.0.12/octave/std_container.i
diff --git a/share/swig/2.0.11/octave/std_deque.i b/share/swig/3.0.12/octave/std_deque.i similarity index 100% rename from share/swig/2.0.11/octave/std_deque.i rename to share/swig/3.0.12/octave/std_deque.i
diff --git a/share/swig/2.0.11/octave/std_except.i b/share/swig/3.0.12/octave/std_except.i similarity index 100% rename from share/swig/2.0.11/octave/std_except.i rename to share/swig/3.0.12/octave/std_except.i
diff --git a/share/swig/2.0.11/octave/std_list.i b/share/swig/3.0.12/octave/std_list.i similarity index 100% rename from share/swig/2.0.11/octave/std_list.i rename to share/swig/3.0.12/octave/std_list.i
diff --git a/share/swig/2.0.11/octave/std_map.i b/share/swig/3.0.12/octave/std_map.i similarity index 96% rename from share/swig/2.0.11/octave/std_map.i rename to share/swig/3.0.12/octave/std_map.i index 7b85a54..fd15661 100644 --- a/share/swig/2.0.11/octave/std_map.i +++ b/share/swig/3.0.12/octave/std_map.i
@@ -98,7 +98,8 @@ res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val); } else { map_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0); + swig_type_info *descriptor = swig::type_info<map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } return res;
diff --git a/share/swig/2.0.11/octave/std_pair.i b/share/swig/3.0.12/octave/std_pair.i similarity index 87% rename from share/swig/2.0.11/octave/std_pair.i rename to share/swig/3.0.12/octave/std_pair.i index ab028d1..2f3d4df 100644 --- a/share/swig/2.0.11/octave/std_pair.i +++ b/share/swig/3.0.12/octave/std_pair.i
@@ -47,7 +47,8 @@ return get_pair(c(0),c(1),val); } else { value_type *p; - int res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = *p; return res; @@ -68,12 +69,16 @@ value_type *vp = %new_instance(std::pair<T,U>); T *pfirst = &(vp->first); int res1 = swig::asval(first, pfirst); - if (!SWIG_IsOK(res1)) + if (!SWIG_IsOK(res1)) { + %delete(vp); return res1; + } U *psecond = &(vp->second); int res2 = swig::asval(second, psecond); - if (!SWIG_IsOK(res2)) + if (!SWIG_IsOK(res2)) { + %delete(vp); return res2; + } *val = vp; return SWIG_AddNewMask(res1 > res2 ? res1 : res2); } else { @@ -100,7 +105,8 @@ return get_pair(c(0),c(1),val); } else { value_type *p; - int res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; return res;
diff --git a/share/swig/2.0.11/csharp/std_shared_ptr.i b/share/swig/3.0.12/octave/std_shared_ptr.i similarity index 100% copy from share/swig/2.0.11/csharp/std_shared_ptr.i copy to share/swig/3.0.12/octave/std_shared_ptr.i
diff --git a/share/swig/2.0.11/octave/std_string.i b/share/swig/3.0.12/octave/std_string.i similarity index 100% rename from share/swig/2.0.11/octave/std_string.i rename to share/swig/3.0.12/octave/std_string.i
diff --git a/share/swig/2.0.11/octave/std_vector.i b/share/swig/3.0.12/octave/std_vector.i similarity index 100% rename from share/swig/2.0.11/octave/std_vector.i rename to share/swig/3.0.12/octave/std_vector.i
diff --git a/share/swig/2.0.11/octave/std_string.i b/share/swig/3.0.12/octave/std_wstring.i similarity index 100% copy from share/swig/2.0.11/octave/std_string.i copy to share/swig/3.0.12/octave/std_wstring.i
diff --git a/share/swig/2.0.11/octave/stl.i b/share/swig/3.0.12/octave/stl.i similarity index 100% rename from share/swig/2.0.11/octave/stl.i rename to share/swig/3.0.12/octave/stl.i
diff --git a/share/swig/2.0.11/octave/typemaps.i b/share/swig/3.0.12/octave/typemaps.i similarity index 100% rename from share/swig/2.0.11/octave/typemaps.i rename to share/swig/3.0.12/octave/typemaps.i
diff --git a/share/swig/2.0.11/perl5/Makefile.pl b/share/swig/3.0.12/perl5/Makefile.pl similarity index 98% rename from share/swig/2.0.11/perl5/Makefile.pl rename to share/swig/3.0.12/perl5/Makefile.pl index 05240f1..cffdc8e 100644 --- a/share/swig/2.0.11/perl5/Makefile.pl +++ b/share/swig/3.0.12/perl5/Makefile.pl
@@ -7,7 +7,7 @@ # 2. Run perl as 'perl Makefile.pl' # 3. Type 'make' to build your module # 4. Type 'make install' to install your module. -# +# # See "Programming Perl", 2nd. Ed, for more gory details than # you ever wanted to know. @@ -17,5 +17,3 @@ 'LIBS' => [''], # Custom libraries (if any) 'OBJECT' => '$module_wrap.o' # Object files ); - -
diff --git a/share/swig/2.0.11/perl5/attribute.i b/share/swig/3.0.12/perl5/attribute.i similarity index 100% rename from share/swig/2.0.11/perl5/attribute.i rename to share/swig/3.0.12/perl5/attribute.i
diff --git a/share/swig/2.0.11/perl5/carrays.i b/share/swig/3.0.12/perl5/carrays.i similarity index 100% rename from share/swig/2.0.11/perl5/carrays.i rename to share/swig/3.0.12/perl5/carrays.i
diff --git a/share/swig/2.0.11/perl5/cdata.i b/share/swig/3.0.12/perl5/cdata.i similarity index 100% rename from share/swig/2.0.11/perl5/cdata.i rename to share/swig/3.0.12/perl5/cdata.i
diff --git a/share/swig/2.0.11/perl5/cmalloc.i b/share/swig/3.0.12/perl5/cmalloc.i similarity index 100% rename from share/swig/2.0.11/perl5/cmalloc.i rename to share/swig/3.0.12/perl5/cmalloc.i
diff --git a/share/swig/2.0.11/perl5/cni.i b/share/swig/3.0.12/perl5/cni.i similarity index 100% rename from share/swig/2.0.11/perl5/cni.i rename to share/swig/3.0.12/perl5/cni.i
diff --git a/share/swig/2.0.11/perl5/cpointer.i b/share/swig/3.0.12/perl5/cpointer.i similarity index 100% rename from share/swig/2.0.11/perl5/cpointer.i rename to share/swig/3.0.12/perl5/cpointer.i
diff --git a/share/swig/2.0.11/perl5/cstring.i b/share/swig/3.0.12/perl5/cstring.i similarity index 100% rename from share/swig/2.0.11/perl5/cstring.i rename to share/swig/3.0.12/perl5/cstring.i
diff --git a/share/swig/3.0.12/perl5/director.swg b/share/swig/3.0.12/perl5/director.swg new file mode 100644 index 0000000..f0a6614 --- /dev/null +++ b/share/swig/3.0.12/perl5/director.swg
@@ -0,0 +1,317 @@ +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that Perl proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_DIRECTOR_PERL_HEADER_ +#define SWIG_DIRECTOR_PERL_HEADER_ + +#include <string> +#include <iostream> +#include <exception> +#include <vector> +#include <map> + + +/* + Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the + native C++ RTTI and dynamic_cast<>. But be aware that directors + could stop working when using this option. +*/ +#ifdef SWIG_DIRECTOR_NORTTI +/* + When we don't use the native C++ RTTI, we implement a minimal one + only for Directors. +*/ +# ifndef SWIG_DIRECTOR_RTDIR +# define SWIG_DIRECTOR_RTDIR + +namespace Swig { + class Director; + SWIGINTERN std::map<void *, Director *>& get_rtdir_map() { + static std::map<void *, Director *> rtdir_map; + return rtdir_map; + } + + SWIGINTERNINLINE void set_rtdir(void *vptr, Director *rtdir) { + get_rtdir_map()[vptr] = rtdir; + } + + SWIGINTERNINLINE Director *get_rtdir(void *vptr) { + std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr); + Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0; + return rtdir; + } +} +# endif /* SWIG_DIRECTOR_RTDIR */ + +# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG)) +# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2) + +#else + +# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) +# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) + +#endif /* SWIG_DIRECTOR_NORTTI */ + +extern "C" { + struct swig_type_info; +} + +namespace Swig { + + /* memory handler */ + struct GCItem { + virtual ~GCItem() {} + + virtual int get_own() const { + return 0; + } + }; + + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { + } + + GCItem_var& operator=(GCItem *item) { + GCItem *tmp = _item; + _item = item; + delete tmp; + return *this; + } + + ~GCItem_var() { + delete _item; + } + + GCItem *operator->() const { + return _item; + } + + private: + GCItem *_item; + }; + + struct GCItem_Object : GCItem { + GCItem_Object(int own) : _own(own) { + } + + virtual ~GCItem_Object() { + } + + int get_own() const { + return _own; + } + + private: + int _own; + }; + + template <typename Type> + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { + } + + virtual ~GCItem_T() { + delete _ptr; + } + + private: + Type *_ptr; + }; + + template <typename Type> + struct GCArray_T : GCItem { + GCArray_T(Type *ptr) : _ptr(ptr) { + } + + virtual ~GCArray_T() { + delete[] _ptr; + } + + private: + Type *_ptr; + }; + + /* base class for director exceptions */ + class DirectorException : public std::exception { + public: + virtual SV *getNative() const = 0; + }; + + /* exceptions emitted by Perl */ + class DirectorMethodException : public DirectorException { + protected: + SV *err; + public: + DirectorMethodException(SV *sv = sv_mortalcopy(ERRSV)) : err(sv) { + SvREFCNT_inc(err); + } + + const char *what() const throw() { + return SvPV_nolen(err); + } + + SV *getNative() const { + return sv_2mortal(newSVsv(err)); + } + + static void raise(SV *sv) { + throw DirectorMethodException(sv); + } + }; + + /* exceptions emitted by wrap code */ + class DirectorWrapException : public DirectorException { + protected: + std::string msg; + DirectorWrapException(const char *str) : msg(str) { + } + + public: + virtual ~DirectorWrapException() throw() { + } + + const char *what() const throw() { + return msg.c_str(); + } + + virtual SV *getNative() const { + return sv_2mortal(newSVpvn(msg.data(), msg.size())); + } + }; + + class DirectorTypeMismatchException : public DirectorWrapException { + public: + DirectorTypeMismatchException(const char *str) : DirectorWrapException(str) { + } + + static void raise(const char *type, const char *msg) { + std::string err = std::string(type); + err += ": "; + err += msg; + throw DirectorTypeMismatchException(err.c_str()); + } + }; + + class DirectorPureVirtualException : public DirectorWrapException { + public: + DirectorPureVirtualException(const char *name) + : DirectorWrapException("SWIG director pure virtual method called: ") { + msg += name; + } + + static void raise(const char *name) { + throw DirectorPureVirtualException(name); + } + }; + + /* director base class */ + class Director { + private: + /* pointer to the wrapped perl object */ + SV *swig_self; + /* class of wrapped perl object */ + std::string swig_class; + /* flag indicating whether the object is owned by perl or c++ */ + mutable bool swig_disown_flag; + + /* decrement the reference count of the wrapped perl object */ + void swig_decref() const { + if (swig_disown_flag) { + SvREFCNT_dec(swig_self); + } + } + + public: + /* wrap a Perl object. */ + Director(SV *pkg) : swig_disown_flag(false) { + STRLEN len; + char *str = SvPV(pkg, len); + swig_class = std::string(str, len); + swig_self = newRV_inc((SV *)newHV()); + } + + /* discard our reference at destruction */ + virtual ~Director() { + swig_decref(); + } + + /* return a pointer to the wrapped Perl object */ + SV *swig_get_self() const { + return swig_self; + } + + const char *swig_get_class() const { + return swig_class.c_str(); + } + + /* acquire ownership of the wrapped Perl object (the sense of "disown" is from perl) */ + void swig_disown() const { + if (!swig_disown_flag) { + swig_disown_flag=true; + swig_incref(); + } + } + + /* increase the reference count of the wrapped Perl object */ + void swig_incref() const { + if (swig_disown_flag) { + SvREFCNT_inc(swig_self); + } + } + + /* methods to implement pseudo protected director members */ + virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const { + return true; + } + + virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const { + } + + /* ownership management */ + private: + typedef std::map<void *, GCItem_var> swig_ownership_map; + mutable swig_ownership_map swig_owner; + + public: + template <typename Type> + void swig_acquire_ownership_array(Type *vptr) const { + if (vptr) { + swig_owner[vptr] = new GCArray_T<Type>(vptr); + } + } + + template <typename Type> + void swig_acquire_ownership(Type *vptr) const { + if (vptr) { + swig_owner[vptr] = new GCItem_T<Type>(vptr); + } + } + + void swig_acquire_ownership_obj(void *vptr, int own) const { + if (vptr && own) { + swig_owner[vptr] = new GCItem_Object(own); + } + } + + int swig_release_ownership(void *vptr) const { + int own = 0; + if (vptr) { + swig_ownership_map::iterator iter = swig_owner.find(vptr); + if (iter != swig_owner.end()) { + own = iter->second->get_own(); + swig_owner.erase(iter); + } + } + return own; + } + }; + +} + +#endif +
diff --git a/share/swig/2.0.11/perl5/exception.i b/share/swig/3.0.12/perl5/exception.i similarity index 100% rename from share/swig/2.0.11/perl5/exception.i rename to share/swig/3.0.12/perl5/exception.i
diff --git a/share/swig/2.0.11/perl5/factory.i b/share/swig/3.0.12/perl5/factory.i similarity index 100% rename from share/swig/2.0.11/perl5/factory.i rename to share/swig/3.0.12/perl5/factory.i
diff --git a/share/swig/2.0.11/perl5/jstring.i b/share/swig/3.0.12/perl5/jstring.i similarity index 100% rename from share/swig/2.0.11/perl5/jstring.i rename to share/swig/3.0.12/perl5/jstring.i
diff --git a/share/swig/2.0.11/perl5/noembed.h b/share/swig/3.0.12/perl5/noembed.h similarity index 97% rename from share/swig/2.0.11/perl5/noembed.h rename to share/swig/3.0.12/perl5/noembed.h index 936d50b..4e30f11 100644 --- a/share/swig/2.0.11/perl5/noembed.h +++ b/share/swig/3.0.12/perl5/noembed.h
@@ -103,6 +103,9 @@ #ifdef stat #undef stat #endif +#ifdef seed + #undef seed +#endif #ifdef bool /* Leave if macro is from C99 stdbool.h */
diff --git a/share/swig/2.0.11/perl5/perl5.swg b/share/swig/3.0.12/perl5/perl5.swg similarity index 100% rename from share/swig/2.0.11/perl5/perl5.swg rename to share/swig/3.0.12/perl5/perl5.swg
diff --git a/share/swig/2.0.11/perl5/perlerrors.swg b/share/swig/3.0.12/perl5/perlerrors.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlerrors.swg rename to share/swig/3.0.12/perl5/perlerrors.swg
diff --git a/share/swig/2.0.11/perl5/perlfragments.swg b/share/swig/3.0.12/perl5/perlfragments.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlfragments.swg rename to share/swig/3.0.12/perl5/perlfragments.swg
diff --git a/share/swig/2.0.11/perl5/perlhead.swg b/share/swig/3.0.12/perl5/perlhead.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlhead.swg rename to share/swig/3.0.12/perl5/perlhead.swg
diff --git a/share/swig/2.0.11/perl5/perlinit.swg b/share/swig/3.0.12/perl5/perlinit.swg similarity index 96% rename from share/swig/2.0.11/perl5/perlinit.swg rename to share/swig/3.0.12/perl5/perlinit.swg index d9ffa9b..b49040d 100644 --- a/share/swig/2.0.11/perl5/perlinit.swg +++ b/share/swig/3.0.12/perl5/perlinit.swg
@@ -21,13 +21,14 @@ %init %{ -#ifdef __cplusplus +#if defined(__cplusplus) && ! defined(XSPROTO) extern "C" #endif XS(SWIG_init) { dXSARGS; int i; + (void)items; SWIG_InitializeModule(0);
diff --git a/share/swig/2.0.11/perl5/perlkw.swg b/share/swig/3.0.12/perl5/perlkw.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlkw.swg rename to share/swig/3.0.12/perl5/perlkw.swg
diff --git a/share/swig/2.0.11/perl5/perlmacros.swg b/share/swig/3.0.12/perl5/perlmacros.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlmacros.swg rename to share/swig/3.0.12/perl5/perlmacros.swg
diff --git a/share/swig/2.0.11/perl5/perlmain.i b/share/swig/3.0.12/perl5/perlmain.i similarity index 100% rename from share/swig/2.0.11/perl5/perlmain.i rename to share/swig/3.0.12/perl5/perlmain.i
diff --git a/share/swig/2.0.11/perl5/perlopers.swg b/share/swig/3.0.12/perl5/perlopers.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlopers.swg rename to share/swig/3.0.12/perl5/perlopers.swg
diff --git a/share/swig/2.0.11/perl5/perlprimtypes.swg b/share/swig/3.0.12/perl5/perlprimtypes.swg similarity index 85% rename from share/swig/2.0.11/perl5/perlprimtypes.swg rename to share/swig/3.0.12/perl5/perlprimtypes.swg index d7ac6f9..4cb6756 100644 --- a/share/swig/2.0.11/perl5/perlprimtypes.swg +++ b/share/swig/3.0.12/perl5/perlprimtypes.swg
@@ -37,7 +37,7 @@ SWIG_From_dec(long)(long value) { SV *sv; - if (value >= IV_MIN && value <= IV_MAX) + if (IVSIZE >= sizeof(value) || (value >= IV_MIN && value <= IV_MAX)) sv = newSViv(value); else sv = newSVpvf("%ld", value); @@ -46,20 +46,22 @@ } %fragment(SWIG_AsVal_frag(long),"header", + fragment="<limits.h>", + fragment="<stdlib.h>", fragment="SWIG_CanCastAsInteger") { SWIGINTERN int SWIG_AsVal_dec(long)(SV *obj, long* val) { if (SvUOK(obj)) { UV v = SvUV(obj); - if (v <= LONG_MAX) { + if (UVSIZE < sizeof(*val) || v <= LONG_MAX) { if (val) *val = v; return SWIG_OK; } return SWIG_OverflowError; } else if (SvIOK(obj)) { IV v = SvIV(obj); - if (v >= LONG_MIN && v <= LONG_MAX) { + if (IVSIZE <= sizeof(*val) || (v >= LONG_MIN && v <= LONG_MAX)) { if(val) *val = v; return SWIG_OK; } @@ -102,7 +104,7 @@ SWIG_From_dec(unsigned long)(unsigned long value) { SV *sv; - if (value <= UV_MAX) + if (UVSIZE >= sizeof(value) || value <= UV_MAX) sv = newSVuv(value); else sv = newSVpvf("%lu", value); @@ -111,20 +113,22 @@ } %fragment(SWIG_AsVal_frag(unsigned long),"header", + fragment="<limits.h>", + fragment="<stdlib.h>", fragment="SWIG_CanCastAsInteger") { SWIGINTERN int SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val) { if (SvUOK(obj)) { UV v = SvUV(obj); - if (v <= ULONG_MAX) { + if (UVSIZE <= sizeof(*val) || v <= ULONG_MAX) { if (val) *val = v; return SWIG_OK; } return SWIG_OverflowError; } else if (SvIOK(obj)) { IV v = SvIV(obj); - if (v >= 0 && v <= ULONG_MAX) { + if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULONG_MAX)) { if (val) *val = v; return SWIG_OK; } @@ -163,14 +167,14 @@ /* long long */ %fragment(SWIG_From_frag(long long),"header", - fragment=SWIG_From_frag(long), - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdio.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE SV * SWIG_From_dec(long long)(long long value) { SV *sv; - if (value >= IV_MIN && value <= IV_MAX) + if (IVSIZE >= sizeof(value) || (value >= IV_MIN && value <= IV_MAX)) sv = newSViv((IV)(value)); else { //sv = newSVpvf("%lld", value); doesn't work in non 64bit Perl @@ -180,26 +184,28 @@ } return sv_2mortal(sv); } +%#endif } %fragment(SWIG_AsVal_frag(long long),"header", - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdlib.h>", fragment="SWIG_CanCastAsInteger") { - +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(long long)(SV *obj, long long *val) { if (SvUOK(obj)) { UV v = SvUV(obj); - if (v < LLONG_MAX) { + /* pretty sure this could allow v == LLONG MAX */ + if (UVSIZE < sizeof(*val) || v < LLONG_MAX) { if (val) *val = v; return SWIG_OK; } return SWIG_OverflowError; } else if (SvIOK(obj)) { IV v = SvIV(obj); - if (v >= LLONG_MIN && v <= LLONG_MAX) { + if (IVSIZE <= sizeof(*val) || (v >= LLONG_MIN && v <= LLONG_MAX)) { if (val) *val = v; return SWIG_OK; } @@ -235,19 +241,20 @@ } return SWIG_TypeError; } +%#endif } /* unsigned long long */ %fragment(SWIG_From_frag(unsigned long long),"header", - fragment=SWIG_From_frag(long long), - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdio.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE SV * SWIG_From_dec(unsigned long long)(unsigned long long value) { SV *sv; - if (value <= UV_MAX) + if (UVSIZE >= sizeof(value) || value <= UV_MAX) sv = newSVuv((UV)(value)); else { //sv = newSVpvf("%llu", value); doesn't work in non 64bit Perl @@ -257,21 +264,25 @@ } return sv_2mortal(sv); } +%#endif } %fragment(SWIG_AsVal_frag(unsigned long long),"header", - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdlib.h>", fragment="SWIG_CanCastAsInteger") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(unsigned long long)(SV *obj, unsigned long long *val) { if (SvUOK(obj)) { + /* pretty sure this should be conditional on + * (UVSIZE <= sizeof(*val) || v <= ULLONG_MAX) */ if (val) *val = SvUV(obj); return SWIG_OK; } else if (SvIOK(obj)) { IV v = SvIV(obj); - if (v >= 0 && v <= ULLONG_MAX) { + if (v >= 0 && (IVSIZE <= sizeof(*val) || v <= ULLONG_MAX)) { if (val) *val = v; return SWIG_OK; } else { @@ -307,6 +318,7 @@ } return SWIG_TypeError; } +%#endif } /* double */
diff --git a/share/swig/2.0.11/perl5/perlrun.swg b/share/swig/3.0.12/perl5/perlrun.swg similarity index 97% rename from share/swig/2.0.11/perl5/perlrun.swg rename to share/swig/3.0.12/perl5/perlrun.swg index ebc4fec..d1865de 100644 --- a/share/swig/2.0.11/perl5/perlrun.swg +++ b/share/swig/3.0.12/perl5/perlrun.swg
@@ -20,6 +20,7 @@ #define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags) #define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own) #define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags) +#define swig_owntype int /* for raw packed data */ #define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type) @@ -143,9 +144,9 @@ # ifdef PERL_OBJECT # define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) -static void SWIG_Perl_croak_null(CPerlObj *pPerl) +static void SWIGUNUSED SWIG_Perl_croak_null(CPerlObj *pPerl) # else -static void SWIG_croak_null() +static void SWIGUNUSED SWIG_croak_null() # endif { SV *err = get_sv("@", GV_ADD); @@ -288,7 +289,11 @@ /* Now see if the types match */ char *_c = HvNAME(SvSTASH(SvRV(sv))); tc = SWIG_TypeProxyCheck(_c,_t); +#ifdef SWIG_DIRECTORS + if (!tc && !sv_derived_from(sv,SWIG_Perl_TypeProxyName(_t))) { +#else if (!tc) { +#endif return SWIG_ERROR; } {
diff --git a/share/swig/2.0.11/perl5/perlruntime.swg b/share/swig/3.0.12/perl5/perlruntime.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlruntime.swg rename to share/swig/3.0.12/perl5/perlruntime.swg
diff --git a/share/swig/2.0.11/perl5/perlstrings.swg b/share/swig/3.0.12/perl5/perlstrings.swg similarity index 100% rename from share/swig/2.0.11/perl5/perlstrings.swg rename to share/swig/3.0.12/perl5/perlstrings.swg
diff --git a/share/swig/2.0.11/perl5/perltypemaps.swg b/share/swig/3.0.12/perl5/perltypemaps.swg similarity index 91% rename from share/swig/2.0.11/perl5/perltypemaps.swg rename to share/swig/3.0.12/perl5/perltypemaps.swg index 5df456f..ffec5ea 100644 --- a/share/swig/2.0.11/perl5/perltypemaps.swg +++ b/share/swig/3.0.12/perl5/perltypemaps.swg
@@ -18,7 +18,7 @@ #define SWIG_FROM_CALL_ARGS SWIG_PERL_CALL_ARGS_1 -/* Include fundamental fragemt definitions */ +/* Include fundamental fragment definitions */ %include <typemaps/fragments.swg> /* Look for user fragments file. */ @@ -35,9 +35,9 @@ * Unified typemap section * ------------------------------------------------------------ */ -/* No director supported in Perl */ -#ifdef SWIG_DIRECTOR_TYPEMAPS -#undef SWIG_DIRECTOR_TYPEMAPS +/* director support in Perl is experimental */ +#ifndef SWIG_DIRECTOR_TYPEMAPS +#define SWIG_DIRECTOR_TYPEMAPS #endif @@ -84,6 +84,9 @@ %typemap(varout,type="$1_descriptor") SWIGTYPE & "sv_setiv(SvRV($result),PTR2IV(&$1));"; +%typemap(varout,type="$1_descriptor") SWIGTYPE && + "sv_setiv(SvRV($result),PTR2IV(&$1));"; + %typemap(varout,type="$&1_descriptor") SWIGTYPE "sv_setiv(SvRV($result), PTR2IV(&$1));";
diff --git a/share/swig/2.0.11/perl5/perluserdir.swg b/share/swig/3.0.12/perl5/perluserdir.swg similarity index 100% rename from share/swig/2.0.11/perl5/perluserdir.swg rename to share/swig/3.0.12/perl5/perluserdir.swg
diff --git a/share/swig/2.0.11/perl5/reference.i b/share/swig/3.0.12/perl5/reference.i similarity index 100% rename from share/swig/2.0.11/perl5/reference.i rename to share/swig/3.0.12/perl5/reference.i
diff --git a/share/swig/2.0.11/perl5/std_common.i b/share/swig/3.0.12/perl5/std_common.i similarity index 91% rename from share/swig/2.0.11/perl5/std_common.i rename to share/swig/3.0.12/perl5/std_common.i index c365139..7c1ff23 100644 --- a/share/swig/2.0.11/perl5/std_common.i +++ b/share/swig/3.0.12/perl5/std_common.i
@@ -8,17 +8,19 @@ %apply size_t { std::size_t }; +%fragment("<string>"); %{ -#include <string> - +SWIGINTERN double SwigSvToNumber(SV* sv) { return SvIOK(sv) ? double(SvIVX(sv)) : SvNVX(sv); } +SWIGINTERN std::string SwigSvToString(SV* sv) { STRLEN len; char *ptr = SvPV(sv, len); return std::string(ptr, len); } +SWIGINTERN void SwigSvFromString(SV* sv, const std::string& s) { sv_setpvn(sv,s.data(),s.size()); }
diff --git a/share/swig/2.0.11/perl5/std_deque.i b/share/swig/3.0.12/perl5/std_deque.i similarity index 100% rename from share/swig/2.0.11/perl5/std_deque.i rename to share/swig/3.0.12/perl5/std_deque.i
diff --git a/share/swig/2.0.11/perl5/std_except.i b/share/swig/3.0.12/perl5/std_except.i similarity index 100% rename from share/swig/2.0.11/perl5/std_except.i rename to share/swig/3.0.12/perl5/std_except.i
diff --git a/share/swig/2.0.11/perl5/std_list.i b/share/swig/3.0.12/perl5/std_list.i similarity index 97% rename from share/swig/2.0.11/perl5/std_list.i rename to share/swig/3.0.12/perl5/std_list.i index ea264d6..cd5a611 100644 --- a/share/swig/2.0.11/perl5/std_list.i +++ b/share/swig/3.0.12/perl5/std_list.i
@@ -36,9 +36,9 @@ %{ #include <list> -#include <algorithm> -#include <stdexcept> %} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); // exported class @@ -106,7 +106,7 @@ } } %typemap(out) list<T> { - std::list<T>::const_iterator i; + std::list< T >::const_iterator i; unsigned int j; int len = $1.size(); SV **svs = new SV*[len]; @@ -125,7 +125,7 @@ %typecheck(SWIG_TYPECHECK_LIST) list<T> { { /* wrapped list? */ - std::list<T >* v; + std::list< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_&descriptor,0) != -1) { $1 = 1; @@ -158,7 +158,7 @@ const list<T>* { { /* wrapped list? */ - std::list<T >* v; + std::list< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor,0) != -1) { $1 = 1; @@ -265,7 +265,7 @@ } } %typemap(out) list<T> { - std::list<T>::const_iterator i; + std::list< T >::const_iterator i; unsigned int j; int len = $1.size(); SV **svs = new SV*[len]; @@ -282,7 +282,7 @@ %typecheck(SWIG_TYPECHECK_LIST) list<T> { { /* wrapped list? */ - std::list<T >* v; + std::list< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_&descriptor,0) != -1) { $1 = 1; @@ -313,7 +313,7 @@ const list<T>* { { /* wrapped list? */ - std::list<T >* v; + std::list< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor,0) != -1) { $1 = 1;
diff --git a/share/swig/2.0.11/perl5/std_map.i b/share/swig/3.0.12/perl5/std_map.i similarity index 89% rename from share/swig/2.0.11/perl5/std_map.i rename to share/swig/3.0.12/perl5/std_map.i index e7812f3..af49ed3 100644 --- a/share/swig/2.0.11/perl5/std_map.i +++ b/share/swig/3.0.12/perl5/std_map.i
@@ -12,9 +12,9 @@ %{ #include <map> -#include <algorithm> -#include <stdexcept> %} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); // exported class @@ -35,7 +35,7 @@ void clear(); %extend { const T& get(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) return i->second; else @@ -45,14 +45,14 @@ (*self)[key] = x; } void del(const K& key) throw (std::out_of_range) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); if (i != self->end()) self->erase(i); else throw std::out_of_range("key not found"); } bool has_key(const K& key) { - std::map<K,T >::iterator i = self->find(key); + std::map< K, T >::iterator i = self->find(key); return i != self->end(); } }
diff --git a/share/swig/2.0.11/perl5/std_pair.i b/share/swig/3.0.12/perl5/std_pair.i similarity index 100% rename from share/swig/2.0.11/perl5/std_pair.i rename to share/swig/3.0.12/perl5/std_pair.i
diff --git a/share/swig/2.0.11/perl5/std_string.i b/share/swig/3.0.12/perl5/std_string.i similarity index 100% rename from share/swig/2.0.11/perl5/std_string.i rename to share/swig/3.0.12/perl5/std_string.i
diff --git a/share/swig/2.0.11/perl5/std_vector.i b/share/swig/3.0.12/perl5/std_vector.i similarity index 98% rename from share/swig/2.0.11/perl5/std_vector.i rename to share/swig/3.0.12/perl5/std_vector.i index a3998ff..ec84494 100644 --- a/share/swig/2.0.11/perl5/std_vector.i +++ b/share/swig/3.0.12/perl5/std_vector.i
@@ -32,9 +32,9 @@ %{ #include <vector> -#include <algorithm> -#include <stdexcept> %} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); // exported class @@ -119,7 +119,7 @@ %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $&1_descriptor,0) != -1) { $1 = 1; @@ -151,7 +151,7 @@ const vector<T>* { { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor,0) != -1) { $1 = 1; @@ -292,7 +292,7 @@ %typecheck(SWIG_TYPECHECK_VECTOR) vector<T *> { { /* wrapped vector? */ - std::vector<T *>* v; + std::vector< T *>* v; int res = SWIG_ConvertPtr($input,(void **) &v, $&1_descriptor,0); if (SWIG_IsOK(res)) { $1 = 1; @@ -323,7 +323,7 @@ %typecheck(SWIG_TYPECHECK_VECTOR) const vector<T *>&,const vector<T *>* { { /* wrapped vector? */ - std::vector<T *> *v; + std::vector< T *> *v; int res = SWIG_ConvertPtr($input,%as_voidptrptr(&v), $1_descriptor,0); if (SWIG_IsOK(res)) { $1 = 1; @@ -466,7 +466,7 @@ %typecheck(SWIG_TYPECHECK_VECTOR) vector<T> { { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $&1_descriptor,0) != -1) { $1 = 1; @@ -496,7 +496,7 @@ const vector<T>* { { /* wrapped vector? */ - std::vector<T >* v; + std::vector< T >* v; if (SWIG_ConvertPtr($input,(void **) &v, $1_descriptor,0) != -1) { $1 = 1;
diff --git a/share/swig/2.0.11/perl5/stl.i b/share/swig/3.0.12/perl5/stl.i similarity index 100% rename from share/swig/2.0.11/perl5/stl.i rename to share/swig/3.0.12/perl5/stl.i
diff --git a/share/swig/2.0.11/perl5/typemaps.i b/share/swig/3.0.12/perl5/typemaps.i similarity index 100% rename from share/swig/2.0.11/perl5/typemaps.i rename to share/swig/3.0.12/perl5/typemaps.i
diff --git a/share/swig/2.0.11/php/const.i b/share/swig/3.0.12/php/const.i similarity index 74% copy from share/swig/2.0.11/php/const.i copy to share/swig/3.0.12/php/const.i index 78f3a8a..d62f162 100644 --- a/share/swig/2.0.11/php/const.i +++ b/share/swig/3.0.12/php/const.i
@@ -12,9 +12,11 @@ unsigned long, unsigned char, signed char, - bool, enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, $value);"; + "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; + +%typemap(consttab) bool + "SWIG_BOOL_CONSTANT($symname, ($1_type)$value);"; %typemap(consttab) float, double @@ -31,19 +33,15 @@ %typemap(consttab) SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [] { - zval *z_var; - MAKE_STD_ZVAL(z_var); - SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0); zend_constant c; - c.value = *z_var; + SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); zval_copy_ctor(&c.value); - size_t len = sizeof("$symname") - 1; - c.name = zend_strndup("$symname", len); - c.name_len = len+1; - c.flags = CONST_CS | CONST_PERSISTENT; + c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); + c.flags = CONST_CS; c.module_number = module_number; - zend_register_constant( &c TSRMLS_CC ); + zend_register_constant(&c); } /* Handled as a global variable. */
diff --git a/share/swig/3.0.12/php/director.swg b/share/swig/3.0.12/php/director.swg new file mode 100644 index 0000000..ea0eba8 --- /dev/null +++ b/share/swig/3.0.12/php/director.swg
@@ -0,0 +1,170 @@ +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that PHP proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_DIRECTOR_PHP_HEADER_ +#define SWIG_DIRECTOR_PHP_HEADER_ + +#include <string> +#include <exception> +#include <map> + +namespace Swig { + + /* memory handler */ + struct GCItem { + virtual ~GCItem() { + } + + virtual int get_own() const { + return 0; + } + }; + + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { + } + + GCItem_var& operator=(GCItem *item) { + GCItem *tmp = _item; + _item = item; + delete tmp; + return *this; + } + + ~GCItem_var() { + delete _item; + } + + GCItem * operator->() const { + return _item; + } + + private: + GCItem *_item; + }; + + struct GCItem_Object : GCItem { + GCItem_Object(int own) : _own(own) { + } + + virtual ~GCItem_Object() { + } + + int get_own() const { + return _own; + } + + private: + int _own; + }; + + template <typename Type> + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { + } + + virtual ~GCItem_T() { + delete _ptr; + } + + private: + Type *_ptr; + }; + + class Director { + protected: + // "mutable" so we can get a non-const pointer to it in const methods. + mutable zval swig_self; + typedef std::map<void *, GCItem_var> swig_ownership_map; + mutable swig_ownership_map swig_owner; + public: + Director(zval *self) { + ZVAL_COPY_VALUE(&swig_self, self); + } + + static bool swig_is_overridden_method(const char *cname, const char *lc_fname) { + bool result = false; + zend_string * cname_str = zend_string_init(cname, strlen(cname), 0); + zend_class_entry *ce = zend_lookup_class(cname_str); + if (ce) { + zval * mptr = zend_hash_str_find(&ce->function_table, lc_fname, strlen(lc_fname)); + if (mptr) { + // common.scope points to zend_class_entry for the declaring class, + // and there's only one of those per class, so we can just use a + // pointer compare here. + result = Z_FUNC_P(mptr)->common.scope != ce; + } + } + zend_string_release(cname_str); + return result; + } + + template <typename Type> + void swig_acquire_ownership(Type *vptr) const { + if (vptr) { + swig_owner[vptr] = new GCItem_T<Type>(vptr); + } + } + }; + + /* base class for director exceptions */ + class DirectorException : public std::exception { + protected: + std::string swig_msg; + public: + DirectorException(int code, const char *hdr, const char *msg) : swig_msg(hdr) { + if (msg && msg[0]) { + swig_msg += " "; + swig_msg += msg; + } + SWIG_ErrorCode() = code; + SWIG_ErrorMsg() = swig_msg.c_str(); + } + + virtual ~DirectorException() throw() { + } + + const char *what() const throw() { + return swig_msg.c_str(); + } + + static void raise(int code, const char *hdr, const char *msg) { + throw DirectorException(code, hdr, msg); + } + }; + + /* attempt to call a pure virtual method via a director method */ + class DirectorPureVirtualException : public DirectorException { + public: + DirectorPureVirtualException(const char *msg) + : DirectorException(E_ERROR, "SWIG director pure virtual method called", msg) { + } + + static void raise(const char *msg) { + throw DirectorPureVirtualException(msg); + } + }; + + /* any php exception that occurs during a director method call */ + class DirectorMethodException : public DirectorException + { + public: + DirectorMethodException() + : DirectorException(E_ERROR, "SWIG director method error", NULL) { + } + + DirectorMethodException(const char *msg) + : DirectorException(E_ERROR, "SWIG director method error", msg) { + } + + static void raise(const char *msg) { + throw DirectorMethodException(msg); + } + }; +} + +#endif
diff --git a/share/swig/2.0.11/php/factory.i b/share/swig/3.0.12/php/factory.i similarity index 100% rename from share/swig/2.0.11/php/factory.i rename to share/swig/3.0.12/php/factory.i
diff --git a/share/swig/3.0.12/php/globalvar.i b/share/swig/3.0.12/php/globalvar.i new file mode 100644 index 0000000..a5fd779 --- /dev/null +++ b/share/swig/3.0.12/php/globalvar.i
@@ -0,0 +1,294 @@ +/* ----------------------------------------------------------------------------- + * globalvar.i + * + * Global variables - add the variable to PHP + * ----------------------------------------------------------------------------- */ + +%typemap(varinit) char * +{ + zval z_var; + if ($1) { + ZVAL_STRING(&z_var, $1); + } else { + ZVAL_STR(&z_var, ZSTR_EMPTY_ALLOC()); + } + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) char [] +{ + zval z_var; + ZVAL_STRING(&z_var, $1); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) int, + unsigned int, + unsigned short, + short, + unsigned short, + long, + unsigned long, + signed char, + unsigned char, + enum SWIGTYPE +{ + zval z_var; + ZVAL_LONG(&z_var, (long)$1); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) bool +{ + zval z_var; + ZVAL_BOOL(&z_var, ($1)?1:0); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) float, double +{ + zval z_var; + ZVAL_DOUBLE(&z_var, (double)$1); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) char +{ + zval z_var; + char c = $1; + ZVAL_STRINGL(&z_var, &c, 1); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) SWIGTYPE *, SWIGTYPE [] +{ + zval z_var; + SWIG_SetPointerZval(&z_var, (void*)$1, $1_descriptor, 0); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE && +{ + zval z_var; + SWIG_SetPointerZval(&z_var, (void*)&$1, $&1_descriptor, 0); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit) char [ANY] +{ + zval z_var; + /* varinit char [ANY] */ + ZVAL_STRINGL(&z_var, $1, $1_dim0); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &z_var); +} + +%typemap(varinit, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) +{ + zval resource; + void * p = emalloc(sizeof($1)); + memcpy(p, &$1, sizeof($1)); + ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr)); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource); +} + +%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + $1 = zval_get_long(z_var); +} + +%typemap(varin) bool +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + convert_to_boolean(z_var); + $1 = (Z_TYPE_P(z_var) == IS_TRUE); +} + +%typemap(varin) double,float +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + $1 = zval_get_double(z_var); +} + +%typemap(varin) char +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + convert_to_string(z_var); + if ($1 != Z_STRVAL_P(z_var)[0]) { + $1 = Z_STRVAL_P(z_var)[0]; + } +} + +%typemap(varin) char * +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + char *s1; + convert_to_string(z_var); + s1 = Z_STRVAL_P(z_var); + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { + if (s1) + $1 = estrdup(s1); + else + $1 = NULL; + } +} + + +%typemap(varin) SWIGTYPE [] +{ + if($1) { + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, $owner); + } +} + +%typemap(varin) char [ANY] +{ + zval **z_var; + char *s1; + + zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1, (void**)&z_var); + s1 = Z_STRVAL_P(z_var); + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { + if (s1) + strncpy($1, s1, $1_dim0); + } +} + +%typemap(varin) SWIGTYPE +{ + zval *z_var; + $&1_ltype _temp; + + z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + if (SWIG_ConvertPtr(z_var, (void**)&_temp, $&1_descriptor, 0) < 0) { + SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor"); + } + + $1 = *($&1_ltype)_temp; + +} + +%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && +{ + zval *z_var; + $1_ltype _temp; + + z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + if (SWIG_ConvertPtr(z_var, (void **)&_temp, $1_descriptor, 0) < 0) { + SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor"); + } + + $1 = ($1_ltype)_temp; +} + +%typemap(varin, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + void * p = (void*)zend_fetch_resource_ex(z_var, SWIG_MEMBER_PTR, swig_member_ptr); + memcpy(&$1, p, sizeof($1)); +} + +%typemap(varout) int, + unsigned int, + unsigned short, + short, + long, + unsigned long, + signed char, + unsigned char, + enum SWIGTYPE +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + if ($1 != ($1_ltype)Z_LVAL_P(z_var)) { + z_var->value.lval = (long)$1; + } +} + +//SAMFIX need to cast zval->type, what if zend-hash_find fails? etc? +%typemap(varout) bool +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + if ($1 != ($1_ltype)Z_LVAL_P(z_var)) { + z_var->value.lval = (long)$1; + } +} + +%typemap(varout) double, float +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + if ($1 != ($1_ltype)Z_DVAL_P(z_var)) { + z_var->value.dval = (double)$1; + } +} + +%typemap(varout) char +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + char c = $1; + if ($1 != Z_STRVAL_P(z_val)[0]) { + ZVAL_STRING(z_var, &c); + } +} + +%typemap(varout) char * +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + const char *s1 = Z_STRVAL_P(z_var); + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { + if (s1) + efree(s1); + if ($1) { + (z_var)->value.str.val = estrdup($1); + (z_var)->value.str.len = strlen($1) + 1; + } else { + (z_var)->value.str.val = 0; + (z_var)->value.str.len = 0; + } + } +} + +%typemap(varout) SWIGTYPE +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + SWIG_SetPointerZval(z_var, (void*)&$1, $&1_descriptor, 0); +} + +%typemap(varout) SWIGTYPE [] +{ + if($1) { + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0); + } +} + +%typemap(varout) char [ANY] +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + const char *s1 = Z_STRVAL_P(z_var); +deliberate error cos this code looks bogus to me + if ((s1 == NULL) || strcmp(s1, $1)) { + if ($1) { + (z_var)->value.str.val = estrdup($1); + (z_var)->value.str.len = strlen($1) + 1; + } else { + (z_var)->value.str.val = 0; + (z_var)->value.str.len = 0; + } + } +} + +%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && +{ + zval *z_var = zend_hash_str_find(&EG(symbol_table), "$1", sizeof("$1") - 1); + SWIG_SetPointerZval(z_var, (void*)$1, $1_descriptor, 0); +} + +%typemap(varout, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) +{ + zval resource; + void * p = emalloc(sizeof($1)); + memcpy(p, &$1, sizeof($1)); + ZVAL_RES(&resource, zend_register_resource(p, swig_member_ptr)); + zend_hash_str_add(&EG(symbol_table), "$1", sizeof("$1") - 1, &resource); +}
diff --git a/share/swig/2.0.11/php/php.swg b/share/swig/3.0.12/php/php.swg similarity index 70% copy from share/swig/2.0.11/php/php.swg copy to share/swig/3.0.12/php/php.swg index f27e1fe..c9b9a52 100644 --- a/share/swig/2.0.11/php/php.swg +++ b/share/swig/3.0.12/php/php.swg
@@ -71,77 +71,87 @@ // char array can be in/out, though the passed string may not be big enough... // so we have to size it %typemap(in) char[ANY] -{ - convert_to_string_ex($input); - $1 = ($1_ltype) Z_STRVAL_PP($input); -} +%{ + convert_to_string(&$input); + $1 = ($1_ltype) Z_STRVAL($input); +%} -%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) { - convert_to_string_ex($input); - $1 = ($1_ltype) Z_STRVAL_PP($input); - $2 = ($2_ltype) Z_STRLEN_PP($input); -} +%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) %{ + convert_to_string(&$input); + $1 = ($1_ltype) Z_STRVAL($input); + $2 = ($2_ltype) Z_STRLEN($input); +%} /* Object passed by value. Convert to a pointer */ %typemap(in) SWIGTYPE ($&1_ltype tmp) -{ - if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); } $1 = *tmp; -} +%} %typemap(directorout) SWIGTYPE ($&1_ltype tmp) -{ - if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); +%{ + /* If exit was via exception, PHP NULL is returned so skip the conversion. */ + if (!EG(exception)) { + if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + $result = *tmp; } - $result = *tmp; -} +%} %typemap(in) SWIGTYPE *, SWIGTYPE [] -{ - if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } -} +%} %typemap(in) SWIGTYPE & -{ - if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); } -} +%} + +%typemap(in) SWIGTYPE && +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); + } +%} %typemap(in) SWIGTYPE *const& ($*ltype temp) -{ - if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor"); } $1 = ($1_ltype)&temp; -} +%} %typemap(in) SWIGTYPE *DISOWN -{ - if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) { SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); } -} +%} %typemap(argout) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE&; + SWIGTYPE &, + SWIGTYPE &&; %typemap(in) void * -{ - if(SWIG_ConvertPtr(*$input, (void **) &$1, 0, 0) < 0) { +%{ + if (SWIG_ConvertPtr(&$input, (void **) &$1, 0, 0) < 0) { /* Allow NULL from php for void* */ - if ((*$input)->type==IS_NULL) $1=0; + if (Z_ISNULL($input)) $1=0; else SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); } -} +%} /* Special case when void* is passed by reference so it can be made to point to opaque api structs */ @@ -150,9 +160,9 @@ { /* If they pass NULL by reference, make it into a void* This bit should go in arginit if arginit support init-ing scripting args */ - if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) { + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { /* So... we didn't get a ref or ptr, but we'll accept NULL by reference */ - if (!((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input))) { + if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) { /* wasn't a pre/ref/thing, OR anything like an int thing */ SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname."); } @@ -160,7 +170,7 @@ force=0; if (arg1==NULL) { #ifdef __cplusplus - ptr=new $*1_ltype; + ptr=new $*1_ltype(); #else ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); #endif @@ -171,11 +181,11 @@ } %typemap(argout) void **, void *& -{ +%{ if (force$argnum) { - SWIG_SetPointerZval( *$input, (void*) ptr$argnum, $*1_descriptor, 1); + SWIG_SetPointerZval(&$input, (void*) ptr$argnum, $*1_descriptor, 1); } -} +%} /* Typemap for output values */ @@ -188,32 +198,34 @@ signed char, unsigned char, bool, - size_t, - enum SWIGTYPE -{ - ZVAL_LONG(return_value,$1); -} + size_t +%{ + RETVAL_LONG($1); +%} + +%typemap(out) enum SWIGTYPE +%{ + RETVAL_LONG((long)$1); +%} %typemap(out) long long %{ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { - return_value->value.lval = (long)($1); - return_value->type = IS_LONG; + RETVAL_LONG((long)($1)); } else { char temp[256]; sprintf(temp, "%lld", (long long)$1); - ZVAL_STRING(return_value, temp, 1); + RETVAL_STRING(temp); } %} %typemap(out) unsigned long long %{ if ($1 <= (unsigned long long)LONG_MAX) { - return_value->value.lval = (long)($1); - return_value->type = IS_LONG; + RETVAL_LONG((long)($1)); } else { char temp[256]; sprintf(temp, "%llu", (unsigned long long)$1); - ZVAL_STRING(return_value, temp, 1); + RETVAL_STRING(temp); } %} @@ -226,32 +238,39 @@ const signed char &, const unsigned char &, const bool &, - const size_t &, - const enum SWIGTYPE & -{ - ZVAL_LONG(return_value,*$1); -} + const size_t & +%{ + RETVAL_LONG(*$1); +%} + +%typemap(out) const enum SWIGTYPE & +%{ + RETVAL_LONG((long)*$1); +%} + +%typemap(out) const enum SWIGTYPE && +%{ + RETVAL_LONG((long)*$1); +%} %typemap(out) const long long & %{ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { - return_value->value.lval = (long)(*$1); - return_value->type = IS_LONG; + RETVAL_LONG((long)(*$1)); } else { char temp[256]; sprintf(temp, "%lld", (long long)(*$1)); - ZVAL_STRING(return_value, temp, 1); + RETVAL_STRING(temp); } %} %typemap(out) const unsigned long long & %{ if (*$1 <= (unsigned long long)LONG_MAX) { - return_value->value.lval = (long)(*$1); - return_value->type = IS_LONG; + RETVAL_LONG((long)(*$1)); } else { char temp[256]; sprintf(temp, "%llu", (unsigned long long)(*$1)); - ZVAL_STRING(return_value, temp, 1); + RETVAL_STRING(temp); } %} @@ -265,84 +284,90 @@ unsigned char, size_t, enum SWIGTYPE -{ +%{ ZVAL_LONG($input,$1); -} +%} + +%typemap(directorin) enum SWIGTYPE +%{ + ZVAL_LONG($input, (long)$1_name); +%} %typemap(directorin) char *, char [] -{ +%{ if(!$1) { ZVAL_NULL($input); } else { - ZVAL_STRING($input, (char *)$1, 1); + ZVAL_STRING($input, (const char*)$1); } -} +%} %typemap(out) bool -{ - ZVAL_BOOL(return_value,($1)?1:0); -} +%{ + RETVAL_BOOL(($1) ? 1 : 0); +%} %typemap(out) const bool & -{ - ZVAL_BOOL(return_value,(*$1)?1:0); -} +%{ + RETVAL_BOOL((*$1) ? 1 : 0); +%} %typemap(directorin) bool -{ - ZVAL_BOOL($input,($1)?1:0); -} +%{ + ZVAL_BOOL($input, ($1) ? 1 : 0); +%} %typemap(out) float, double -{ - ZVAL_DOUBLE(return_value,$1); -} +%{ + RETVAL_DOUBLE($1); +%} %typemap(out) const float &, const double & -{ - ZVAL_DOUBLE(return_value,*$1); -} +%{ + RETVAL_DOUBLE(*$1); +%} %typemap(directorin) float, double -{ - ZVAL_DOUBLE($input,$1); -} +%{ + ZVAL_DOUBLE($input, $1); +%} %typemap(out) char -{ - ZVAL_STRINGL(return_value,&$1, 1, 1); -} +%{ + RETVAL_STRINGL(&$1, 1); +%} %typemap(out) const char & -{ - ZVAL_STRINGL(return_value,&*$1, 1, 1); -} +%{ + RETVAL_STRINGL(&*$1, 1); +%} %typemap(out) char *, char [] -{ - if(!$1) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)$1, 1); - } -} +%{ + if (!$1) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)$1); + } +%} %typemap(out) char *& -{ - if(!*$1) { - ZVAL_NULL(return_value); - } else { - ZVAL_STRING(return_value, (char *)*$1, 1); - } -} +%{ + if (!*$1) { + RETVAL_NULL(); + } else { + RETVAL_STRING((const char *)*$1); + } +%} %typemap(out) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner); %} @@ -354,7 +379,8 @@ %typemap(directorin) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2); %} @@ -363,16 +389,12 @@ { void * p = emalloc(sizeof($1)); memcpy(p, &$1, sizeof($1)); - zval * resource; - MAKE_STD_ZVAL(resource); - ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr); - - SWIG_SetPointerZval(return_value, (void *)&$1, $1_descriptor, $owner); + RETVAL_RES(zend_register_resource(p, swig_member_ptr)); } %typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) { - void * p = (void*)zend_fetch_resource($input TSRMLS_CC, -1, SWIG_MEMBER_PTR, NULL, 1, swig_member_ptr); + void * p = (void*)zend_fetch_resource_ex(&$input, SWIG_MEMBER_PTR, swig_member_ptr); memcpy(&$1, p, sizeof($1)); } @@ -398,9 +420,9 @@ #endif %typemap(directorin) SWIGTYPE -{ - SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1), $&1_descriptor, 2); -} +%{ + SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2); +%} %typemap(out) void ""; @@ -408,7 +430,7 @@ { int len = 0; while (len < $1_dim0 && $1[len]) ++len; - RETVAL_STRINGL($1, len, 1); + RETVAL_STRINGL($1, len); } // This typecheck does hard checking for proper argument type. If you want @@ -416,7 +438,13 @@ // it yourself before passing it (e.g. (string)4.7 or (int)"6"). %define %php_typecheck(_type,_prec,is) %typemap(typecheck,precedence=_prec) _type, const _type & - " $1 = (Z_TYPE_PP($input) == is); " + " $1 = (Z_TYPE($input) == is);" +%enddef + +// Like %php_typecheck but allows either of two values. +%define %php_typecheck2(_type,_prec,is1,is2) +%typemap(typecheck,precedence=_prec) _type, const _type & + " $1 = (Z_TYPE($input) == is1 || Z_TYPE($input) == is2);" %enddef %php_typecheck(int,SWIG_TYPECHECK_INTEGER,IS_LONG) @@ -431,40 +459,41 @@ %php_typecheck(unsigned char,SWIG_TYPECHECK_UINT8,IS_LONG) %php_typecheck(size_t,SWIG_TYPECHECK_SIZE,IS_LONG) %php_typecheck(enum SWIGTYPE,SWIG_TYPECHECK_INTEGER,IS_LONG) -%php_typecheck(bool,SWIG_TYPECHECK_BOOL,IS_BOOL) +%php_typecheck2(bool,SWIG_TYPECHECK_BOOL,IS_TRUE,IS_FALSE) %php_typecheck(float,SWIG_TYPECHECK_FLOAT,IS_DOUBLE) %php_typecheck(double,SWIG_TYPECHECK_DOUBLE,IS_DOUBLE) %php_typecheck(char,SWIG_TYPECHECK_CHAR,IS_STRING) %typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) char *, char *&, char [] - " $1 = (Z_TYPE_PP($input) == IS_STRING); " + " $1 = (Z_TYPE($input) == IS_STRING); " %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE { void *tmp; - _v = (SWIG_ConvertPtr(*$input, (void **)&tmp, $&1_descriptor, 0) >= 0); + _v = (SWIG_ConvertPtr(&$input, (void **)&tmp, $&1_descriptor, 0) >= 0); } %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const& { void *tmp; - _v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0); + _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $1_descriptor, 0) >= 0); } %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const& { void *tmp; - _v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $*1_descriptor, 0) >= 0); + _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, $*1_descriptor, 0) >= 0); } %typecheck(SWIG_TYPECHECK_VOIDPTR) void * { void *tmp; - _v = (SWIG_ConvertPtr(*$input, (void**)&tmp, 0, 0) >= 0); + _v = (SWIG_ConvertPtr(&$input, (void**)&tmp, 0, 0) >= 0); } /* Exception handling */ @@ -474,24 +503,25 @@ short, unsigned int, unsigned long, - unsigned short { - zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), $1 TSRMLS_CC); + unsigned short %{ + zend_throw_exception(NULL, "C++ $1_type exception thrown", $1); return; -} +%} -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ (void)$1; - zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), 0 TSRMLS_CC); + zend_throw_exception(NULL, "C++ $1_type exception thrown", 0); return; %} %typemap(throws) char * %{ - zend_throw_exception(NULL, const_cast<char*>($1), 0 TSRMLS_CC); + zend_throw_exception(NULL, $1, 0); return; %} /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/php/phpinit.swg b/share/swig/3.0.12/php/phpinit.swg similarity index 67% copy from share/swig/2.0.11/php/phpinit.swg copy to share/swig/3.0.12/php/phpinit.swg index 6e5cc29..1f252d1 100644 --- a/share/swig/2.0.11/php/phpinit.swg +++ b/share/swig/3.0.12/php/phpinit.swg
@@ -6,20 +6,20 @@ %insert(init) "swiginit.swg" %init %{ - SWIG_php_minit { +SWIG_php_minit { SWIG_InitializeModule(0); %} -%fragment("swig_php_init_member_ptr2", "header") { -#define SWIG_MEMBER_PTR ((char*)"CLASS::*") +%fragment("swig_php_init_member_ptr2", "header") %{ +#define SWIG_MEMBER_PTR "CLASS::*" -static void swig_member_ptr_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - efree(rsrc->ptr); +static void swig_member_ptr_dtor(zend_resource *res) { + efree(res->ptr); } static int swig_member_ptr = 0; -} +%} -%fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") { +%fragment("swig_php_init_member_ptr", "init", fragment="swig_php_init_member_ptr2") %{ swig_member_ptr = zend_register_list_destructors_ex(swig_member_ptr_dtor, NULL, SWIG_MEMBER_PTR, module_number); -} +%}
diff --git a/share/swig/3.0.12/php/phpkw.swg b/share/swig/3.0.12/php/phpkw.swg new file mode 100644 index 0000000..db451f9 --- /dev/null +++ b/share/swig/3.0.12/php/phpkw.swg
@@ -0,0 +1,881 @@ +/* ----------------------------------------------------------------------------- + * phpkw.swg + * ----------------------------------------------------------------------------- */ + +/* Keyword (case insensitive) */ +#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x` + +/* Class (case insensitive) */ +#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x` + +/* Constant (case insensitive) */ +#define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x` +#define PHPBN1b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant,sourcefmt="%(lower)s") `x` +%define PHPBN1(X) + PHPBN1a(X); PHPBN1b(X) +%enddef + +/* Constant (case sensitive) */ +#define PHPBN2a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem) `x` +#define PHPBN2b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant) `x` +%define PHPBN2(X) + PHPBN2a(X); PHPBN2b(X) +%enddef + +#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x` + +/* From: http://php.net/manual/en/reserved.keywords.php + * "You cannot use any of the following words as constants, class names, + * function or method names. Using them as variable names is generally OK, but + * could lead to confusion." + */ +/* Check is case insensitive - these *MUST* be listed in lower case here */ +PHPKW(__halt_compiler); +PHPKW(abstract); +PHPKW(and); +PHPKW(array); +PHPKW(as); +PHPKW(break); +PHPKW(callable); // As of PHP 5.4 +PHPKW(case); +PHPKW(catch); +PHPKW(class); +PHPKW(clone); +PHPKW(const); +PHPKW(continue); +PHPKW(declare); +PHPKW(default); +PHPKW(die); // "Language construct" +PHPKW(do); +PHPKW(echo); // "Language construct" +PHPKW(else); +PHPKW(elseif); +PHPKW(empty); // "Language construct" +PHPKW(enddeclare); +PHPKW(endfor); +PHPKW(endforeach); +PHPKW(endif); +PHPKW(endswitch); +PHPKW(endwhile); +PHPKW(eval); // "Language construct" +PHPKW(exit); // "Language construct" +PHPKW(extends); +PHPKW(final); +PHPKW(finally); // As of PHP 5.5 +PHPKW(for); +PHPKW(foreach); +PHPKW(function); +PHPKW(global); +PHPKW(goto); // As of PHP 5.3 +PHPKW(if); +PHPKW(implements); +PHPKW(include); // "Language construct" +PHPKW(include_once); // "Language construct" +PHPKW(instanceof); +PHPKW(insteadof); // As of PHP 5.4 +PHPKW(interface); +PHPKW(isset); // "Language construct" +PHPKW(list); // "Language construct" +PHPKW(namespace); // As of PHP 5.3 +PHPKW(new); +PHPKW(or); +PHPKW(print); // "Language construct" +PHPKW(private); +PHPKW(protected); +PHPKW(public); +PHPKW(require); // "Language construct" +PHPKW(require_once); // "Language construct" +PHPKW(return); // "Language construct" +PHPKW(static); +PHPKW(switch); +PHPKW(throw); +PHPKW(trait); // As of PHP 5.4 +PHPKW(try); +PHPKW(unset); // "Language construct" +PHPKW(use); +PHPKW(var); +PHPKW(while); +PHPKW(xor); +PHPKW(yield); // As of PHP 5.5 + +// Compile-time "magic" constants +// From: http://php.net/manual/en/reserved.keywords.php +// also at: http://php.net/manual/en/language.constants.predefined.php +/* These *MUST* be listed in lower case here */ +PHPKW(__class__); +PHPKW(__dir__); // As of PHP 5.3 +PHPKW(__file__); +PHPKW(__function__); +PHPKW(__line__); +PHPKW(__method__); +PHPKW(__namespace__); // As of PHP 5.3 +PHPKW(__trait__); // As of PHP 5.4 + +/* We classify these as built-in names since they conflict, but PHP still runs */ + +/* Predefined case-insensitive constants */ +/* These *MUST* be listed in lower case here */ +PHPBN1(null); +PHPBN1(true); +PHPBN1(false); + +/* "Core Predefined Constants" from http://php.net/manual/en/reserved.constants.php */ +/* These are case sensitive */ +PHPBN2(PHP_VERSION); +PHPBN2(PHP_MAJOR_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_MINOR_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_RELEASE_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_VERSION_ID); // As of PHP 5.2.7 +PHPBN2(PHP_EXTRA_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_ZTS); // As of PHP 5.2.7 +PHPBN2(PHP_DEBUG); // As of PHP 5.2.7 +PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3.0 +PHPBN2(PHP_OS); +PHPBN2(PHP_SAPI); +PHPBN2(PHP_EOL); // As of PHP 5.0.2 +PHPBN2(PHP_INT_MAX); // As of PHP 5.0.5 +PHPBN2(PHP_INT_SIZE); // As of PHP 5.0.5 +PHPBN2(DEFAULT_INCLUDE_PATH); +PHPBN2(PEAR_INSTALL_DIR); +PHPBN2(PEAR_EXTENSION_DIR); +PHPBN2(PHP_EXTENSION_DIR); +PHPBN2(PHP_PREFIX); +PHPBN2(PHP_BINDIR); +PHPBN2(PHP_BINARY); // As of PHP 5.4 +PHPBN2(PHP_MANDIR); // As of PHP 5.3.7 +PHPBN2(PHP_LIBDIR); +PHPBN2(PHP_DATADIR); +PHPBN2(PHP_SYSCONFDIR); +PHPBN2(PHP_LOCALSTATEDIR); +PHPBN2(PHP_CONFIG_FILE_PATH); +PHPBN2(PHP_CONFIG_FILE_SCAN_DIR); +PHPBN2(PHP_SHLIB_SUFFIX); +PHPBN2(E_ERROR); +PHPBN2(E_WARNING); +PHPBN2(E_PARSE); +PHPBN2(E_NOTICE); +PHPBN2(E_CORE_ERROR); +PHPBN2(E_CORE_WARNING); +PHPBN2(E_COMPILE_ERROR); +PHPBN2(E_COMPILE_WARNING); +PHPBN2(E_USER_ERROR); +PHPBN2(E_USER_WARNING); +PHPBN2(E_USER_NOTICE); +PHPBN2(E_DEPRECATED); // As of PHP 5.3.0 +PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3.0 +PHPBN2(E_ALL); +PHPBN2(E_STRICT); +PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0 +// TRUE, FALSE, NULL are listed on the same page, but are actually +// case-insensitive, whereas all the other constants listed there seem to be +// case-sensitive, so we handle TRUE, FALSE, NULL in PHPBN1. +PHPBN2(PHP_OUTPUT_HANDLER_START); +PHPBN2(PHP_OUTPUT_HANDLER_CONT); +PHPBN2(PHP_OUTPUT_HANDLER_END); +/* These don't actually seem to be set (tested on Linux, I guess they're + * Windows only?) */ +PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_NT_SERVER); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_NT_WORKSTATION); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_BUILD); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_MAJOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_MINOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_PLATFORM); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3 +/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */ +PHPBN2(EXTR_OVERWRITE); +PHPBN2(EXTR_SKIP); +PHPBN2(EXTR_PREFIX_SAME); +PHPBN2(EXTR_PREFIX_ALL); +PHPBN2(EXTR_PREFIX_INVALID); +PHPBN2(EXTR_PREFIX_IF_EXISTS); +PHPBN2(EXTR_IF_EXISTS); +PHPBN2(SORT_ASC); +PHPBN2(SORT_DESC); +PHPBN2(SORT_REGULAR); +PHPBN2(SORT_NUMERIC); +PHPBN2(SORT_STRING); +PHPBN2(CASE_LOWER); +PHPBN2(CASE_UPPER); +PHPBN2(COUNT_NORMAL); +PHPBN2(COUNT_RECURSIVE); +PHPBN2(ASSERT_ACTIVE); +PHPBN2(ASSERT_CALLBACK); +PHPBN2(ASSERT_BAIL); +PHPBN2(ASSERT_WARNING); +PHPBN2(ASSERT_QUIET_EVAL); +PHPBN2(CONNECTION_ABORTED); +PHPBN2(CONNECTION_NORMAL); +PHPBN2(CONNECTION_TIMEOUT); +PHPBN2(INI_USER); +PHPBN2(INI_PERDIR); +PHPBN2(INI_SYSTEM); +PHPBN2(INI_ALL); +PHPBN2(INI_SCANNER_NORMAL); // As of PHP 5.3 +PHPBN2(INI_SCANNER_RAW); // As of PHP 5.3 +PHPBN2(M_E); +PHPBN2(M_LOG2E); +PHPBN2(M_LOG10E); +PHPBN2(M_LN2); +PHPBN2(M_LN10); +PHPBN2(M_PI); +PHPBN2(M_PI_2); +PHPBN2(M_PI_4); +PHPBN2(M_1_PI); +PHPBN2(M_2_PI); +PHPBN2(M_2_SQRTPI); +PHPBN2(M_SQRT2); +PHPBN2(M_SQRT1_2); +PHPBN2(M_EULER); // As of PHP 5.2 +PHPBN2(M_LNPI); // As of PHP 5.2 +PHPBN2(M_SQRT3); // As of PHP 5.2 +PHPBN2(M_SQRTPI); // As of PHP 5.2 +PHPBN2(CRYPT_SALT_LENGTH); +PHPBN2(CRYPT_STD_DES); +PHPBN2(CRYPT_EXT_DES); +PHPBN2(CRYPT_MD5); +PHPBN2(CRYPT_BLOWFISH); +PHPBN2(DIRECTORY_SEPARATOR); +PHPBN2(SEEK_SET); +PHPBN2(SEEK_CUR); +PHPBN2(SEEK_END); +PHPBN2(LOCK_SH); +PHPBN2(LOCK_EX); +PHPBN2(LOCK_UN); +PHPBN2(LOCK_NB); +PHPBN2(HTML_SPECIALCHARS); +PHPBN2(HTML_ENTITIES); +PHPBN2(ENT_COMPAT); +PHPBN2(ENT_QUOTES); +PHPBN2(ENT_NOQUOTES); +PHPBN2(INFO_GENERAL); +PHPBN2(INFO_CREDITS); +PHPBN2(INFO_CONFIGURATION); +PHPBN2(INFO_MODULES); +PHPBN2(INFO_ENVIRONMENT); +PHPBN2(INFO_VARIABLES); +PHPBN2(INFO_LICENSE); +PHPBN2(INFO_ALL); +PHPBN2(CREDITS_GROUP); +PHPBN2(CREDITS_GENERAL); +PHPBN2(CREDITS_SAPI); +PHPBN2(CREDITS_MODULES); +PHPBN2(CREDITS_DOCS); +PHPBN2(CREDITS_FULLPAGE); +PHPBN2(CREDITS_QA); +PHPBN2(CREDITS_ALL); +PHPBN2(STR_PAD_LEFT); +PHPBN2(STR_PAD_RIGHT); +PHPBN2(STR_PAD_BOTH); +PHPBN2(PATHINFO_DIRNAME); +PHPBN2(PATHINFO_BASENAME); +PHPBN2(PATHINFO_EXTENSION); +PHPBN2(PATHINFO_FILENAME); // As of PHP 5.2 +PHPBN2(PATH_SEPARATOR); +PHPBN2(CHAR_MAX); +PHPBN2(LC_CTYPE); +PHPBN2(LC_NUMERIC); +PHPBN2(LC_TIME); +PHPBN2(LC_COLLATE); +PHPBN2(LC_MONETARY); +PHPBN2(LC_ALL); +PHPBN2(LC_MESSAGES); +PHPBN2(ABDAY_1); +PHPBN2(ABDAY_2); +PHPBN2(ABDAY_3); +PHPBN2(ABDAY_4); +PHPBN2(ABDAY_5); +PHPBN2(ABDAY_6); +PHPBN2(ABDAY_7); +PHPBN2(DAY_1); +PHPBN2(DAY_2); +PHPBN2(DAY_3); +PHPBN2(DAY_4); +PHPBN2(DAY_5); +PHPBN2(DAY_6); +PHPBN2(DAY_7); +PHPBN2(ABMON_1); +PHPBN2(ABMON_2); +PHPBN2(ABMON_3); +PHPBN2(ABMON_4); +PHPBN2(ABMON_5); +PHPBN2(ABMON_6); +PHPBN2(ABMON_7); +PHPBN2(ABMON_8); +PHPBN2(ABMON_9); +PHPBN2(ABMON_10); +PHPBN2(ABMON_11); +PHPBN2(ABMON_12); +PHPBN2(MON_1); +PHPBN2(MON_2); +PHPBN2(MON_3); +PHPBN2(MON_4); +PHPBN2(MON_5); +PHPBN2(MON_6); +PHPBN2(MON_7); +PHPBN2(MON_8); +PHPBN2(MON_9); +PHPBN2(MON_10); +PHPBN2(MON_11); +PHPBN2(MON_12); +PHPBN2(AM_STR); +PHPBN2(PM_STR); +PHPBN2(D_T_FMT); +PHPBN2(D_FMT); +PHPBN2(T_FMT); +PHPBN2(T_FMT_AMPM); +PHPBN2(ERA); +PHPBN2(ERA_YEAR); +PHPBN2(ERA_D_T_FMT); +PHPBN2(ERA_D_FMT); +PHPBN2(ERA_T_FMT); +PHPBN2(ALT_DIGITS); +PHPBN2(INT_CURR_SYMBOL); +PHPBN2(CURRENCY_SYMBOL); +PHPBN2(CRNCYSTR); +PHPBN2(MON_DECIMAL_POINT); +PHPBN2(MON_THOUSANDS_SEP); +PHPBN2(MON_GROUPING); +PHPBN2(POSITIVE_SIGN); +PHPBN2(NEGATIVE_SIGN); +PHPBN2(INT_FRAC_DIGITS); +PHPBN2(FRAC_DIGITS); +PHPBN2(P_CS_PRECEDES); +PHPBN2(P_SEP_BY_SPACE); +PHPBN2(N_CS_PRECEDES); +PHPBN2(N_SEP_BY_SPACE); +PHPBN2(P_SIGN_POSN); +PHPBN2(N_SIGN_POSN); +PHPBN2(DECIMAL_POINT); +PHPBN2(RADIXCHAR); +PHPBN2(THOUSANDS_SEP); +PHPBN2(THOUSEP); +PHPBN2(GROUPING); +PHPBN2(YESEXPR); +PHPBN2(NOEXPR); +PHPBN2(YESSTR); +PHPBN2(NOSTR); +PHPBN2(CODESET); +PHPBN2(LOG_EMERG); +PHPBN2(LOG_ALERT); +PHPBN2(LOG_CRIT); +PHPBN2(LOG_ERR); +PHPBN2(LOG_WARNING); +PHPBN2(LOG_NOTICE); +PHPBN2(LOG_INFO); +PHPBN2(LOG_DEBUG); +PHPBN2(LOG_KERN); +PHPBN2(LOG_USER); +PHPBN2(LOG_MAIL); +PHPBN2(LOG_DAEMON); +PHPBN2(LOG_AUTH); +PHPBN2(LOG_SYSLOG); +PHPBN2(LOG_LPR); +PHPBN2(LOG_NEWS); +PHPBN2(LOG_UUCP); +PHPBN2(LOG_CRON); +PHPBN2(LOG_AUTHPRIV); +PHPBN2(LOG_LOCAL0); +PHPBN2(LOG_LOCAL1); +PHPBN2(LOG_LOCAL2); +PHPBN2(LOG_LOCAL3); +PHPBN2(LOG_LOCAL4); +PHPBN2(LOG_LOCAL5); +PHPBN2(LOG_LOCAL6); +PHPBN2(LOG_LOCAL7); +PHPBN2(LOG_PID); +PHPBN2(LOG_CONS); +PHPBN2(LOG_ODELAY); +PHPBN2(LOG_NDELAY); +PHPBN2(LOG_NOWAIT); +PHPBN2(LOG_PERROR); + +/* Added in PHP 5.2 */ +PHPBN2(PREG_BACKTRACK_LIMIT_ERROR); +PHPBN2(PREG_BAD_UTF8_ERROR); +PHPBN2(PREG_INTERNAL_ERROR); +PHPBN2(PREG_NO_ERROR); +PHPBN2(PREG_RECURSION_LIMIT_ERROR); +PHPBN2(UPLOAD_ERR_EXTENSION); +PHPBN2(STREAM_SHUT_RD); +PHPBN2(STREAM_SHUT_WR); +PHPBN2(STREAM_SHUT_RDWR); +PHPBN2(CURLE_FILESIZE_EXCEEDED); +PHPBN2(CURLE_FTP_SSL_FAILED); +PHPBN2(CURLE_LDAP_INVALID_URL); +PHPBN2(CURLFTPAUTH_DEFAULT); +PHPBN2(CURLFTPAUTH_SSL); +PHPBN2(CURLFTPAUTH_TLS); +PHPBN2(CURLFTPSSL_ALL); +PHPBN2(CURLFTPSSL_CONTROL); +PHPBN2(CURLFTPSSL_NONE); +PHPBN2(CURLFTPSSL_TRY); +PHPBN2(CURLOPT_FTP_SSL); +PHPBN2(CURLOPT_FTPSSLAUTH); +PHPBN2(CURLOPT_TCP_NODELAY); // Added in PHP 5.2.1 +PHPBN2(CURLOPT_TIMEOUT_MS); // Added in PHP 5.2.3 +PHPBN2(CURLOPT_CONNECTTIMEOUT_MS); // Added in PHP 5.2.3 +PHPBN2(GMP_VERSION); // Added in PHP 5.2.2 +PHPBN2(SWFTEXTFIELD_USEFONT); +PHPBN2(SWFTEXTFIELD_AUTOSIZE); +PHPBN2(SWF_SOUND_NOT_COMPRESSED); +PHPBN2(SWF_SOUND_ADPCM_COMPRESSED); +PHPBN2(SWF_SOUND_MP3_COMPRESSED); +PHPBN2(SWF_SOUND_NOT_COMPRESSED_LE); +PHPBN2(SWF_SOUND_NELLY_COMPRESSED); +PHPBN2(SWF_SOUND_5KHZ); +PHPBN2(SWF_SOUND_11KHZ); +PHPBN2(SWF_SOUND_22KHZ); +PHPBN2(SWF_SOUND_44KHZ); +PHPBN2(SWF_SOUND_8BITS); +PHPBN2(SWF_SOUND_16BITS); +PHPBN2(SWF_SOUND_MONO); +PHPBN2(SWF_SOUND_STEREO); +PHPBN2(OPENSSL_VERSION_NUMBER); +PHPBN2(SNMP_OID_OUTPUT_FULL); +PHPBN2(SNMP_OID_OUTPUT_NUMERIC); +PHPBN2(MSG_EAGAIN); +PHPBN2(MSG_ENOMSG); + +/* Added in PHP 5.3 */ +PHPBN2(CURLOPT_PROGRESSFUNCTION); +PHPBN2(IMG_FILTER_PIXELATE); +PHPBN2(JSON_ERROR_CTRL_CHAR); +PHPBN2(JSON_ERROR_DEPTH); +PHPBN2(JSON_ERROR_NONE); +PHPBN2(JSON_ERROR_STATE_MISMATCH); +PHPBN2(JSON_ERROR_SYNTAX); +PHPBN2(JSON_FORCE_OBJECT); +PHPBN2(JSON_HEX_TAG); +PHPBN2(JSON_HEX_AMP); +PHPBN2(JSON_HEX_APOS); +PHPBN2(JSON_HEX_QUOT); +PHPBN2(LDAP_OPT_NETWORK_TIMEOUT); +PHPBN2(LIBXML_LOADED_VERSION); +PHPBN2(PREG_BAD_UTF8_OFFSET_ERROR); +PHPBN2(BUS_ADRALN); +PHPBN2(BUS_ADRERR); +PHPBN2(BUS_OBJERR); +PHPBN2(CLD_CONTIUNED); +PHPBN2(CLD_DUMPED); +PHPBN2(CLD_EXITED); +PHPBN2(CLD_KILLED); +PHPBN2(CLD_STOPPED); +PHPBN2(CLD_TRAPPED); +PHPBN2(FPE_FLTDIV); +PHPBN2(FPE_FLTINV); +PHPBN2(FPE_FLTOVF); +PHPBN2(FPE_FLTRES); +PHPBN2(FPE_FLTSUB); +PHPBN2(FPE_FLTUND); +PHPBN2(FPE_INTDIV); +PHPBN2(FPE_INTOVF); +PHPBN2(ILL_BADSTK); +PHPBN2(ILL_COPROC); +PHPBN2(ILL_ILLADR); +PHPBN2(ILL_ILLOPC); +PHPBN2(ILL_ILLOPN); +PHPBN2(ILL_ILLTRP); +PHPBN2(ILL_PRVOPC); +PHPBN2(ILL_PRVREG); +PHPBN2(POLL_ERR); +PHPBN2(POLL_HUP); +PHPBN2(POLL_IN); +PHPBN2(POLL_MSG); +PHPBN2(POLL_OUT); +PHPBN2(POLL_PRI); +PHPBN2(SEGV_ACCERR); +PHPBN2(SEGV_MAPERR); +PHPBN2(SI_ASYNCIO); +PHPBN2(SI_KERNEL); +PHPBN2(SI_MESGQ); +PHPBN2(SI_NOINFO); +PHPBN2(SI_QUEUE); +PHPBN2(SI_SIGIO); +PHPBN2(SI_TIMER); +PHPBN2(SI_TKILL); +PHPBN2(SI_USER); +PHPBN2(SIG_BLOCK); +PHPBN2(SIG_SETMASK); +PHPBN2(SIG_UNBLOCK); +PHPBN2(TRAP_BRKPT); +PHPBN2(TRAP_TRACE); + +/* Added in PHP 5.4 */ +PHPBN2(ENT_DISALLOWED); +PHPBN2(ENT_HTML401); +PHPBN2(ENT_HTML5); +PHPBN2(ENT_SUBSTITUTE); +PHPBN2(ENT_XML1); +PHPBN2(ENT_XHTML); +PHPBN2(IPPROTO_IP); +PHPBN2(IPPROTO_IPV6); +PHPBN2(IPV6_MULTICAST_HOPS); +PHPBN2(IPV6_MULTICAST_IF); +PHPBN2(IPV6_MULTICAST_LOOP); +PHPBN2(IP_MULTICAST_IF); +PHPBN2(IP_MULTICAST_LOOP); +PHPBN2(IP_MULTICAST_TTL); +PHPBN2(MCAST_JOIN_GROUP); +PHPBN2(MCAST_LEAVE_GROUP); +PHPBN2(MCAST_BLOCK_SOURCE); +PHPBN2(MCAST_UNBLOCK_SOURCE); +PHPBN2(MCAST_JOIN_SOURCE_GROUP); +PHPBN2(MCAST_LEAVE_SOURCE_GROUP); +PHPBN2(CURLOPT_MAX_RECV_SPEED_LARGE); +PHPBN2(CURLOPT_MAX_SEND_SPEED_LARGE); +PHPBN2(LIBXML_HTML_NODEFDTD); +PHPBN2(LIBXML_HTML_NOIMPLIED); +PHPBN2(LIBXML_PEDANTIC); +PHPBN2(OPENSSL_CIPHER_AES_128_CBC); +PHPBN2(OPENSSL_CIPHER_AES_192_CBC); +PHPBN2(OPENSSL_CIPHER_AES_256_CBC); +PHPBN2(OPENSSL_RAW_DATA); +PHPBN2(OPENSSL_ZERO_PADDING); +PHPBN2(PHP_OUTPUT_HANDLER_CLEAN); +PHPBN2(PHP_OUTPUT_HANDLER_CLEANABLE); +PHPBN2(PHP_OUTPUT_HANDLER_DISABLED); +PHPBN2(PHP_OUTPUT_HANDLER_FINAL); +PHPBN2(PHP_OUTPUT_HANDLER_FLUSH); +PHPBN2(PHP_OUTPUT_HANDLER_FLUSHABLE); +PHPBN2(PHP_OUTPUT_HANDLER_REMOVABLE); +PHPBN2(PHP_OUTPUT_HANDLER_STARTED); +PHPBN2(PHP_OUTPUT_HANDLER_STDFLAGS); +PHPBN2(PHP_OUTPUT_HANDLER_WRITE); +PHPBN2(PHP_SESSION_ACTIVE); +PHPBN2(PHP_SESSION_DISABLED); +PHPBN2(PHP_SESSION_NONE); +PHPBN2(STREAM_META_ACCESS); +PHPBN2(STREAM_META_GROUP); +PHPBN2(STREAM_META_GROUP_NAME); +PHPBN2(STREAM_META_OWNER); +PHPBN2(STREAM_META_OWNER_NAME); +PHPBN2(STREAM_META_TOUCH); +PHPBN2(ZLIB_ENCODING_DEFLATE); +PHPBN2(ZLIB_ENCODING_GZIP); +PHPBN2(ZLIB_ENCODING_RAW); +PHPBN2(U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR); +PHPBN2(IDNA_CHECK_BIDI); +PHPBN2(IDNA_CHECK_CONTEXTJ); +PHPBN2(IDNA_NONTRANSITIONAL_TO_ASCII); +PHPBN2(IDNA_NONTRANSITIONAL_TO_UNICODE); +PHPBN2(INTL_IDNA_VARIANT_2003); +PHPBN2(INTL_IDNA_VARIANT_UTS46); +PHPBN2(IDNA_ERROR_EMPTY_LABEL); +PHPBN2(IDNA_ERROR_LABEL_TOO_LONG); +PHPBN2(IDNA_ERROR_DOMAIN_NAME_TOO_LONG); +PHPBN2(IDNA_ERROR_LEADING_HYPHEN); +PHPBN2(IDNA_ERROR_TRAILING_HYPHEN); +PHPBN2(IDNA_ERROR_HYPHEN_3_4); +PHPBN2(IDNA_ERROR_LEADING_COMBINING_MARK); +PHPBN2(IDNA_ERROR_DISALLOWED); +PHPBN2(IDNA_ERROR_PUNYCODE); +PHPBN2(IDNA_ERROR_LABEL_HAS_DOT); +PHPBN2(IDNA_ERROR_INVALID_ACE_LABEL); +PHPBN2(IDNA_ERROR_BIDI); +PHPBN2(IDNA_ERROR_CONTEXTJ); +PHPBN2(JSON_PRETTY_PRINT); +PHPBN2(JSON_UNESCAPED_SLASHES); +PHPBN2(JSON_NUMERIC_CHECK); +PHPBN2(JSON_UNESCAPED_UNICODE); +PHPBN2(JSON_BIGINT_AS_STRING); + +/* Added in PHP 5.5 */ +PHPBN2(IMG_AFFINE_TRANSLATE); +PHPBN2(IMG_AFFINE_SCALE); +PHPBN2(IMG_AFFINE_ROTATE); +PHPBN2(IMG_AFFINE_SHEAR_HORIZONTAL); +PHPBN2(IMG_AFFINE_SHEAR_VERTICAL); +PHPBN2(IMG_CROP_DEFAULT); +PHPBN2(IMG_CROP_TRANSPARENT); +PHPBN2(IMG_CROP_BLACK); +PHPBN2(IMG_CROP_WHITE); +PHPBN2(IMG_CROP_SIDES); +PHPBN2(IMG_FLIP_BOTH); +PHPBN2(IMG_FLIP_HORIZONTAL); +PHPBN2(IMG_FLIP_VERTICAL); +PHPBN2(IMG_BELL); +PHPBN2(IMG_BESSEL); +PHPBN2(IMG_BICUBIC); +PHPBN2(IMG_BICUBIC_FIXED); +PHPBN2(IMG_BLACKMAN); +PHPBN2(IMG_BOX); +PHPBN2(IMG_BSPLINE); +PHPBN2(IMG_CATMULLROM); +PHPBN2(IMG_GAUSSIAN); +PHPBN2(IMG_GENERALIZED_CUBIC); +PHPBN2(IMG_HERMITE); +PHPBN2(IMG_HAMMING); +PHPBN2(IMG_HANNING); +PHPBN2(IMG_MITCHELL); +PHPBN2(IMG_POWER); +PHPBN2(IMG_QUADRATIC); +PHPBN2(IMG_SINC); +PHPBN2(IMG_NEAREST_NEIGHBOUR); +PHPBN2(IMG_WEIGHTED4); +PHPBN2(IMG_TRIANGLE); +PHPBN2(JSON_ERROR_RECURSION); +PHPBN2(JSON_ERROR_INF_OR_NAN); +PHPBN2(JSON_ERROR_UNSUPPORTED_TYPE); +PHPBN2(MYSQLI_SERVER_PUBLIC_KEY); + +/* Added in PHP 5.6 */ +PHPBN2(LDAP_ESCAPE_DN); +PHPBN2(LDAP_ESCAPE_FILTER); +PHPBN2(OPENSSL_DEFAULT_STREAM_CIPHERS); +PHPBN2(STREAM_CRYPTO_METHOD_ANY_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_ANY_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_SERVER); +PHPBN2(PGSQL_CONNECT_ASYNC); +PHPBN2(PGSQL_CONNECTION_AUTH_OK); +PHPBN2(PGSQL_CONNECTION_AWAITING_RESPONSE); +PHPBN2(PGSQL_CONNECTION_MADE); +PHPBN2(PGSQL_CONNECTION_SETENV); +PHPBN2(PGSQL_CONNECTION_SSL_STARTUP); +PHPBN2(PGSQL_CONNECTION_STARTED); +PHPBN2(PGSQL_DML_ESCAPE); +PHPBN2(PGSQL_POLLING_ACTIVE); +PHPBN2(PGSQL_POLLING_FAILED); +PHPBN2(PGSQL_POLLING_OK); +PHPBN2(PGSQL_POLLING_READING); +PHPBN2(PGSQL_POLLING_WRITING); + +/* Class names reserved by PHP (case insensitive) */ +PHPCN(directory); +PHPCN(stdclass); +PHPCN(__php_incomplete_class); +/* Added in PHP5. */ +PHPCN(exception); +PHPCN(errorexception); // As of PHP 5.1 +PHPCN(php_user_filter); +PHPCN(closure); // As of PHP 5.3 +PHPCN(generator); // As of PHP 5.5 +PHPCN(self); +PHPCN(static); +PHPCN(parent); +/* http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.classes */ +PHPCN(bool); // As of PHP 7.0 +PHPCN(int); // As of PHP 7.0 +PHPCN(float); // As of PHP 7.0 +PHPCN(string); // As of PHP 7.0 +PHPCN(NULL); // As of PHP 7.0 +PHPCN(TRUE); // As of PHP 7.0 +PHPCN(FALSE); // As of PHP 7.0 +PHPCN(resource); // As of PHP 7.0 (currently works but reserved) +PHPCN(object); // As of PHP 7.0 (currently works but reserved) +PHPCN(mixed); // As of PHP 7.0 (currently works but reserved) +PHPCN(numeric); // As of PHP 7.0 (currently works but reserved) +/* http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.invalid-class-names */ +PHPCN(iterable); // As of PHP 7.1 +PHPCN(void); // As of PHP 7.1 +/* From extensions (which of these are actually predefined depends which + * extensions are loaded by default). */ +PHPCN(xmlwriter); +PHPCN(libxmlerror); +PHPCN(simplexmlelement); +PHPCN(soapclient); +PHPCN(soapvar); +PHPCN(soapserver); +PHPCN(soapfault); +PHPCN(soapparam); +PHPCN(soapheader); +PHPCN(recursiveiteratoriterator); +PHPCN(filteriterator); +PHPCN(recursivefilteriterator); +PHPCN(parentiterator); +PHPCN(limititerator); +PHPCN(cachingiterator); +PHPCN(recursivecachingiterator); +PHPCN(iteratoriterator); +PHPCN(norewinditerator); +PHPCN(appenditerator); +PHPCN(infiniteiterator); +PHPCN(emptyiterator); +PHPCN(arrayobject); +PHPCN(arrayiterator); +PHPCN(recursivearrayiterator); +PHPCN(splfileinfo); +PHPCN(directoryiterator); +PHPCN(recursivedirectoryiterator); +PHPCN(splfileobject); +PHPCN(spltempfileobject); +PHPCN(simplexmliterator); +PHPCN(logicexception); +PHPCN(badfunctioncallexception); +PHPCN(badmethodcallexception); +PHPCN(domainexception); +PHPCN(invalidargumentexception); +PHPCN(lengthexception); +PHPCN(outofrangeexception); +PHPCN(runtimeexception); +PHPCN(outofboundsexception); +PHPCN(overflowexception); +PHPCN(rangeexception); +PHPCN(underflowexception); +PHPCN(unexpectedvalueexception); +PHPCN(splobjectstorage); +PHPCN(reflectionexception); +PHPCN(reflection); +PHPCN(reflectionfunction); +PHPCN(reflectionparameter); +PHPCN(reflectionmethod); +PHPCN(reflectionclass); +PHPCN(reflectionobject); +PHPCN(reflectionproperty); +PHPCN(reflectionextension); +PHPCN(domexception); +PHPCN(domstringlist); +PHPCN(domnamelist); +PHPCN(domimplementationlist); +PHPCN(domimplementationsource); +PHPCN(domimplementation); +PHPCN(domnode); +PHPCN(domnamespacenode); +PHPCN(domdocumentfragment); +PHPCN(domdocument); +PHPCN(domnodelist); +PHPCN(domnamednodemap); +PHPCN(domcharacterdata); +PHPCN(domattr); +PHPCN(domelement); +PHPCN(domtext); +PHPCN(domcomment); +PHPCN(domtypeinfo); +PHPCN(domuserdatahandler); +PHPCN(domdomerror); +PHPCN(domerrorhandler); +PHPCN(domlocator); +PHPCN(domconfiguration); +PHPCN(domcdatasection); +PHPCN(domdocumenttype); +PHPCN(domnotation); +PHPCN(domentity); +PHPCN(domentityreference); +PHPCN(domprocessinginstruction); +PHPCN(domstringextend); +PHPCN(domxpath); +PHPCN(xmlreader); +PHPCN(sqlitedatabase); +PHPCN(sqliteresult); +PHPCN(sqliteunbuffered); +PHPCN(sqliteexception); +PHPCN(datetime); + +/* Built-in PHP functions (incomplete). */ +/* Includes Array Functions - http://php.net/manual/en/ref.array.php */ +/* Check is case insensitive - these *MUST* be listed in lower case here */ +PHPFN(acos); +PHPFN(array_change_key_case); +PHPFN(array_chunk); +PHPFN(array_column); +PHPFN(array_combine); +PHPFN(array_count_values); +PHPFN(array_diff); +PHPFN(array_diff_assoc); +PHPFN(array_diff_key); +PHPFN(array_diff_uassoc); +PHPFN(array_diff_ukey); +PHPFN(array_fill); +PHPFN(array_fill_keys); +PHPFN(array_filter); +PHPFN(array_flip); +PHPFN(array_intersect); +PHPFN(array_intersect_assoc); +PHPFN(array_intersect_key); +PHPFN(array_intersect_uassoc); +PHPFN(array_intersect_ukey); +PHPFN(array_key_exists); +PHPFN(array_keys); +PHPFN(array_map); +PHPFN(array_merge); +PHPFN(array_merge_recursive); +PHPFN(array_multisort); +PHPFN(array_pad); +PHPFN(array_pop); +PHPFN(array_product); +PHPFN(array_push); +PHPFN(array_rand); +PHPFN(array_reduce); +PHPFN(array_replace); +PHPFN(array_replace_recursive); +PHPFN(array_reverse); +PHPFN(array_search); +PHPFN(array_shift); +PHPFN(array_slice); +PHPFN(array_splice); +PHPFN(array_sum); +PHPFN(array_udiff); +PHPFN(array_udiff_assoc); +PHPFN(array_udiff_uassoc); +PHPFN(array_uintersect); +PHPFN(array_uintersect_assoc); +PHPFN(array_uintersect_uassoc); +PHPFN(array_unique); +PHPFN(array_unshift); +PHPFN(array_values); +PHPFN(array_walk); +PHPFN(array_walk_recursive); +PHPFN(arsort); +PHPFN(asin); +PHPFN(asort); +PHPFN(atan); +PHPFN(atan2); +PHPFN(ceil); +PHPFN(compact); +PHPFN(cos); +PHPFN(cosh); +PHPFN(count); +PHPFN(current); +PHPFN(each); +PHPFN(end); +PHPFN(exp); +PHPFN(extract); +PHPFN(floor); +PHPFN(fmod); +PHPFN(in_array); +PHPFN(key); +PHPFN(key_exists); +PHPFN(krsort); +PHPFN(ksort); +PHPFN(log); +PHPFN(log10); +PHPFN(max); +PHPFN(min); +PHPFN(natcasesort); +PHPFN(natsort); +PHPFN(next); +PHPFN(pos); +PHPFN(pow); +PHPFN(prev); +PHPFN(range); +PHPFN(reset); +PHPFN(rsort); +PHPFN(shuffle); +PHPFN(sin); +PHPFN(sinh); +PHPFN(sizeof); +PHPFN(sort); +PHPFN(sqrt); +PHPFN(tan); +PHPFN(tanh); +PHPFN(uasort); +PHPFN(uksort); +PHPFN(usort); + +#undef PHPKW +#undef PHPBN1a +#undef PHPBN1b +#undef PHPBN1 +#undef PHPBN2a +#undef PHPBN2b +#undef PHPBN2 +#undef PHPCN +#undef PHPFN
diff --git a/share/swig/2.0.11/php/phppointers.i b/share/swig/3.0.12/php/phppointers.i similarity index 79% copy from share/swig/2.0.11/php/phppointers.i copy to share/swig/3.0.12/php/phppointers.i index 91b2c6d..d79697b 100644 --- a/share/swig/2.0.11/php/phppointers.i +++ b/share/swig/3.0.12/php/phppointers.i
@@ -1,21 +1,25 @@ %define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT ) -%typemap(in) TYPE *REF ($*1_ltype tmp), +%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp), TYPE &REF ($*1_ltype tmp) %{ /* First Check for SWIG wrapped type */ - if ( ZVAL_IS_NULL( *$input ) ) { + if (Z_ISNULL($input)) { $1 = 0; - } else if ( PZVAL_IS_REF( *$input ) ) { + } else if (Z_ISREF($input)) { /* Not swig wrapped type, so we check if it's a PHP reference type */ - CONVERT_IN( tmp, $*1_ltype, $input ); + CONVERT_IN(tmp, $*1_ltype, $input); $1 = &tmp; } else { - SWIG_PHP_Error( E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference) ); + SWIG_PHP_Error(E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference)); } %} %typemap(argout) TYPE *REF, TYPE &REF - "CONVERT_OUT(*$input, tmp$argnum );"; +%{ + if (Z_ISREF($input)) { + CONVERT_OUT(Z_REFVAL($input), tmp$argnum); + } +%} %enddef %pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
diff --git a/share/swig/3.0.12/php/phprun.swg b/share/swig/3.0.12/php/phprun.swg new file mode 100644 index 0000000..5c62d19 --- /dev/null +++ b/share/swig/3.0.12/php/phprun.swg
@@ -0,0 +1,239 @@ +/* ----------------------------------------------------------------------------- + * phprun.swg + * + * PHP runtime library + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif +#include "zend.h" +#include "zend_API.h" +#include "zend_exceptions.h" +#include "php.h" + +#if PHP_MAJOR_VERSION != 7 +# error These bindings need PHP7 - to generate PHP5 bindings use: swig -php5 +#endif + +#include "ext/standard/php_string.h" +#include <stdlib.h> /* for abort(), used in generated code. */ + +/* This indirection is to work around const correctness issues in older PHP. + * FIXME: Remove for PHP7? Or might user code be using it? */ +#define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) + +#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_LONG_CONSTANT(N, V) REGISTER_LONG_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_DOUBLE_CONSTANT(N, V) REGISTER_DOUBLE_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) +#define SWIG_STRING_CONSTANT(N, V) REGISTER_STRING_CONSTANT(#N, (char*)V, CONST_CS | CONST_PERSISTENT) +#define SWIG_CHAR_CONSTANT(N, V) do {\ + char swig_char = (V);\ + REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\ +} while (0) + +#ifdef __cplusplus +} +#endif + +#define SWIG_fail goto fail + +static const char *default_error_msg = "Unknown error occurred"; +static int default_error_code = E_ERROR; + +#define SWIG_PHP_Arg_Error_Msg(argnum,extramsg) "Error in argument " #argnum " "#extramsg + +#define SWIG_PHP_Error(code,msg) do { SWIG_ErrorCode() = code; SWIG_ErrorMsg() = msg; SWIG_fail; } while (0) + +#define SWIG_contract_assert(expr,msg) \ + if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else + +/* Standard SWIG API */ +#define SWIG_GetModule(clientdata) SWIG_Php_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer) + +/* used to wrap returned objects in so we know whether they are newobject + and need freeing, or not */ +typedef struct { + void * ptr; + int newobject; +} swig_object_wrapper; + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) + +static void +SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) { + /* + * First test for Null pointers. Return those as PHP native NULL + */ + if (!ptr ) { + ZVAL_NULL(z); + return; + } + if (type->clientdata) { + swig_object_wrapper *value; + if (! (*(int *)(type->clientdata))) + zend_error(E_ERROR, "Type: %s failed to register with zend",type->name); + value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper)); + value->ptr=ptr; + value->newobject=(newobject & 1); + if ((newobject & 2) == 0) { + /* Just register the pointer as a resource. */ + ZVAL_RES(z, zend_register_resource(value, *(int *)(type->clientdata))); + } else { + /* + * Wrap the resource in an object, the resource will be accessible + * via the "_cPtr" member. This is currently only used by + * directorin typemaps. + */ + zval resource; + zend_class_entry *ce = NULL; + const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */ + size_t type_name_len; + const char * p; + HashTable * ht; + + /* Namespace__Foo -> Foo */ + /* FIXME: ugly and goes wrong for classes with __ in their names. */ + while ((p = strstr(type_name, "__")) != NULL) { + type_name = p + 2; + } + type_name_len = strlen(type_name); + + ZVAL_RES(&resource, zend_register_resource(value, *(int *)(type->clientdata))); + if (SWIG_PREFIX_LEN > 0) { + zend_string * classname = zend_string_alloc(SWIG_PREFIX_LEN + type_name_len, 0); + memcpy(classname->val, SWIG_PREFIX, SWIG_PREFIX_LEN); + memcpy(classname->val + SWIG_PREFIX_LEN, type_name, type_name_len); + ce = zend_lookup_class(classname); + zend_string_release(classname); + } else { + zend_string * classname = zend_string_init(type_name, type_name_len, 0); + ce = zend_lookup_class(classname); + zend_string_release(classname); + } + if (ce == NULL) { + /* class does not exist */ + ce = zend_standard_class_def; + } + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, 1, NULL, NULL, 0); + zend_hash_str_update(ht, "_cPtr", sizeof("_cPtr") - 1, &resource); + object_and_properties_init(z, ce, ht); + } + return; + } + zend_error(E_ERROR, "Type: %s not registered with zend",type->name); +} + +/* This pointer conversion routine takes the native pointer p (along with + its type name) and converts it by calling appropriate casting functions + according to ty. The resultant pointer is returned, or NULL is returned + if the pointer can't be cast. + + Sadly PHP has no API to find a type name from a type id, only from an + instance of a resource of the type id, so we have to pass type_name as well. + + The two functions which might call this are: + SWIG_ConvertResourcePtr which gets the type name from the resource + and the registered zend destructors for which we have one per type each + with the type name hard wired in. */ +static void * +SWIG_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty) { + swig_cast_info *tc; + void *result = 0; + + if (!ty) { + /* They don't care about the target type, so just pass on the pointer! */ + return p; + } + + if (! type_name) { + /* can't convert p to ptr type ty if we don't know what type p is */ + return NULL; + } + + /* convert and cast p from type_name to ptr as ty. */ + tc = SWIG_TypeCheck(type_name, ty); + if (tc) { + int newmemory = 0; + result = SWIG_TypeCast(tc, p, &newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + return result; +} + +/* This function returns a pointer of type ty by extracting the pointer + and type info from the resource in z. z must be a resource. + If it fails, NULL is returned. + It uses SWIG_ConvertResourceData to do the real work. */ +static void * +SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) { + swig_object_wrapper *value; + void *p; + const char *type_name; + + if (Z_RES_TYPE_P(z) == -1) return NULL; + value = (swig_object_wrapper *) Z_RES_VAL_P(z); + if (flags & SWIG_POINTER_DISOWN) { + value->newobject = 0; + } + p = value->ptr; + + type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z)); + + return SWIG_ConvertResourceData(p, type_name, ty); +} + +/* We allow passing of a RESOURCE pointing to the object or an OBJECT whose + _cPtr is a resource pointing to the object */ +static int +SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) { + if (z == NULL) { + *ptr = 0; + return 0; + } + + switch (Z_TYPE_P(z)) { + case IS_OBJECT: { + HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z); + if (ht) { + zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1); + if (_cPtr) { + if (Z_TYPE_P(_cPtr) == IS_INDIRECT) { + _cPtr = Z_INDIRECT_P(_cPtr); + } + if (Z_TYPE_P(_cPtr) == IS_RESOURCE) { + *ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags); + return (*ptr == NULL ? -1 : 0); + } + } + } + break; + } + case IS_RESOURCE: + *ptr = SWIG_ConvertResourcePtr(z, ty, flags); + return (*ptr == NULL ? -1 : 0); + case IS_NULL: + *ptr = 0; + return 0; + } + + return -1; +} + +static char const_name[] = "swig_runtime_data_type_pointer"; +static swig_module_info *SWIG_Php_GetModule() { + zval *pointer = zend_get_constant_str(const_name, sizeof(const_name) - 1); + if (pointer) { + if (Z_TYPE_P(pointer) == IS_LONG) { + return (swig_module_info *) pointer->value.lval; + } + } + return NULL; +} + +static void SWIG_Php_SetModule(swig_module_info *pointer) { + REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS); +}
diff --git a/share/swig/2.0.11/php/std_common.i b/share/swig/3.0.12/php/std_common.i similarity index 100% rename from share/swig/2.0.11/php/std_common.i rename to share/swig/3.0.12/php/std_common.i
diff --git a/share/swig/2.0.11/php/std_deque.i b/share/swig/3.0.12/php/std_deque.i similarity index 100% rename from share/swig/2.0.11/php/std_deque.i rename to share/swig/3.0.12/php/std_deque.i
diff --git a/share/swig/2.0.11/php/std_map.i b/share/swig/3.0.12/php/std_map.i similarity index 100% rename from share/swig/2.0.11/php/std_map.i rename to share/swig/3.0.12/php/std_map.i
diff --git a/share/swig/2.0.11/php/std_pair.i b/share/swig/3.0.12/php/std_pair.i similarity index 100% rename from share/swig/2.0.11/php/std_pair.i rename to share/swig/3.0.12/php/std_pair.i
diff --git a/share/swig/3.0.12/php/std_string.i b/share/swig/3.0.12/php/std_string.i new file mode 100644 index 0000000..b55751f --- /dev/null +++ b/share/swig/3.0.12/php/std_string.i
@@ -0,0 +1,94 @@ +/* ----------------------------------------------------------------------------- + * std_string.i + * + * SWIG typemaps for std::string types + * ----------------------------------------------------------------------------- */ + +// ------------------------------------------------------------------------ +// std::string is typemapped by value +// This can prevent exporting methods which return a string +// in order for the user to modify it. +// However, I think I'll wait until someone asks for it... +// ------------------------------------------------------------------------ + +%include <exception.i> + +%{ +#include <string> +%} + +namespace std { + + %naturalvar string; + + class string; + + %typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) string, const string& %{ + $1 = (Z_TYPE($input) == IS_STRING) ? 1 : 0; + %} + + %typemap(in) string %{ + convert_to_string(&$input); + $1.assign(Z_STRVAL($input), Z_STRLEN($input)); + %} + + %typemap(directorout) string %{ + if (!EG(exception)) { + convert_to_string($input); + $result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input)); + } + %} + + %typemap(out) string %{ + ZVAL_STRINGL($result, $1.data(), $1.size()); + %} + + %typemap(directorin) string, const string& %{ + ZVAL_STRINGL($input, $1.data(), $1.size()); + %} + + %typemap(out) const string & %{ + ZVAL_STRINGL($result, $1->data(), $1->size()); + %} + + %typemap(throws) string, const string& %{ + zend_throw_exception(NULL, $1.c_str(), 0); + return; + %} + + %typemap(in) const string & ($*1_ltype temp) %{ + convert_to_string(&$input); + temp.assign(Z_STRVAL($input), Z_STRLEN($input)); + $1 = &temp; + %} + + /* These next two handle a function which takes a non-const reference to + * a std::string and modifies the string. */ + %typemap(in,byref=1) string & ($*1_ltype temp) %{ + { + zval * p = Z_ISREF($input) ? Z_REFVAL($input) : &$input; + convert_to_string(p); + temp.assign(Z_STRVAL_P(p), Z_STRLEN_P(p)); + $1 = &temp; + } + %} + + %typemap(directorout) string & ($*1_ltype *temp) %{ + if (!EG(exception)) { + convert_to_string($input); + temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input)); + swig_acquire_ownership(temp); + $result = temp; + } + %} + + %typemap(argout) string & %{ + if (Z_ISREF($input)) { + ZVAL_STRINGL(Z_REFVAL($input), $1->data(), $1->size()); + } + %} + + /* SWIG will apply the non-const typemap above to const string& without + * this more specific typemap. */ + %typemap(argout) const string & ""; +}
diff --git a/share/swig/2.0.11/php/std_vector.i b/share/swig/3.0.12/php/std_vector.i similarity index 97% rename from share/swig/2.0.11/php/std_vector.i rename to share/swig/3.0.12/php/std_vector.i index 28c9921..9cc1486 100644 --- a/share/swig/2.0.11/php/std_vector.i +++ b/share/swig/3.0.12/php/std_vector.i
@@ -77,7 +77,7 @@ self->pop_back(); return x; } - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/php/stl.i b/share/swig/3.0.12/php/stl.i similarity index 100% rename from share/swig/2.0.11/php/stl.i rename to share/swig/3.0.12/php/stl.i
diff --git a/share/swig/2.0.11/php/typemaps.i b/share/swig/3.0.12/php/typemaps.i similarity index 80% copy from share/swig/2.0.11/php/typemaps.i copy to share/swig/3.0.12/php/typemaps.i index 9fd73fe..c248a58 100644 --- a/share/swig/2.0.11/php/typemaps.i +++ b/share/swig/3.0.12/php/typemaps.i
@@ -27,87 +27,77 @@ %define BOOL_TYPEMAP(TYPE) %typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ - convert_to_boolean_ex($input); - temp = Z_LVAL_PP($input) ? true : false; + convert_to_boolean(&$input); + temp = (Z_TYPE($input) == IS_TRUE); $1 = &temp; %} %typemap(argout) TYPE *INPUT, TYPE &INPUT ""; %typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { - zval *o; - MAKE_STD_ZVAL(o); - ZVAL_BOOL(o,temp$argnum); - t_output_helper( &$result, o ); + zval o; + ZVAL_BOOL(&o, temp$argnum); + t_output_helper($result, &o); } %typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ - convert_to_boolean_ex($input); - lvalue = (*$input)->value.lval ? true : false; + convert_to_boolean($input); + lvalue = (Z_TYPE_P($input) == IS_TRUE); $1 = &lvalue; %} %typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE %{ - (*$arg)->value.lval = lvalue$argnum ? true : false; - (*$arg)->type = IS_BOOL; + ZVAL_BOOL(&$arg, lvalue$argnum ? true : false); %} %enddef %define DOUBLE_TYPEMAP(TYPE) %typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ - convert_to_double_ex($input); - temp = (TYPE) Z_DVAL_PP($input); + temp = (TYPE) zval_get_double(&$input); $1 = &temp; %} %typemap(argout) TYPE *INPUT, TYPE &INPUT ""; %typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { - zval *o; - MAKE_STD_ZVAL(o); - ZVAL_DOUBLE(o,temp$argnum); - t_output_helper( &$result, o ); + zval o; + ZVAL_DOUBLE(&o, temp$argnum); + t_output_helper($result, &o); } %typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue) %{ - convert_to_double_ex($input); - dvalue = (TYPE) (*$input)->value.dval; + dvalue = (TYPE) zval_get_double(&$input); $1 = &dvalue; %} %typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE %{ - $1->value.dval = (double)(lvalue$argnum); - $1->type = IS_DOUBLE; + ZVAL_DOUBLE(&$arg, (double)(lvalue$argnum)); %} %enddef %define INT_TYPEMAP(TYPE) %typemap(in) TYPE *INPUT(TYPE temp), TYPE &INPUT(TYPE temp) %{ - convert_to_long_ex($input); - temp = (TYPE) Z_LVAL_PP($input); + temp = (TYPE) zval_get_long(&$input); $1 = &temp; %} %typemap(argout) TYPE *INPUT, TYPE &INPUT ""; %typemap(in,numinputs=0) TYPE *OUTPUT(TYPE temp), TYPE &OUTPUT(TYPE temp) "$1 = &temp;"; %typemap(argout,fragment="t_output_helper") TYPE *OUTPUT, TYPE &OUTPUT { - zval *o; - MAKE_STD_ZVAL(o); - ZVAL_LONG(o,temp$argnum); - t_output_helper( &$result, o ); + zval o; + ZVAL_LONG(&o, temp$argnum); + t_output_helper($result, &o); } %typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ - convert_to_long_ex($input); - lvalue = (TYPE) (*$input)->value.lval; + lvalue = (TYPE) zval_get_long(&$input); $1 = &lvalue; %} %typemap(argout) TYPE *REFERENCE, TYPE &REFERENCE %{ - (*$arg)->value.lval = (long)(lvalue$argnum); - (*$arg)->type = IS_LONG; + ZVAL_LONG(&$arg, (long)(lvalue$argnum)); %} %enddef @@ -128,16 +118,15 @@ INT_TYPEMAP(long long); %typemap(argout,fragment="t_output_helper") long long *OUTPUT { - zval *o; - MAKE_STD_ZVAL(o); + zval o; if ((long long)LONG_MIN <= temp$argnum && temp$argnum <= (long long)LONG_MAX) { - ZVAL_LONG(o, temp$argnum); + ZVAL_LONG(&o, (long)temp$argnum); } else { char temp[256]; sprintf(temp, "%lld", (long long)temp$argnum); - ZVAL_STRING(o, temp, 1); + ZVAL_STRING(&o, temp); } - t_output_helper( &$result, o ); + t_output_helper($result, &o); } %typemap(in) TYPE *REFERENCE (long long lvalue) %{ @@ -147,38 +136,35 @@ %typemap(argout) long long *REFERENCE %{ if ((long long)LONG_MIN <= lvalue$argnum && lvalue$argnum <= (long long)LONG_MAX) { - (*$arg)->value.lval = (long)(lvalue$argnum); - (*$arg)->type = IS_LONG; + ZVAL_LONG(&$arg, (long)temp$argnum); } else { char temp[256]; sprintf(temp, "%lld", (long long)lvalue$argnum); - ZVAL_STRING((*$arg), temp, 1); + ZVAL_STRING(&$arg, temp); } %} %typemap(argout) long long &OUTPUT %{ if ((long long)LONG_MIN <= *arg$argnum && *arg$argnum <= (long long)LONG_MAX) { - ($result)->value.lval = (long)(*arg$argnum); - ($result)->type = IS_LONG; + ZVAL_LONG($result, (long)(*arg$argnum)); } else { char temp[256]; sprintf(temp, "%lld", (long long)(*arg$argnum)); - ZVAL_STRING($result, temp, 1); + ZVAL_STRING($result, temp); } %} INT_TYPEMAP(unsigned long long); %typemap(argout,fragment="t_output_helper") unsigned long long *OUTPUT { - zval *o; - MAKE_STD_ZVAL(o); + zval o; if (temp$argnum <= (unsigned long long)LONG_MAX) { - ZVAL_LONG(o, temp$argnum); + ZVAL_LONG(&o, temp$argnum); } else { char temp[256]; sprintf(temp, "%llu", (unsigned long long)temp$argnum); - ZVAL_STRING(o, temp, 1); + ZVAL_STRING(&o, temp); } - t_output_helper( &$result, o ); + t_output_helper($result, &o); } %typemap(in) TYPE *REFERENCE (unsigned long long lvalue) %{ @@ -188,23 +174,21 @@ %typemap(argout) unsigned long long *REFERENCE %{ if (lvalue$argnum <= (unsigned long long)LONG_MAX) { - (*$arg)->value.lval = (long)(lvalue$argnum); - (*$arg)->type = IS_LONG; + ZVAL_LONG($arg, (long)(lvalue$argnum)); } else { char temp[256]; sprintf(temp, "%llu", (unsigned long long)lvalue$argnum); - ZVAL_STRING((*$arg), temp, 1); + ZVAL_STRING((*$arg), temp); } %} %typemap(argout) unsigned long long &OUTPUT %{ if (*arg$argnum <= (unsigned long long)LONG_MAX) { - ($result)->value.lval = (long)(*arg$argnum); - ($result)->type = IS_LONG; + ZVAL_LONG($result, (long)(*arg$argnum)); } else { char temp[256]; sprintf(temp, "%llu", (unsigned long long)(*arg$argnum)); - ZVAL_STRING($result, temp, 1); + ZVAL_STRING($result, temp); } %} @@ -270,18 +254,17 @@ %typemap(in) char INPUT[ANY] ( char temp[$1_dim0] ) %{ - convert_to_string_ex($input); - strncpy(temp,Z_LVAL_PP($input),$1_dim0); + convert_to_string(&$input); + strncpy(temp, Z_STRVAL($input), $1_dim0); $1 = temp; %} %typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] ) "$1 = temp;"; -%typemap(argout) char OUTPUT[ANY] +%typemap(argout,fragment="t_output_helper") char OUTPUT[ANY] { - zval *o; - MAKE_STD_ZVAL(o); - ZVAL_STRINGL(o,temp$argnum,$1_dim0); - t_output_helper( &$result, o ); + zval o; + ZVAL_STRINGL(&o, temp$argnum, $1_dim0); + t_output_helper($result, &o); } %typemap(in,numinputs=0) void **OUTPUT (int force), @@ -289,9 +272,9 @@ %{ /* If they pass NULL by reference, make it into a void* This bit should go in arginit if arginit support init-ing scripting args */ - if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) { + if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0) { /* So... we didn't get a ref or ptr, but we'll accept NULL by reference */ - if (!((*$input)->type==IS_NULL && PZVAL_IS_REF(*$input))) { + if (!(Z_ISREF($input) && Z_ISNULL_P(Z_REFVAL($input)))) { /* wasn't a pre/ref/thing, OR anything like an int thing */ SWIG_PHP_Error(E_ERROR, "Type error in argument $arg of $symname."); } @@ -299,7 +282,7 @@ force=0; if (arg1==NULL) { #ifdef __cplusplus - ptr=new $*1_ltype; + ptr=new $*1_ltype(); #else ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); #endif @@ -313,7 +296,7 @@ void *&OUTPUT %{ if (force$argnum) { /* pass back arg$argnum through params ($arg) if we can */ - if (!PZVAL_IS_REF(*$arg)) { + if (!Z_ISREF($arg)) { SWIG_PHP_Error(E_WARNING, "Parameter $argnum of $symname wasn't passed by reference"); } else { SWIG_SetPointerZval(*$arg, (void *) ptr$argnum, $*1_descriptor, 1);
diff --git a/share/swig/3.0.12/php/utils.i b/share/swig/3.0.12/php/utils.i new file mode 100644 index 0000000..8581646 --- /dev/null +++ b/share/swig/3.0.12/php/utils.i
@@ -0,0 +1,116 @@ + +%define CONVERT_BOOL_IN(lvar,t,invar) + lvar = (t) zval_is_true(&invar); +%enddef + +%define CONVERT_INT_IN(lvar,t,invar) + lvar = (t) zval_get_long(&invar); +%enddef + +%define CONVERT_LONG_LONG_IN(lvar,t,invar) + switch (Z_TYPE(invar)) { + case IS_DOUBLE: + lvar = (t) Z_DVAL(invar); + break; + case IS_STRING: { + char * endptr; + errno = 0; + lvar = (t) strtoll(Z_STRVAL(invar), &endptr, 10); + if (*endptr && !errno) break; + /* FALL THRU */ + } + default: + lvar = (t) zval_get_long(&invar); + } +%enddef + +%define CONVERT_UNSIGNED_LONG_LONG_IN(lvar,t,invar) + switch (Z_TYPE(invar)) { + case IS_DOUBLE: + lvar = (t) Z_DVAL(invar); + break; + case IS_STRING: { + char * endptr; + errno = 0; + lvar = (t) strtoull(Z_STRVAL(invar), &endptr, 10); + if (*endptr && !errno) break; + /* FALL THRU */ + } + default: + lvar = (t) zval_get_long(&invar); + } +%enddef + +%define CONVERT_INT_OUT(lvar,invar) + lvar = (t) zval_get_long(&invar); +%enddef + +%define CONVERT_FLOAT_IN(lvar,t,invar) + lvar = (t) zval_get_double(&invar); +%enddef + +%define CONVERT_CHAR_IN(lvar,t,invar) + convert_to_string(&invar); + lvar = (t) Z_STRVAL(invar)[0]; +%enddef + +%define CONVERT_STRING_IN(lvar,t,invar) + if (Z_ISNULL(invar)) { + lvar = (t) 0; + } else { + convert_to_string(&invar); + lvar = (t) Z_STRVAL(invar); + } +%enddef + +%define %pass_by_val( TYPE, CONVERT_IN ) +%typemap(in) TYPE +%{ + CONVERT_IN($1,$1_ltype,$input); +%} +%typemap(in) const TYPE & ($*1_ltype temp) +%{ + CONVERT_IN(temp,$*1_ltype,$input); + $1 = &temp; +%} +%typemap(directorout) TYPE +%{ + if (!EG(exception)) { + CONVERT_IN($result, $1_ltype, *$input); + } else { + typedef $1_ltype swig_result_typedef; + $result = swig_result_typedef(); + } +%} +%typemap(directorout) const TYPE & ($*1_ltype temp) +%{ + if (!EG(exception)) { + CONVERT_IN(temp, $*1_ltype, *$input); + } else { + typedef $*1_ltype swig_result_typedef; + temp = swig_result_typedef(); + } + $result = &temp; +%} +%enddef + +%fragment("t_output_helper","header") %{ +static void +t_output_helper(zval *target, zval *o) { + zval tmp; + if (Z_TYPE_P(target) == IS_ARRAY) { + /* it's already an array, just append */ + add_next_index_zval(target, o); + return; + } + if (Z_TYPE_P(target) == IS_NULL) { + /* NULL isn't refcounted */ + ZVAL_COPY_VALUE(target, o); + return; + } + ZVAL_DUP(&tmp, target); + array_init(target); + add_next_index_zval(target, &tmp); + add_next_index_zval(target, o); +} +%}
diff --git a/share/swig/2.0.11/php/const.i b/share/swig/3.0.12/php5/const.i similarity index 94% rename from share/swig/2.0.11/php/const.i rename to share/swig/3.0.12/php5/const.i index 78f3a8a..061ba99 100644 --- a/share/swig/2.0.11/php/const.i +++ b/share/swig/3.0.12/php5/const.i
@@ -14,7 +14,7 @@ signed char, bool, enum SWIGTYPE - "SWIG_LONG_CONSTANT($symname, $value);"; + "SWIG_LONG_CONSTANT($symname, ($1_type)$value);"; %typemap(consttab) float, double @@ -31,14 +31,15 @@ %typemap(consttab) SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [] { zval *z_var; + zend_constant c; + size_t len = sizeof("$symname") - 1; MAKE_STD_ZVAL(z_var); SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0); - zend_constant c; c.value = *z_var; zval_copy_ctor(&c.value); - size_t len = sizeof("$symname") - 1; c.name = zend_strndup("$symname", len); c.name_len = len+1; c.flags = CONST_CS | CONST_PERSISTENT;
diff --git a/share/swig/3.0.12/php5/director.swg b/share/swig/3.0.12/php5/director.swg new file mode 100644 index 0000000..638a169 --- /dev/null +++ b/share/swig/3.0.12/php5/director.swg
@@ -0,0 +1,170 @@ +/* ----------------------------------------------------------------------------- + * director.swg + * + * This file contains support for director classes so that PHP proxy + * methods can be called from C++. + * ----------------------------------------------------------------------------- */ + +#ifndef SWIG_DIRECTOR_PHP_HEADER_ +#define SWIG_DIRECTOR_PHP_HEADER_ + +#include <string> +#include <exception> +#include <map> + +namespace Swig { + + /* memory handler */ + struct GCItem { + virtual ~GCItem() { + } + + virtual int get_own() const { + return 0; + } + }; + + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { + } + + GCItem_var& operator=(GCItem *item) { + GCItem *tmp = _item; + _item = item; + delete tmp; + return *this; + } + + ~GCItem_var() { + delete _item; + } + + GCItem * operator->() const { + return _item; + } + + private: + GCItem *_item; + }; + + struct GCItem_Object : GCItem { + GCItem_Object(int own) : _own(own) { + } + + virtual ~GCItem_Object() { + } + + int get_own() const { + return _own; + } + + private: + int _own; + }; + + template <typename Type> + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { + } + + virtual ~GCItem_T() { + delete _ptr; + } + + private: + Type *_ptr; + }; + + class Director { + protected: + zval *swig_self; + typedef std::map<void *, GCItem_var> swig_ownership_map; + mutable swig_ownership_map swig_owner; +#ifdef ZTS + // Store the ZTS context so it's available when C++ calls back to PHP. + void *** swig_zts_ctx; +#endif + public: + Director(zval *self TSRMLS_DC) : swig_self(self) { + TSRMLS_SET_CTX(swig_zts_ctx); + } + + static bool swig_is_overridden_method(char *cname, char *lc_fname TSRMLS_DC) { + zend_class_entry **ce; + zend_function *mptr; + + if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) { + return false; + } + if (zend_hash_find(&(*ce)->function_table, lc_fname, strlen(lc_fname) + 1, (void **) &mptr) != SUCCESS) { + return false; + } + // common.scope points to the declaring class + return strcmp(mptr->common.scope->name, cname); + } + + template <typename Type> + void swig_acquire_ownership(Type *vptr) const { + if (vptr) { + swig_owner[vptr] = new GCItem_T<Type>(vptr); + } + } + }; + + /* base class for director exceptions */ + class DirectorException : public std::exception { + protected: + std::string swig_msg; + public: + DirectorException(int code, const char *hdr, const char *msg TSRMLS_DC) : swig_msg(hdr) { + if (msg[0]) { + swig_msg += " "; + swig_msg += msg; + } + SWIG_ErrorCode() = code; + SWIG_ErrorMsg() = swig_msg.c_str(); + } + + virtual ~DirectorException() throw() { + } + + const char *what() const throw() { + return swig_msg.c_str(); + } + + static void raise(int code, const char *hdr, const char *msg TSRMLS_DC) { + throw DirectorException(code, hdr, msg TSRMLS_CC); + } + }; + + /* attempt to call a pure virtual method via a director method */ + class DirectorPureVirtualException : public DirectorException { + public: + DirectorPureVirtualException(const char *msg TSRMLS_DC) + : DirectorException(E_ERROR, "SWIG director pure virtual method called", msg TSRMLS_CC) { + } + + static void raise(const char *msg TSRMLS_DC) { + throw DirectorPureVirtualException(msg TSRMLS_CC); + } + }; + + /* any php exception that occurs during a director method call */ + class DirectorMethodException : public DirectorException + { + public: + DirectorMethodException(const char *msg TSRMLS_DC) + : DirectorException(E_ERROR, "SWIG director method error", msg TSRMLS_CC) { + } + + static void raise(const char *msg TSRMLS_DC) { + throw DirectorMethodException(msg TSRMLS_CC); + } + }; +} + +// DirectorMethodException() is documented to be callable with no parameters +// so use a macro to insert TSRMLS_CC so any ZTS context gets passed. +#define DirectorMethodException() DirectorMethodException("" TSRMLS_CC) + +#endif
diff --git a/share/swig/2.0.11/php/factory.i b/share/swig/3.0.12/php5/factory.i similarity index 100% copy from share/swig/2.0.11/php/factory.i copy to share/swig/3.0.12/php5/factory.i
diff --git a/share/swig/2.0.11/php/globalvar.i b/share/swig/3.0.12/php5/globalvar.i similarity index 89% rename from share/swig/2.0.11/php/globalvar.i rename to share/swig/3.0.12/php5/globalvar.i index 45fb022..a3e99f5 100644 --- a/share/swig/2.0.11/php/globalvar.i +++ b/share/swig/3.0.12/php5/globalvar.i
@@ -4,8 +4,7 @@ * Global variables - add the variable to PHP * ----------------------------------------------------------------------------- */ -%typemap(varinit) char *, - char [] +%typemap(varinit) char * { zval *z_var; MAKE_STD_ZVAL(z_var); @@ -20,6 +19,16 @@ zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var, sizeof(zval *), NULL); } +%typemap(varinit) char [] +{ + zval *z_var; + MAKE_STD_ZVAL(z_var); + z_var->type = IS_STRING; + z_var->value.str.val = estrdup($1); + z_var->value.str.len = strlen($1); + zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var, sizeof(zval *), NULL); +} + %typemap(varinit) int, unsigned int, unsigned short, @@ -34,7 +43,7 @@ zval *z_var; MAKE_STD_ZVAL(z_var); z_var->type = IS_LONG; - z_var->value.lval = $1; + z_var->value.lval = (long)$1; zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void *)&z_var, sizeof(zval *), NULL); } @@ -80,7 +89,7 @@ sizeof(zval *), NULL); } -%typemap(varinit) SWIGTYPE, SWIGTYPE & +%typemap(varinit) SWIGTYPE, SWIGTYPE &, SWIGTYPE && { zval *z_var; @@ -95,10 +104,7 @@ zval *z_var; MAKE_STD_ZVAL(z_var); z_var->type = IS_STRING; - if ($1) { - /* varinit char [ANY] */ - ZVAL_STRINGL(z_var,(char*)$1, $1_dim0, 1); - } + ZVAL_STRINGL(z_var,(char*)$1, $1_dim0, 1); zend_hash_add(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void*)&z_var, sizeof(zval *), NULL); } @@ -164,7 +170,7 @@ zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); convert_to_string_ex(z_var); s1 = Z_STRVAL_PP(z_var); - if ((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { if (s1) $1 = estrdup(s1); else @@ -190,9 +196,9 @@ zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); s1 = Z_STRVAL_PP(z_var); - if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { - if(s1) - strncpy($1, s1, $1_dim0); + if ((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { + if (s1) + strncpy($1, s1, $1_dim0); } } @@ -210,13 +216,13 @@ } -%typemap(varin) SWIGTYPE *, SWIGTYPE & +%typemap(varin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && { zval **z_var; $1_ltype _temp; zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); - if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) { + if (SWIG_ConvertPtr(*z_var, (void **)&_temp, $1_descriptor, 0) < 0) { SWIG_PHP_Error(E_ERROR,"Type error in value of $symname. Expected $&1_descriptor"); } @@ -288,12 +294,12 @@ zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); s1 = Z_STRVAL_PP(z_var); - if((s1 == NULL) || ($1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1) )) { + if((s1 == NULL) || ($1 == NULL) || strcmp(s1, $1)) { if(s1) efree(s1); if($1) { (*z_var)->value.str.val = estrdup($1); - (*z_var)->value.str.len = strlen($1) +1; + (*z_var)->value.str.len = strlen($1) + 1; } else { (*z_var)->value.str.val = 0; (*z_var)->value.str.len = 0; @@ -314,7 +320,7 @@ zval **z_var; zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); - if($1) + if($1) SWIG_SetPointerZval(*z_var, (void*)$1, $1_descriptor, 0); } @@ -325,10 +331,10 @@ deliberate error cos this code looks bogus to me zend_hash_find(&EG(symbol_table), (char*)"$1", sizeof("$1"), (void**)&z_var); s1 = Z_STRVAL_PP(z_var); - if((s1 == NULL) || zend_binary_strcmp(s1, strlen(s1), $1, strlen($1))) { + if((s1 == NULL) || strcmp(s1, $1)) { if($1) { (*z_var)->value.str.val = estrdup($1); - (*z_var)->value.str.len = strlen($1)+1; + (*z_var)->value.str.len = strlen($1) + 1; } else { (*z_var)->value.str.val = 0; (*z_var)->value.str.len = 0; @@ -336,7 +342,7 @@ } } -%typemap(varout) SWIGTYPE *, SWIGTYPE & +%typemap(varout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE && { zval **z_var;
diff --git a/share/swig/2.0.11/php/php.swg b/share/swig/3.0.12/php5/php.swg similarity index 89% rename from share/swig/2.0.11/php/php.swg rename to share/swig/3.0.12/php5/php.swg index f27e1fe..535c7d3 100644 --- a/share/swig/2.0.11/php/php.swg +++ b/share/swig/3.0.12/php5/php.swg
@@ -93,10 +93,12 @@ %typemap(directorout) SWIGTYPE ($&1_ltype tmp) { - if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) { - SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + /* If exit was via exception, PHP NULL is returned so skip the conversion. */ + if (!EG(exception)) { + if(SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor"); + $result = *tmp; } - $result = *tmp; } %typemap(in) SWIGTYPE *, @@ -114,6 +116,13 @@ } } +%typemap(in) SWIGTYPE && +{ + if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) { + SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor"); + } +} + %typemap(in) SWIGTYPE *const& ($*ltype temp) { if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) { @@ -131,7 +140,8 @@ %typemap(argout) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE&; + SWIGTYPE &, + SWIGTYPE &&; %typemap(in) void * { @@ -160,7 +170,7 @@ force=0; if (arg1==NULL) { #ifdef __cplusplus - ptr=new $*1_ltype; + ptr=new $*1_ltype(); #else ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); #endif @@ -188,12 +198,16 @@ signed char, unsigned char, bool, - size_t, - enum SWIGTYPE + size_t { ZVAL_LONG(return_value,$1); } +%typemap(out) enum SWIGTYPE +{ + ZVAL_LONG(return_value, (long)$1); +} + %typemap(out) long long %{ if ((long long)LONG_MIN <= $1 && $1 <= (long long)LONG_MAX) { @@ -226,12 +240,21 @@ const signed char &, const unsigned char &, const bool &, - const size_t &, - const enum SWIGTYPE & + const size_t & { ZVAL_LONG(return_value,*$1); } +%typemap(out) const enum SWIGTYPE & +{ + ZVAL_LONG(return_value, (long)*$1); +} + +%typemap(out) const enum SWIGTYPE && +{ + ZVAL_LONG(return_value, (long)*$1); +} + %typemap(out) const long long & %{ if ((long long)LONG_MIN <= *$1 && *$1 <= (long long)LONG_MAX) { @@ -269,6 +292,11 @@ ZVAL_LONG($input,$1); } +%typemap(directorin) enum SWIGTYPE +{ + ZVAL_LONG($input, (long)$1_name); +} + %typemap(directorin) char *, char [] { if(!$1) { @@ -342,7 +370,8 @@ %typemap(out) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner); %} @@ -354,7 +383,8 @@ %typemap(directorin) SWIGTYPE *, SWIGTYPE [], - SWIGTYPE & + SWIGTYPE &, + SWIGTYPE && %{ SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, ($owner)|2); %} @@ -363,11 +393,7 @@ { void * p = emalloc(sizeof($1)); memcpy(p, &$1, sizeof($1)); - zval * resource; - MAKE_STD_ZVAL(resource); - ZEND_REGISTER_RESOURCE(resource, p, swig_member_ptr); - - SWIG_SetPointerZval(return_value, (void *)&$1, $1_descriptor, $owner); + ZEND_REGISTER_RESOURCE(return_value, p, swig_member_ptr); } %typemap(in, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*) @@ -399,7 +425,7 @@ %typemap(directorin) SWIGTYPE { - SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1), $&1_descriptor, 2); + SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1|2); } %typemap(out) void ""; @@ -449,6 +475,7 @@ SWIGTYPE *, SWIGTYPE [], SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE *const& { void *tmp; @@ -479,7 +506,7 @@ return; } -%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ +%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{ (void)$1; zend_throw_exception(NULL, const_cast<char*>("C++ $1_type exception thrown"), 0 TSRMLS_CC); return; @@ -492,6 +519,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/php/phpinit.swg b/share/swig/3.0.12/php5/phpinit.swg similarity index 96% rename from share/swig/2.0.11/php/phpinit.swg rename to share/swig/3.0.12/php5/phpinit.swg index 6e5cc29..d8a61b0 100644 --- a/share/swig/2.0.11/php/phpinit.swg +++ b/share/swig/3.0.12/php5/phpinit.swg
@@ -6,7 +6,7 @@ %insert(init) "swiginit.swg" %init %{ - SWIG_php_minit { +SWIG_php_minit { SWIG_InitializeModule(0); %}
diff --git a/share/swig/3.0.12/php5/phpkw.swg b/share/swig/3.0.12/php5/phpkw.swg new file mode 100644 index 0000000..36e535f --- /dev/null +++ b/share/swig/3.0.12/php5/phpkw.swg
@@ -0,0 +1,866 @@ +/* ----------------------------------------------------------------------------- + * phpkw.swg + * ----------------------------------------------------------------------------- */ + +/* Keyword (case insensitive) */ +#define PHPKW(x) %keywordwarn("'" `x` "' is a PHP keyword, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",rename="c_%s") `x` + +/* Class (case insensitive) */ +#define PHPCN(x) %keywordwarn("'" `x` "' is a PHP reserved class name, renaming to 'c_" `x` "'",%$isclass,sourcefmt="%(lower)s",rename="c_%s") `x` + +/* Constant (case insensitive) */ +#define PHPBN1a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem,sourcefmt="%(lower)s") `x` +#define PHPBN1b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant,sourcefmt="%(lower)s") `x` +%define PHPBN1(X) + PHPBN1a(X); PHPBN1b(X) +%enddef + +/* Constant (case sensitive) */ +#define PHPBN2a(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "enum conflicts with a built-in constant '"`x`"' in PHP"),%$isenumitem) `x` +#define PHPBN2b(x) %namewarn(%warningmsg(SWIGWARN_PARSE_BUILTIN_NAME, "constant conflicts with a built-in constant '"`x`"' in PHP"),%$isconstant) `x` +%define PHPBN2(X) + PHPBN2a(X); PHPBN2b(X) +%enddef + +#define PHPFN(x) %keywordwarn("'" `x` "' is a PHP built-in function, renaming to 'c_" `x` "'",sourcefmt="%(lower)s",%$isfunction,%$not %$ismember,rename="c_%s") `x` + +/* From: http://php.net/manual/en/reserved.keywords.php + * "You cannot use any of the following words as constants, class names, + * function or method names. Using them as variable names is generally OK, but + * could lead to confusion." + */ +/* Check is case insensitive - these *MUST* be listed in lower case here */ +PHPKW(__halt_compiler); +PHPKW(abstract); +PHPKW(and); +PHPKW(array); +PHPKW(as); +PHPKW(break); +PHPKW(callable); // As of PHP 5.4 +PHPKW(case); +PHPKW(catch); +PHPKW(class); +PHPKW(clone); +PHPKW(const); +PHPKW(continue); +PHPKW(declare); +PHPKW(default); +PHPKW(die); // "Language construct" +PHPKW(do); +PHPKW(echo); // "Language construct" +PHPKW(else); +PHPKW(elseif); +PHPKW(empty); // "Language construct" +PHPKW(enddeclare); +PHPKW(endfor); +PHPKW(endforeach); +PHPKW(endif); +PHPKW(endswitch); +PHPKW(endwhile); +PHPKW(eval); // "Language construct" +PHPKW(exit); // "Language construct" +PHPKW(extends); +PHPKW(final); +PHPKW(finally); // As of PHP 5.5 +PHPKW(for); +PHPKW(foreach); +PHPKW(function); +PHPKW(global); +PHPKW(goto); // As of PHP 5.3 +PHPKW(if); +PHPKW(implements); +PHPKW(include); // "Language construct" +PHPKW(include_once); // "Language construct" +PHPKW(instanceof); +PHPKW(insteadof); // As of PHP 5.4 +PHPKW(interface); +PHPKW(isset); // "Language construct" +PHPKW(list); // "Language construct" +PHPKW(namespace); // As of PHP 5.3 +PHPKW(new); +PHPKW(or); +PHPKW(print); // "Language construct" +PHPKW(private); +PHPKW(protected); +PHPKW(public); +PHPKW(require); // "Language construct" +PHPKW(require_once); // "Language construct" +PHPKW(return); // "Language construct" +PHPKW(static); +PHPKW(switch); +PHPKW(throw); +PHPKW(trait); // As of PHP 5.4 +PHPKW(try); +PHPKW(unset); // "Language construct" +PHPKW(use); +PHPKW(var); +PHPKW(while); +PHPKW(xor); +PHPKW(yield); // As of PHP 5.5 + +// Compile-time "magic" constants +// From: http://php.net/manual/en/reserved.keywords.php +// also at: http://php.net/manual/en/language.constants.predefined.php +/* These *MUST* be listed in lower case here */ +PHPKW(__class__); +PHPKW(__dir__); // As of PHP 5.3 +PHPKW(__file__); +PHPKW(__function__); +PHPKW(__line__); +PHPKW(__method__); +PHPKW(__namespace__); // As of PHP 5.3 +PHPKW(__trait__); // As of PHP 5.4 + +/* We classify these as built-in names since they conflict, but PHP still runs */ + +/* Predefined case-insensitive constants */ +/* These *MUST* be listed in lower case here */ +PHPBN1(null); +PHPBN1(true); +PHPBN1(false); + +/* "Core Predefined Constants" from http://php.net/manual/en/reserved.constants.php */ +/* These are case sensitive */ +PHPBN2(PHP_VERSION); +PHPBN2(PHP_MAJOR_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_MINOR_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_RELEASE_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_VERSION_ID); // As of PHP 5.2.7 +PHPBN2(PHP_EXTRA_VERSION); // As of PHP 5.2.7 +PHPBN2(PHP_ZTS); // As of PHP 5.2.7 +PHPBN2(PHP_DEBUG); // As of PHP 5.2.7 +PHPBN2(PHP_MAXPATHLEN); // As of PHP 5.3.0 +PHPBN2(PHP_OS); +PHPBN2(PHP_SAPI); +PHPBN2(PHP_EOL); // As of PHP 5.0.2 +PHPBN2(PHP_INT_MAX); // As of PHP 5.0.5 +PHPBN2(PHP_INT_SIZE); // As of PHP 5.0.5 +PHPBN2(DEFAULT_INCLUDE_PATH); +PHPBN2(PEAR_INSTALL_DIR); +PHPBN2(PEAR_EXTENSION_DIR); +PHPBN2(PHP_EXTENSION_DIR); +PHPBN2(PHP_PREFIX); +PHPBN2(PHP_BINDIR); +PHPBN2(PHP_BINARY); // As of PHP 5.4 +PHPBN2(PHP_MANDIR); // As of PHP 5.3.7 +PHPBN2(PHP_LIBDIR); +PHPBN2(PHP_DATADIR); +PHPBN2(PHP_SYSCONFDIR); +PHPBN2(PHP_LOCALSTATEDIR); +PHPBN2(PHP_CONFIG_FILE_PATH); +PHPBN2(PHP_CONFIG_FILE_SCAN_DIR); +PHPBN2(PHP_SHLIB_SUFFIX); +PHPBN2(E_ERROR); +PHPBN2(E_WARNING); +PHPBN2(E_PARSE); +PHPBN2(E_NOTICE); +PHPBN2(E_CORE_ERROR); +PHPBN2(E_CORE_WARNING); +PHPBN2(E_COMPILE_ERROR); +PHPBN2(E_COMPILE_WARNING); +PHPBN2(E_USER_ERROR); +PHPBN2(E_USER_WARNING); +PHPBN2(E_USER_NOTICE); +PHPBN2(E_DEPRECATED); // As of PHP 5.3.0 +PHPBN2(E_USER_DEPRECATED); // As of PHP 5.3.0 +PHPBN2(E_ALL); +PHPBN2(E_STRICT); +PHPBN2(__COMPILER_HALT_OFFSET__); // As of PHP 5.1.0 +// TRUE, FALSE, NULL are listed on the same page, but are actually +// case-insensitive, whereas all the other constants listed there seem to be +// case-sensitive, so we handle TRUE, FALSE, NULL in PHPBN1. +PHPBN2(PHP_OUTPUT_HANDLER_START); +PHPBN2(PHP_OUTPUT_HANDLER_CONT); +PHPBN2(PHP_OUTPUT_HANDLER_END); +/* These don't actually seem to be set (tested on Linux, I guess they're + * Windows only?) */ +PHPBN2(PHP_WINDOWS_NT_DOMAIN_CONTROLLER); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_NT_SERVER); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_NT_WORKSTATION); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_BUILD); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_MAJOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_MINOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_PLATFORM); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_PRODUCTTYPE); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SP_MAJOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SP_MINOR); // As of PHP 5.3 +PHPBN2(PHP_WINDOWS_VERSION_SUITEMASK); // As of PHP 5.3 +/* "Standard Predefined Constants" from http://php.net/manual/en/reserved.constants.php */ +PHPBN2(EXTR_OVERWRITE); +PHPBN2(EXTR_SKIP); +PHPBN2(EXTR_PREFIX_SAME); +PHPBN2(EXTR_PREFIX_ALL); +PHPBN2(EXTR_PREFIX_INVALID); +PHPBN2(EXTR_PREFIX_IF_EXISTS); +PHPBN2(EXTR_IF_EXISTS); +PHPBN2(SORT_ASC); +PHPBN2(SORT_DESC); +PHPBN2(SORT_REGULAR); +PHPBN2(SORT_NUMERIC); +PHPBN2(SORT_STRING); +PHPBN2(CASE_LOWER); +PHPBN2(CASE_UPPER); +PHPBN2(COUNT_NORMAL); +PHPBN2(COUNT_RECURSIVE); +PHPBN2(ASSERT_ACTIVE); +PHPBN2(ASSERT_CALLBACK); +PHPBN2(ASSERT_BAIL); +PHPBN2(ASSERT_WARNING); +PHPBN2(ASSERT_QUIET_EVAL); +PHPBN2(CONNECTION_ABORTED); +PHPBN2(CONNECTION_NORMAL); +PHPBN2(CONNECTION_TIMEOUT); +PHPBN2(INI_USER); +PHPBN2(INI_PERDIR); +PHPBN2(INI_SYSTEM); +PHPBN2(INI_ALL); +PHPBN2(INI_SCANNER_NORMAL); // As of PHP 5.3 +PHPBN2(INI_SCANNER_RAW); // As of PHP 5.3 +PHPBN2(M_E); +PHPBN2(M_LOG2E); +PHPBN2(M_LOG10E); +PHPBN2(M_LN2); +PHPBN2(M_LN10); +PHPBN2(M_PI); +PHPBN2(M_PI_2); +PHPBN2(M_PI_4); +PHPBN2(M_1_PI); +PHPBN2(M_2_PI); +PHPBN2(M_2_SQRTPI); +PHPBN2(M_SQRT2); +PHPBN2(M_SQRT1_2); +PHPBN2(M_EULER); // As of PHP 5.2 +PHPBN2(M_LNPI); // As of PHP 5.2 +PHPBN2(M_SQRT3); // As of PHP 5.2 +PHPBN2(M_SQRTPI); // As of PHP 5.2 +PHPBN2(CRYPT_SALT_LENGTH); +PHPBN2(CRYPT_STD_DES); +PHPBN2(CRYPT_EXT_DES); +PHPBN2(CRYPT_MD5); +PHPBN2(CRYPT_BLOWFISH); +PHPBN2(DIRECTORY_SEPARATOR); +PHPBN2(SEEK_SET); +PHPBN2(SEEK_CUR); +PHPBN2(SEEK_END); +PHPBN2(LOCK_SH); +PHPBN2(LOCK_EX); +PHPBN2(LOCK_UN); +PHPBN2(LOCK_NB); +PHPBN2(HTML_SPECIALCHARS); +PHPBN2(HTML_ENTITIES); +PHPBN2(ENT_COMPAT); +PHPBN2(ENT_QUOTES); +PHPBN2(ENT_NOQUOTES); +PHPBN2(INFO_GENERAL); +PHPBN2(INFO_CREDITS); +PHPBN2(INFO_CONFIGURATION); +PHPBN2(INFO_MODULES); +PHPBN2(INFO_ENVIRONMENT); +PHPBN2(INFO_VARIABLES); +PHPBN2(INFO_LICENSE); +PHPBN2(INFO_ALL); +PHPBN2(CREDITS_GROUP); +PHPBN2(CREDITS_GENERAL); +PHPBN2(CREDITS_SAPI); +PHPBN2(CREDITS_MODULES); +PHPBN2(CREDITS_DOCS); +PHPBN2(CREDITS_FULLPAGE); +PHPBN2(CREDITS_QA); +PHPBN2(CREDITS_ALL); +PHPBN2(STR_PAD_LEFT); +PHPBN2(STR_PAD_RIGHT); +PHPBN2(STR_PAD_BOTH); +PHPBN2(PATHINFO_DIRNAME); +PHPBN2(PATHINFO_BASENAME); +PHPBN2(PATHINFO_EXTENSION); +PHPBN2(PATHINFO_FILENAME); // As of PHP 5.2 +PHPBN2(PATH_SEPARATOR); +PHPBN2(CHAR_MAX); +PHPBN2(LC_CTYPE); +PHPBN2(LC_NUMERIC); +PHPBN2(LC_TIME); +PHPBN2(LC_COLLATE); +PHPBN2(LC_MONETARY); +PHPBN2(LC_ALL); +PHPBN2(LC_MESSAGES); +PHPBN2(ABDAY_1); +PHPBN2(ABDAY_2); +PHPBN2(ABDAY_3); +PHPBN2(ABDAY_4); +PHPBN2(ABDAY_5); +PHPBN2(ABDAY_6); +PHPBN2(ABDAY_7); +PHPBN2(DAY_1); +PHPBN2(DAY_2); +PHPBN2(DAY_3); +PHPBN2(DAY_4); +PHPBN2(DAY_5); +PHPBN2(DAY_6); +PHPBN2(DAY_7); +PHPBN2(ABMON_1); +PHPBN2(ABMON_2); +PHPBN2(ABMON_3); +PHPBN2(ABMON_4); +PHPBN2(ABMON_5); +PHPBN2(ABMON_6); +PHPBN2(ABMON_7); +PHPBN2(ABMON_8); +PHPBN2(ABMON_9); +PHPBN2(ABMON_10); +PHPBN2(ABMON_11); +PHPBN2(ABMON_12); +PHPBN2(MON_1); +PHPBN2(MON_2); +PHPBN2(MON_3); +PHPBN2(MON_4); +PHPBN2(MON_5); +PHPBN2(MON_6); +PHPBN2(MON_7); +PHPBN2(MON_8); +PHPBN2(MON_9); +PHPBN2(MON_10); +PHPBN2(MON_11); +PHPBN2(MON_12); +PHPBN2(AM_STR); +PHPBN2(PM_STR); +PHPBN2(D_T_FMT); +PHPBN2(D_FMT); +PHPBN2(T_FMT); +PHPBN2(T_FMT_AMPM); +PHPBN2(ERA); +PHPBN2(ERA_YEAR); +PHPBN2(ERA_D_T_FMT); +PHPBN2(ERA_D_FMT); +PHPBN2(ERA_T_FMT); +PHPBN2(ALT_DIGITS); +PHPBN2(INT_CURR_SYMBOL); +PHPBN2(CURRENCY_SYMBOL); +PHPBN2(CRNCYSTR); +PHPBN2(MON_DECIMAL_POINT); +PHPBN2(MON_THOUSANDS_SEP); +PHPBN2(MON_GROUPING); +PHPBN2(POSITIVE_SIGN); +PHPBN2(NEGATIVE_SIGN); +PHPBN2(INT_FRAC_DIGITS); +PHPBN2(FRAC_DIGITS); +PHPBN2(P_CS_PRECEDES); +PHPBN2(P_SEP_BY_SPACE); +PHPBN2(N_CS_PRECEDES); +PHPBN2(N_SEP_BY_SPACE); +PHPBN2(P_SIGN_POSN); +PHPBN2(N_SIGN_POSN); +PHPBN2(DECIMAL_POINT); +PHPBN2(RADIXCHAR); +PHPBN2(THOUSANDS_SEP); +PHPBN2(THOUSEP); +PHPBN2(GROUPING); +PHPBN2(YESEXPR); +PHPBN2(NOEXPR); +PHPBN2(YESSTR); +PHPBN2(NOSTR); +PHPBN2(CODESET); +PHPBN2(LOG_EMERG); +PHPBN2(LOG_ALERT); +PHPBN2(LOG_CRIT); +PHPBN2(LOG_ERR); +PHPBN2(LOG_WARNING); +PHPBN2(LOG_NOTICE); +PHPBN2(LOG_INFO); +PHPBN2(LOG_DEBUG); +PHPBN2(LOG_KERN); +PHPBN2(LOG_USER); +PHPBN2(LOG_MAIL); +PHPBN2(LOG_DAEMON); +PHPBN2(LOG_AUTH); +PHPBN2(LOG_SYSLOG); +PHPBN2(LOG_LPR); +PHPBN2(LOG_NEWS); +PHPBN2(LOG_UUCP); +PHPBN2(LOG_CRON); +PHPBN2(LOG_AUTHPRIV); +PHPBN2(LOG_LOCAL0); +PHPBN2(LOG_LOCAL1); +PHPBN2(LOG_LOCAL2); +PHPBN2(LOG_LOCAL3); +PHPBN2(LOG_LOCAL4); +PHPBN2(LOG_LOCAL5); +PHPBN2(LOG_LOCAL6); +PHPBN2(LOG_LOCAL7); +PHPBN2(LOG_PID); +PHPBN2(LOG_CONS); +PHPBN2(LOG_ODELAY); +PHPBN2(LOG_NDELAY); +PHPBN2(LOG_NOWAIT); +PHPBN2(LOG_PERROR); + +/* Added in PHP 5.2 */ +PHPBN2(PREG_BACKTRACK_LIMIT_ERROR); +PHPBN2(PREG_BAD_UTF8_ERROR); +PHPBN2(PREG_INTERNAL_ERROR); +PHPBN2(PREG_NO_ERROR); +PHPBN2(PREG_RECURSION_LIMIT_ERROR); +PHPBN2(UPLOAD_ERR_EXTENSION); +PHPBN2(STREAM_SHUT_RD); +PHPBN2(STREAM_SHUT_WR); +PHPBN2(STREAM_SHUT_RDWR); +PHPBN2(CURLE_FILESIZE_EXCEEDED); +PHPBN2(CURLE_FTP_SSL_FAILED); +PHPBN2(CURLE_LDAP_INVALID_URL); +PHPBN2(CURLFTPAUTH_DEFAULT); +PHPBN2(CURLFTPAUTH_SSL); +PHPBN2(CURLFTPAUTH_TLS); +PHPBN2(CURLFTPSSL_ALL); +PHPBN2(CURLFTPSSL_CONTROL); +PHPBN2(CURLFTPSSL_NONE); +PHPBN2(CURLFTPSSL_TRY); +PHPBN2(CURLOPT_FTP_SSL); +PHPBN2(CURLOPT_FTPSSLAUTH); +PHPBN2(CURLOPT_TCP_NODELAY); // Added in PHP 5.2.1 +PHPBN2(CURLOPT_TIMEOUT_MS); // Added in PHP 5.2.3 +PHPBN2(CURLOPT_CONNECTTIMEOUT_MS); // Added in PHP 5.2.3 +PHPBN2(GMP_VERSION); // Added in PHP 5.2.2 +PHPBN2(SWFTEXTFIELD_USEFONT); +PHPBN2(SWFTEXTFIELD_AUTOSIZE); +PHPBN2(SWF_SOUND_NOT_COMPRESSED); +PHPBN2(SWF_SOUND_ADPCM_COMPRESSED); +PHPBN2(SWF_SOUND_MP3_COMPRESSED); +PHPBN2(SWF_SOUND_NOT_COMPRESSED_LE); +PHPBN2(SWF_SOUND_NELLY_COMPRESSED); +PHPBN2(SWF_SOUND_5KHZ); +PHPBN2(SWF_SOUND_11KHZ); +PHPBN2(SWF_SOUND_22KHZ); +PHPBN2(SWF_SOUND_44KHZ); +PHPBN2(SWF_SOUND_8BITS); +PHPBN2(SWF_SOUND_16BITS); +PHPBN2(SWF_SOUND_MONO); +PHPBN2(SWF_SOUND_STEREO); +PHPBN2(OPENSSL_VERSION_NUMBER); +PHPBN2(SNMP_OID_OUTPUT_FULL); +PHPBN2(SNMP_OID_OUTPUT_NUMERIC); +PHPBN2(MSG_EAGAIN); +PHPBN2(MSG_ENOMSG); + +/* Added in PHP 5.3 */ +PHPBN2(CURLOPT_PROGRESSFUNCTION); +PHPBN2(IMG_FILTER_PIXELATE); +PHPBN2(JSON_ERROR_CTRL_CHAR); +PHPBN2(JSON_ERROR_DEPTH); +PHPBN2(JSON_ERROR_NONE); +PHPBN2(JSON_ERROR_STATE_MISMATCH); +PHPBN2(JSON_ERROR_SYNTAX); +PHPBN2(JSON_FORCE_OBJECT); +PHPBN2(JSON_HEX_TAG); +PHPBN2(JSON_HEX_AMP); +PHPBN2(JSON_HEX_APOS); +PHPBN2(JSON_HEX_QUOT); +PHPBN2(LDAP_OPT_NETWORK_TIMEOUT); +PHPBN2(LIBXML_LOADED_VERSION); +PHPBN2(PREG_BAD_UTF8_OFFSET_ERROR); +PHPBN2(BUS_ADRALN); +PHPBN2(BUS_ADRERR); +PHPBN2(BUS_OBJERR); +PHPBN2(CLD_CONTIUNED); +PHPBN2(CLD_DUMPED); +PHPBN2(CLD_EXITED); +PHPBN2(CLD_KILLED); +PHPBN2(CLD_STOPPED); +PHPBN2(CLD_TRAPPED); +PHPBN2(FPE_FLTDIV); +PHPBN2(FPE_FLTINV); +PHPBN2(FPE_FLTOVF); +PHPBN2(FPE_FLTRES); +PHPBN2(FPE_FLTSUB); +PHPBN2(FPE_FLTUND); +PHPBN2(FPE_INTDIV); +PHPBN2(FPE_INTOVF); +PHPBN2(ILL_BADSTK); +PHPBN2(ILL_COPROC); +PHPBN2(ILL_ILLADR); +PHPBN2(ILL_ILLOPC); +PHPBN2(ILL_ILLOPN); +PHPBN2(ILL_ILLTRP); +PHPBN2(ILL_PRVOPC); +PHPBN2(ILL_PRVREG); +PHPBN2(POLL_ERR); +PHPBN2(POLL_HUP); +PHPBN2(POLL_IN); +PHPBN2(POLL_MSG); +PHPBN2(POLL_OUT); +PHPBN2(POLL_PRI); +PHPBN2(SEGV_ACCERR); +PHPBN2(SEGV_MAPERR); +PHPBN2(SI_ASYNCIO); +PHPBN2(SI_KERNEL); +PHPBN2(SI_MESGQ); +PHPBN2(SI_NOINFO); +PHPBN2(SI_QUEUE); +PHPBN2(SI_SIGIO); +PHPBN2(SI_TIMER); +PHPBN2(SI_TKILL); +PHPBN2(SI_USER); +PHPBN2(SIG_BLOCK); +PHPBN2(SIG_SETMASK); +PHPBN2(SIG_UNBLOCK); +PHPBN2(TRAP_BRKPT); +PHPBN2(TRAP_TRACE); + +/* Added in PHP 5.4 */ +PHPBN2(ENT_DISALLOWED); +PHPBN2(ENT_HTML401); +PHPBN2(ENT_HTML5); +PHPBN2(ENT_SUBSTITUTE); +PHPBN2(ENT_XML1); +PHPBN2(ENT_XHTML); +PHPBN2(IPPROTO_IP); +PHPBN2(IPPROTO_IPV6); +PHPBN2(IPV6_MULTICAST_HOPS); +PHPBN2(IPV6_MULTICAST_IF); +PHPBN2(IPV6_MULTICAST_LOOP); +PHPBN2(IP_MULTICAST_IF); +PHPBN2(IP_MULTICAST_LOOP); +PHPBN2(IP_MULTICAST_TTL); +PHPBN2(MCAST_JOIN_GROUP); +PHPBN2(MCAST_LEAVE_GROUP); +PHPBN2(MCAST_BLOCK_SOURCE); +PHPBN2(MCAST_UNBLOCK_SOURCE); +PHPBN2(MCAST_JOIN_SOURCE_GROUP); +PHPBN2(MCAST_LEAVE_SOURCE_GROUP); +PHPBN2(CURLOPT_MAX_RECV_SPEED_LARGE); +PHPBN2(CURLOPT_MAX_SEND_SPEED_LARGE); +PHPBN2(LIBXML_HTML_NODEFDTD); +PHPBN2(LIBXML_HTML_NOIMPLIED); +PHPBN2(LIBXML_PEDANTIC); +PHPBN2(OPENSSL_CIPHER_AES_128_CBC); +PHPBN2(OPENSSL_CIPHER_AES_192_CBC); +PHPBN2(OPENSSL_CIPHER_AES_256_CBC); +PHPBN2(OPENSSL_RAW_DATA); +PHPBN2(OPENSSL_ZERO_PADDING); +PHPBN2(PHP_OUTPUT_HANDLER_CLEAN); +PHPBN2(PHP_OUTPUT_HANDLER_CLEANABLE); +PHPBN2(PHP_OUTPUT_HANDLER_DISABLED); +PHPBN2(PHP_OUTPUT_HANDLER_FINAL); +PHPBN2(PHP_OUTPUT_HANDLER_FLUSH); +PHPBN2(PHP_OUTPUT_HANDLER_FLUSHABLE); +PHPBN2(PHP_OUTPUT_HANDLER_REMOVABLE); +PHPBN2(PHP_OUTPUT_HANDLER_STARTED); +PHPBN2(PHP_OUTPUT_HANDLER_STDFLAGS); +PHPBN2(PHP_OUTPUT_HANDLER_WRITE); +PHPBN2(PHP_SESSION_ACTIVE); +PHPBN2(PHP_SESSION_DISABLED); +PHPBN2(PHP_SESSION_NONE); +PHPBN2(STREAM_META_ACCESS); +PHPBN2(STREAM_META_GROUP); +PHPBN2(STREAM_META_GROUP_NAME); +PHPBN2(STREAM_META_OWNER); +PHPBN2(STREAM_META_OWNER_NAME); +PHPBN2(STREAM_META_TOUCH); +PHPBN2(ZLIB_ENCODING_DEFLATE); +PHPBN2(ZLIB_ENCODING_GZIP); +PHPBN2(ZLIB_ENCODING_RAW); +PHPBN2(U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR); +PHPBN2(IDNA_CHECK_BIDI); +PHPBN2(IDNA_CHECK_CONTEXTJ); +PHPBN2(IDNA_NONTRANSITIONAL_TO_ASCII); +PHPBN2(IDNA_NONTRANSITIONAL_TO_UNICODE); +PHPBN2(INTL_IDNA_VARIANT_2003); +PHPBN2(INTL_IDNA_VARIANT_UTS46); +PHPBN2(IDNA_ERROR_EMPTY_LABEL); +PHPBN2(IDNA_ERROR_LABEL_TOO_LONG); +PHPBN2(IDNA_ERROR_DOMAIN_NAME_TOO_LONG); +PHPBN2(IDNA_ERROR_LEADING_HYPHEN); +PHPBN2(IDNA_ERROR_TRAILING_HYPHEN); +PHPBN2(IDNA_ERROR_HYPHEN_3_4); +PHPBN2(IDNA_ERROR_LEADING_COMBINING_MARK); +PHPBN2(IDNA_ERROR_DISALLOWED); +PHPBN2(IDNA_ERROR_PUNYCODE); +PHPBN2(IDNA_ERROR_LABEL_HAS_DOT); +PHPBN2(IDNA_ERROR_INVALID_ACE_LABEL); +PHPBN2(IDNA_ERROR_BIDI); +PHPBN2(IDNA_ERROR_CONTEXTJ); +PHPBN2(JSON_PRETTY_PRINT); +PHPBN2(JSON_UNESCAPED_SLASHES); +PHPBN2(JSON_NUMERIC_CHECK); +PHPBN2(JSON_UNESCAPED_UNICODE); +PHPBN2(JSON_BIGINT_AS_STRING); + +/* Added in PHP 5.5 */ +PHPBN2(IMG_AFFINE_TRANSLATE); +PHPBN2(IMG_AFFINE_SCALE); +PHPBN2(IMG_AFFINE_ROTATE); +PHPBN2(IMG_AFFINE_SHEAR_HORIZONTAL); +PHPBN2(IMG_AFFINE_SHEAR_VERTICAL); +PHPBN2(IMG_CROP_DEFAULT); +PHPBN2(IMG_CROP_TRANSPARENT); +PHPBN2(IMG_CROP_BLACK); +PHPBN2(IMG_CROP_WHITE); +PHPBN2(IMG_CROP_SIDES); +PHPBN2(IMG_FLIP_BOTH); +PHPBN2(IMG_FLIP_HORIZONTAL); +PHPBN2(IMG_FLIP_VERTICAL); +PHPBN2(IMG_BELL); +PHPBN2(IMG_BESSEL); +PHPBN2(IMG_BICUBIC); +PHPBN2(IMG_BICUBIC_FIXED); +PHPBN2(IMG_BLACKMAN); +PHPBN2(IMG_BOX); +PHPBN2(IMG_BSPLINE); +PHPBN2(IMG_CATMULLROM); +PHPBN2(IMG_GAUSSIAN); +PHPBN2(IMG_GENERALIZED_CUBIC); +PHPBN2(IMG_HERMITE); +PHPBN2(IMG_HAMMING); +PHPBN2(IMG_HANNING); +PHPBN2(IMG_MITCHELL); +PHPBN2(IMG_POWER); +PHPBN2(IMG_QUADRATIC); +PHPBN2(IMG_SINC); +PHPBN2(IMG_NEAREST_NEIGHBOUR); +PHPBN2(IMG_WEIGHTED4); +PHPBN2(IMG_TRIANGLE); +PHPBN2(JSON_ERROR_RECURSION); +PHPBN2(JSON_ERROR_INF_OR_NAN); +PHPBN2(JSON_ERROR_UNSUPPORTED_TYPE); +PHPBN2(MYSQLI_SERVER_PUBLIC_KEY); + +/* Added in PHP 5.6 */ +PHPBN2(LDAP_ESCAPE_DN); +PHPBN2(LDAP_ESCAPE_FILTER); +PHPBN2(OPENSSL_DEFAULT_STREAM_CIPHERS); +PHPBN2(STREAM_CRYPTO_METHOD_ANY_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_ANY_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_0_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_1_SERVER); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT); +PHPBN2(STREAM_CRYPTO_METHOD_TLSv1_2_SERVER); +PHPBN2(PGSQL_CONNECT_ASYNC); +PHPBN2(PGSQL_CONNECTION_AUTH_OK); +PHPBN2(PGSQL_CONNECTION_AWAITING_RESPONSE); +PHPBN2(PGSQL_CONNECTION_MADE); +PHPBN2(PGSQL_CONNECTION_SETENV); +PHPBN2(PGSQL_CONNECTION_SSL_STARTUP); +PHPBN2(PGSQL_CONNECTION_STARTED); +PHPBN2(PGSQL_DML_ESCAPE); +PHPBN2(PGSQL_POLLING_ACTIVE); +PHPBN2(PGSQL_POLLING_FAILED); +PHPBN2(PGSQL_POLLING_OK); +PHPBN2(PGSQL_POLLING_READING); +PHPBN2(PGSQL_POLLING_WRITING); + +/* Class names reserved by PHP (case insensitive) */ +PHPCN(directory); +PHPCN(stdclass); +PHPCN(__php_incomplete_class); +/* Added in PHP5. */ +PHPCN(exception); +PHPCN(errorexception); // As of PHP 5.1 +PHPCN(php_user_filter); +PHPCN(closure); // As of PHP 5.3 +PHPCN(generator); // As of PHP 5.5 +PHPCN(self); +PHPCN(static); +PHPCN(parent); +/* From extensions (which of these are actually predefined depends which + * extensions are loaded by default). */ +PHPCN(xmlwriter); +PHPCN(libxmlerror); +PHPCN(simplexmlelement); +PHPCN(soapclient); +PHPCN(soapvar); +PHPCN(soapserver); +PHPCN(soapfault); +PHPCN(soapparam); +PHPCN(soapheader); +PHPCN(recursiveiteratoriterator); +PHPCN(filteriterator); +PHPCN(recursivefilteriterator); +PHPCN(parentiterator); +PHPCN(limititerator); +PHPCN(cachingiterator); +PHPCN(recursivecachingiterator); +PHPCN(iteratoriterator); +PHPCN(norewinditerator); +PHPCN(appenditerator); +PHPCN(infiniteiterator); +PHPCN(emptyiterator); +PHPCN(arrayobject); +PHPCN(arrayiterator); +PHPCN(recursivearrayiterator); +PHPCN(splfileinfo); +PHPCN(directoryiterator); +PHPCN(recursivedirectoryiterator); +PHPCN(splfileobject); +PHPCN(spltempfileobject); +PHPCN(simplexmliterator); +PHPCN(logicexception); +PHPCN(badfunctioncallexception); +PHPCN(badmethodcallexception); +PHPCN(domainexception); +PHPCN(invalidargumentexception); +PHPCN(lengthexception); +PHPCN(outofrangeexception); +PHPCN(runtimeexception); +PHPCN(outofboundsexception); +PHPCN(overflowexception); +PHPCN(rangeexception); +PHPCN(underflowexception); +PHPCN(unexpectedvalueexception); +PHPCN(splobjectstorage); +PHPCN(reflectionexception); +PHPCN(reflection); +PHPCN(reflectionfunction); +PHPCN(reflectionparameter); +PHPCN(reflectionmethod); +PHPCN(reflectionclass); +PHPCN(reflectionobject); +PHPCN(reflectionproperty); +PHPCN(reflectionextension); +PHPCN(domexception); +PHPCN(domstringlist); +PHPCN(domnamelist); +PHPCN(domimplementationlist); +PHPCN(domimplementationsource); +PHPCN(domimplementation); +PHPCN(domnode); +PHPCN(domnamespacenode); +PHPCN(domdocumentfragment); +PHPCN(domdocument); +PHPCN(domnodelist); +PHPCN(domnamednodemap); +PHPCN(domcharacterdata); +PHPCN(domattr); +PHPCN(domelement); +PHPCN(domtext); +PHPCN(domcomment); +PHPCN(domtypeinfo); +PHPCN(domuserdatahandler); +PHPCN(domdomerror); +PHPCN(domerrorhandler); +PHPCN(domlocator); +PHPCN(domconfiguration); +PHPCN(domcdatasection); +PHPCN(domdocumenttype); +PHPCN(domnotation); +PHPCN(domentity); +PHPCN(domentityreference); +PHPCN(domprocessinginstruction); +PHPCN(domstringextend); +PHPCN(domxpath); +PHPCN(xmlreader); +PHPCN(sqlitedatabase); +PHPCN(sqliteresult); +PHPCN(sqliteunbuffered); +PHPCN(sqliteexception); +PHPCN(datetime); + +/* Built-in PHP functions (incomplete). */ +/* Includes Array Functions - http://php.net/manual/en/ref.array.php */ +/* Check is case insensitive - these *MUST* be listed in lower case here */ +PHPFN(acos); +PHPFN(array_change_key_case); +PHPFN(array_chunk); +PHPFN(array_column); +PHPFN(array_combine); +PHPFN(array_count_values); +PHPFN(array_diff); +PHPFN(array_diff_assoc); +PHPFN(array_diff_key); +PHPFN(array_diff_uassoc); +PHPFN(array_diff_ukey); +PHPFN(array_fill); +PHPFN(array_fill_keys); +PHPFN(array_filter); +PHPFN(array_flip); +PHPFN(array_intersect); +PHPFN(array_intersect_assoc); +PHPFN(array_intersect_key); +PHPFN(array_intersect_uassoc); +PHPFN(array_intersect_ukey); +PHPFN(array_key_exists); +PHPFN(array_keys); +PHPFN(array_map); +PHPFN(array_merge); +PHPFN(array_merge_recursive); +PHPFN(array_multisort); +PHPFN(array_pad); +PHPFN(array_pop); +PHPFN(array_product); +PHPFN(array_push); +PHPFN(array_rand); +PHPFN(array_reduce); +PHPFN(array_replace); +PHPFN(array_replace_recursive); +PHPFN(array_reverse); +PHPFN(array_search); +PHPFN(array_shift); +PHPFN(array_slice); +PHPFN(array_splice); +PHPFN(array_sum); +PHPFN(array_udiff); +PHPFN(array_udiff_assoc); +PHPFN(array_udiff_uassoc); +PHPFN(array_uintersect); +PHPFN(array_uintersect_assoc); +PHPFN(array_uintersect_uassoc); +PHPFN(array_unique); +PHPFN(array_unshift); +PHPFN(array_values); +PHPFN(array_walk); +PHPFN(array_walk_recursive); +PHPFN(arsort); +PHPFN(asin); +PHPFN(asort); +PHPFN(atan); +PHPFN(atan2); +PHPFN(ceil); +PHPFN(compact); +PHPFN(cos); +PHPFN(cosh); +PHPFN(count); +PHPFN(current); +PHPFN(each); +PHPFN(end); +PHPFN(exp); +PHPFN(extract); +PHPFN(floor); +PHPFN(fmod); +PHPFN(in_array); +PHPFN(key); +PHPFN(key_exists); +PHPFN(krsort); +PHPFN(ksort); +PHPFN(log); +PHPFN(log10); +PHPFN(max); +PHPFN(min); +PHPFN(natcasesort); +PHPFN(natsort); +PHPFN(next); +PHPFN(pos); +PHPFN(pow); +PHPFN(prev); +PHPFN(range); +PHPFN(reset); +PHPFN(rsort); +PHPFN(shuffle); +PHPFN(sin); +PHPFN(sinh); +PHPFN(sizeof); +PHPFN(sort); +PHPFN(sqrt); +PHPFN(tan); +PHPFN(tanh); +PHPFN(uasort); +PHPFN(uksort); +PHPFN(usort); + +#undef PHPKW +#undef PHPBN1a +#undef PHPBN1b +#undef PHPBN1 +#undef PHPBN2a +#undef PHPBN2b +#undef PHPBN2 +#undef PHPCN +#undef PHPFN
diff --git a/share/swig/2.0.11/php/phppointers.i b/share/swig/3.0.12/php5/phppointers.i similarity index 96% rename from share/swig/2.0.11/php/phppointers.i rename to share/swig/3.0.12/php5/phppointers.i index 91b2c6d..e50ada7 100644 --- a/share/swig/2.0.11/php/phppointers.i +++ b/share/swig/3.0.12/php5/phppointers.i
@@ -1,5 +1,5 @@ %define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT ) -%typemap(in) TYPE *REF ($*1_ltype tmp), +%typemap(in, byref=1) TYPE *REF ($*1_ltype tmp), TYPE &REF ($*1_ltype tmp) %{ /* First Check for SWIG wrapped type */
diff --git a/share/swig/2.0.11/php/phprun.swg b/share/swig/3.0.12/php5/phprun.swg similarity index 95% rename from share/swig/2.0.11/php/phprun.swg rename to share/swig/3.0.12/php5/phprun.swg index a4188cc..a18e1fc 100644 --- a/share/swig/2.0.11/php/phprun.swg +++ b/share/swig/3.0.12/php5/phprun.swg
@@ -11,6 +11,11 @@ #include "zend_API.h" #include "zend_exceptions.h" #include "php.h" + +#if PHP_MAJOR_VERSION != 5 +# error These bindings need PHP5 - to generate PHP7 bindings use: swig -php7 +#endif + #include "ext/standard/php_string.h" #include <stdlib.h> /* for abort(), used in generated code. */ @@ -24,6 +29,10 @@ # define SWIG_ZEND_NAMED_FE(ZN, N, A) ZEND_NAMED_FE(ZN, N, A) #endif +#ifndef ZEND_FE_END +# define ZEND_FE_END { NULL, NULL, NULL } +#endif + #ifndef Z_SET_ISREF_P /* For PHP < 5.3 */ # define Z_SET_ISREF_P(z) (z)->is_ref = 1 @@ -79,7 +88,7 @@ if (!(expr) ) { zend_printf("Contract Assert Failed %s\n",msg ); } else /* Standard SWIG API */ -#define SWIG_GetModule(clientdata) SWIG_Php_GetModule(clientdata) +#define SWIG_GetModule(clientdata) SWIG_Php_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Php_SetModule(pointer) /* used to wrap returned objects in so we know whether they are newobject @@ -89,9 +98,6 @@ int newobject; } swig_object_wrapper; -/* empty zend destructor for types without one */ -static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; } - #define SWIG_SetPointerZval(a,b,c,d) SWIG_ZTS_SetPointerZval(a,b,c,d TSRMLS_CC) #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) @@ -153,7 +159,7 @@ } Z_SET_REFCOUNT_P(z, 1); Z_SET_ISREF_P(z); - zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL); + zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval*), NULL); } return; } @@ -252,14 +258,13 @@ } static char const_name[] = "swig_runtime_data_type_pointer"; -static swig_module_info *SWIG_Php_GetModule(void *SWIGUNUSEDPARM(clientdata)) { +static swig_module_info *SWIG_Php_GetModule() { zval *pointer; swig_module_info *ret = 0; + TSRMLS_FETCH(); MAKE_STD_ZVAL(pointer); - TSRMLS_FETCH(); - if (zend_get_constant(const_name, sizeof(const_name) - 1, pointer TSRMLS_CC)) { if (pointer->type == IS_LONG) { ret = (swig_module_info *) pointer->value.lval; @@ -271,5 +276,5 @@ static void SWIG_Php_SetModule(swig_module_info *pointer) { TSRMLS_FETCH(); - REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, 0); + REGISTER_MAIN_LONG_CONSTANT(const_name, (long) pointer, CONST_PERSISTENT | CONST_CS); }
diff --git a/share/swig/2.0.11/php/std_common.i b/share/swig/3.0.12/php5/std_common.i similarity index 100% copy from share/swig/2.0.11/php/std_common.i copy to share/swig/3.0.12/php5/std_common.i
diff --git a/share/swig/2.0.11/perl5/std_deque.i b/share/swig/3.0.12/php5/std_deque.i similarity index 100% copy from share/swig/2.0.11/perl5/std_deque.i copy to share/swig/3.0.12/php5/std_deque.i
diff --git a/share/swig/2.0.11/php/std_map.i b/share/swig/3.0.12/php5/std_map.i similarity index 100% copy from share/swig/2.0.11/php/std_map.i copy to share/swig/3.0.12/php5/std_map.i
diff --git a/share/swig/2.0.11/go/std_pair.i b/share/swig/3.0.12/php5/std_pair.i similarity index 100% copy from share/swig/2.0.11/go/std_pair.i copy to share/swig/3.0.12/php5/std_pair.i
diff --git a/share/swig/2.0.11/php/std_string.i b/share/swig/3.0.12/php5/std_string.i similarity index 90% rename from share/swig/2.0.11/php/std_string.i rename to share/swig/3.0.12/php5/std_string.i index 10d7fdd..aaa5dc9 100644 --- a/share/swig/2.0.11/php/std_string.i +++ b/share/swig/3.0.12/php5/std_string.i
@@ -33,8 +33,8 @@ %} %typemap(directorout) string %{ - convert_to_string_ex($input); - $result.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); + convert_to_string_ex(&$input); + $result.assign(Z_STRVAL_P($input), Z_STRLEN_P($input)); %} %typemap(out) string %{ @@ -63,8 +63,8 @@ %} %typemap(directorout) string & ($*1_ltype *temp) %{ - convert_to_string_ex($input); - temp = new $*1_ltype(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); + convert_to_string_ex(&$input); + temp = new $*1_ltype(Z_STRVAL_P($input), Z_STRLEN_P($input)); swig_acquire_ownership(temp); $result = temp; %}
diff --git a/share/swig/2.0.11/php/std_vector.i b/share/swig/3.0.12/php5/std_vector.i similarity index 97% copy from share/swig/2.0.11/php/std_vector.i copy to share/swig/3.0.12/php5/std_vector.i index 28c9921..9cc1486 100644 --- a/share/swig/2.0.11/php/std_vector.i +++ b/share/swig/3.0.12/php5/std_vector.i
@@ -77,7 +77,7 @@ self->pop_back(); return x; } - const_reference get(int i) throw (std::out_of_range) { + bool get(int i) throw (std::out_of_range) { int size = int(self->size()); if (i>=0 && i<size) return (*self)[i];
diff --git a/share/swig/2.0.11/csharp/stl.i b/share/swig/3.0.12/php5/stl.i similarity index 100% copy from share/swig/2.0.11/csharp/stl.i copy to share/swig/3.0.12/php5/stl.i
diff --git a/share/swig/2.0.11/php/typemaps.i b/share/swig/3.0.12/php5/typemaps.i similarity index 95% rename from share/swig/2.0.11/php/typemaps.i rename to share/swig/3.0.12/php5/typemaps.i index 9fd73fe..faae0a6 100644 --- a/share/swig/2.0.11/php/typemaps.i +++ b/share/swig/3.0.12/php5/typemaps.i
@@ -38,7 +38,7 @@ zval *o; MAKE_STD_ZVAL(o); ZVAL_BOOL(o,temp$argnum); - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ @@ -67,7 +67,7 @@ zval *o; MAKE_STD_ZVAL(o); ZVAL_DOUBLE(o,temp$argnum); - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in) TYPE *REFERENCE (TYPE dvalue), TYPE &REFERENCE (TYPE dvalue) %{ @@ -96,7 +96,7 @@ zval *o; MAKE_STD_ZVAL(o); ZVAL_LONG(o,temp$argnum); - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in) TYPE *REFERENCE (TYPE lvalue), TYPE &REFERENCE (TYPE lvalue) %{ @@ -137,7 +137,7 @@ sprintf(temp, "%lld", (long long)temp$argnum); ZVAL_STRING(o, temp, 1); } - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in) TYPE *REFERENCE (long long lvalue) %{ @@ -178,7 +178,7 @@ sprintf(temp, "%llu", (unsigned long long)temp$argnum); ZVAL_STRING(o, temp, 1); } - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in) TYPE *REFERENCE (unsigned long long lvalue) %{ @@ -271,17 +271,17 @@ %typemap(in) char INPUT[ANY] ( char temp[$1_dim0] ) %{ convert_to_string_ex($input); - strncpy(temp,Z_LVAL_PP($input),$1_dim0); + strncpy(temp,Z_STRVAL_PP($input),$1_dim0); $1 = temp; %} %typemap(in,numinputs=0) char OUTPUT[ANY] ( char temp[$1_dim0] ) "$1 = temp;"; -%typemap(argout) char OUTPUT[ANY] +%typemap(argout,fragment="t_output_helper") char OUTPUT[ANY] { zval *o; MAKE_STD_ZVAL(o); ZVAL_STRINGL(o,temp$argnum,$1_dim0); - t_output_helper( &$result, o ); + t_output_helper( &$result, o TSRMLS_CC ); } %typemap(in,numinputs=0) void **OUTPUT (int force), @@ -299,7 +299,7 @@ force=0; if (arg1==NULL) { #ifdef __cplusplus - ptr=new $*1_ltype; + ptr=new $*1_ltype(); #else ptr=($*1_ltype) calloc(1,sizeof($*1_ltype)); #endif
diff --git a/share/swig/2.0.11/php/utils.i b/share/swig/3.0.12/php5/utils.i similarity index 94% rename from share/swig/2.0.11/php/utils.i rename to share/swig/3.0.12/php5/utils.i index 07ac969..408a3b3 100644 --- a/share/swig/2.0.11/php/utils.i +++ b/share/swig/3.0.12/php5/utils.i
@@ -80,18 +80,19 @@ %} %typemap(directorout) TYPE %{ - CONVERT_IN($result,$1_ltype,$input); + CONVERT_IN($result,$1_ltype,&$input); %} %typemap(directorout) const TYPE & ($*1_ltype temp) %{ - CONVERT_IN(temp,$*1_ltype,$input); + CONVERT_IN(temp,$*1_ltype,&$input); $result = &temp; %} %enddef %fragment("t_output_helper","header") %{ static void -t_output_helper( zval **target, zval *o) { +t_output_helper(zval **target, zval *o TSRMLS_DC) { + zval *tmp; if ( (*target)->type == IS_ARRAY ) { /* it's already an array, just append */ add_next_index_zval( *target, o ); @@ -102,7 +103,6 @@ FREE_ZVAL(o); return; } - zval *tmp; ALLOC_INIT_ZVAL(tmp); *tmp = **target; zval_copy_ctor(tmp);
diff --git a/share/swig/2.0.11/pike/pike.swg b/share/swig/3.0.12/pike/pike.swg similarity index 94% rename from share/swig/2.0.11/pike/pike.swg rename to share/swig/3.0.12/pike/pike.swg index 399752a..95cc208 100644 --- a/share/swig/2.0.11/pike/pike.swg +++ b/share/swig/3.0.12/pike/pike.swg
@@ -53,6 +53,7 @@ %typemap(in) SWIGTYPE *, SWIGTYPE &, + SWIGTYPE &&, SWIGTYPE [] "SWIG_ConvertPtr($input.u.object, (void **) &$1, $1_descriptor, 1);" @@ -79,7 +80,8 @@ const bool & (bool temp), const long long & ($*1_ltype temp), const unsigned long long & ($*1_ltype temp), - const enum SWIGTYPE & ($*1_ltype temp) + const enum SWIGTYPE & ($*1_ltype temp), + const enum SWIGTYPE && ($*1_ltype temp) { if ($input.type != T_INT) Pike_error("Bad argument: Expected an integer.\n"); @@ -113,7 +115,7 @@ %typemap(out, pikedesc="tStr") char * "push_text($1);"; /* Pointers, references, and arrays */ -%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));"; +%typemap(out, pikedesc="tObj") SWIGTYPE*, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "push_object(SWIG_NewPointerObj((void *) $1, $1_descriptor, $owner));"; /* Void return value; don't push anything */ %typemap(out, pikedesc="tVoid") void ""; @@ -153,7 +155,8 @@ const char &, const signed char &, const unsigned char &, const bool &, const long long &, const unsigned long long &, - const enum SWIGTYPE & ($*1_ltype temp) + const enum SWIGTYPE & ($*1_ltype temp), + const enum SWIGTYPE && ($*1_ltype temp) "push_int(*($1));"; %typemap(out, pikedesc="tFloat") const float &, const double & "push_float(*($1));"; @@ -216,7 +219,7 @@ const int &, const short &, const long &, const unsigned int &, const unsigned short &, const unsigned long &, const long long &, const unsigned long long &, - enum SWIGTYPE, enum SWIGTYPE &, + enum SWIGTYPE, enum SWIGTYPE &, SWIGTYPE &&, bool, const bool & { $1 = ($input.type == T_INT) ? 1 : 0; @@ -237,7 +240,7 @@ $1 = ($input.type == T_STRING) ? 1 : 0; } -%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { void *ptr; if (SWIG_ConvertPtr($input.u.object, (void **) &ptr, $1_descriptor, 0) == -1) { $1 = 0; @@ -266,6 +269,7 @@ /* Array reference typemaps */ %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) } +%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) } /* const pointers */ %apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/share/swig/2.0.11/pike/pikekw.swg b/share/swig/3.0.12/pike/pikekw.swg similarity index 100% rename from share/swig/2.0.11/pike/pikekw.swg rename to share/swig/3.0.12/pike/pikekw.swg
diff --git a/share/swig/2.0.11/pike/pikerun.swg b/share/swig/3.0.12/pike/pikerun.swg similarity index 100% rename from share/swig/2.0.11/pike/pikerun.swg rename to share/swig/3.0.12/pike/pikerun.swg
diff --git a/share/swig/2.0.11/pike/std_string.i b/share/swig/3.0.12/pike/std_string.i similarity index 100% rename from share/swig/2.0.11/pike/std_string.i rename to share/swig/3.0.12/pike/std_string.i
diff --git a/share/swig/2.0.11/pointer.i b/share/swig/3.0.12/pointer.i similarity index 82% rename from share/swig/2.0.11/pointer.i rename to share/swig/3.0.12/pointer.i index 8015317..ea8e535 100644 --- a/share/swig/2.0.11/pointer.i +++ b/share/swig/3.0.12/pointer.i
@@ -4,7 +4,7 @@ %echo "pointer.i is deprecated. Use cpointer.i instead." -%echo "See http://www.swig.org/Doc1.3/Library.html" +%echo "See http://www.swig.org/Doc3.0/Library.html"
diff --git a/share/swig/2.0.11/python/argcargv.i b/share/swig/3.0.12/python/argcargv.i similarity index 100% rename from share/swig/2.0.11/python/argcargv.i rename to share/swig/3.0.12/python/argcargv.i
diff --git a/share/swig/2.0.11/python/attribute.i b/share/swig/3.0.12/python/attribute.i similarity index 100% rename from share/swig/2.0.11/python/attribute.i rename to share/swig/3.0.12/python/attribute.i
diff --git a/share/swig/2.0.11/python/boost_shared_ptr.i b/share/swig/3.0.12/python/boost_shared_ptr.i similarity index 98% rename from share/swig/2.0.11/python/boost_shared_ptr.i rename to share/swig/3.0.12/python/boost_shared_ptr.i index 100ed3e..40a1ae1 100644 --- a/share/swig/2.0.11/python/boost_shared_ptr.i +++ b/share/swig/3.0.12/python/boost_shared_ptr.i
@@ -51,7 +51,7 @@ %variable_fail(res, "$type", "$name"); } if (!argp) { - %argument_nullref("$type", $symname, $argnum); + %variable_nullref("$type", "$name"); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); @@ -137,7 +137,9 @@ %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; - if (!argp) { %argument_nullref("$type", $symname, $argnum); } + if (!argp) { + %variable_nullref("$type", "$name"); + } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
diff --git a/share/swig/3.0.12/python/builtin.swg b/share/swig/3.0.12/python/builtin.swg new file mode 100644 index 0000000..4fd1947 --- /dev/null +++ b/share/swig/3.0.12/python/builtin.swg
@@ -0,0 +1,727 @@ +#ifdef __cplusplus +extern "C" { +#endif + +SWIGINTERN Py_hash_t +SwigPyObject_hash(PyObject *obj) { + SwigPyObject *sobj = (SwigPyObject *)obj; + void *ptr = sobj->ptr; + return (Py_hash_t)ptr; +} + +SWIGINTERN Py_hash_t +SWIG_PyNumber_AsPyHash(PyObject *obj) { + Py_hash_t result = -1; +#if PY_VERSION_HEX < 0x03020000 +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(obj)) + result = PyInt_AsLong(obj); + else +#endif + if (PyLong_Check(obj)) + result = PyLong_AsLong(obj); +#else + if (PyNumber_Check(obj)) + result = PyNumber_AsSsize_t(obj, NULL); +#endif + else + PyErr_Format(PyExc_TypeError, "Wrong type for hash function"); + return PyErr_Occurred() ? -1 : result; +} + +SWIGINTERN int +SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) { + PyErr_Format(PyExc_TypeError, "Cannot create new instances of type '%.300s'", self->ob_type->tp_name); + return -1; +} + +SWIGINTERN void +SwigPyBuiltin_BadDealloc(PyObject *obj) { + SwigPyObject *sobj = (SwigPyObject *)obj; + if (sobj->own) { + PyErr_Format(PyExc_TypeError, "Swig detected a memory leak in type '%.300s': no callable destructor found.", obj->ob_type->tp_name); + } +} + +typedef struct { + PyCFunction get; + PyCFunction set; +} SwigPyGetSet; + +SWIGINTERN PyObject * +SwigPyBuiltin_GetterClosure (PyObject *obj, void *closure) { + SwigPyGetSet *getset; + PyObject *tuple, *result; + if (!closure) + return SWIG_Py_Void(); + getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + tuple = PyTuple_New(0); + assert(tuple); + result = (*getset->get)(obj, tuple); + Py_DECREF(tuple); + return result; +} + +SWIGINTERN PyObject * +SwigPyBuiltin_FunpackGetterClosure (PyObject *obj, void *closure) { + SwigPyGetSet *getset; + PyObject *result; + if (!closure) + return SWIG_Py_Void(); + getset = (SwigPyGetSet *)closure; + if (!getset->get) + return SWIG_Py_Void(); + result = (*getset->get)(obj, NULL); + return result; +} + +SWIGINTERN int +SwigPyBuiltin_SetterClosure (PyObject *obj, PyObject *val, void *closure) { + SwigPyGetSet *getset; + PyObject *tuple, *result; + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, val); + Py_XINCREF(val); + result = (*getset->set)(obj, tuple); + Py_DECREF(tuple); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN int +SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure) { + SwigPyGetSet *getset; + PyObject *result; + if (!closure) { + PyErr_Format(PyExc_TypeError, "Missing getset closure"); + return -1; + } + getset = (SwigPyGetSet *)closure; + if (!getset->set) { + PyErr_Format(PyExc_TypeError, "Illegal member variable assignment in type '%.300s'", obj->ob_type->tp_name); + return -1; + } + result = (*getset->set)(obj, val); + Py_XDECREF(result); + return result ? 0 : -1; +} + +SWIGINTERN void +SwigPyStaticVar_dealloc(PyDescrObject *descr) { + _PyObject_GC_UNTRACK(descr); + Py_XDECREF(PyDescr_TYPE(descr)); + Py_XDECREF(PyDescr_NAME(descr)); + PyObject_GC_Del(descr); +} + +SWIGINTERN PyObject * +SwigPyStaticVar_repr(PyGetSetDescrObject *descr) { +#if PY_VERSION_HEX >= 0x03000000 + + return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif +} + +SWIGINTERN int +SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) { + PyDescrObject *descr; + descr = (PyDescrObject *)self; + Py_VISIT((PyObject*) PyDescr_TYPE(descr)); + return 0; +} + +SWIGINTERN PyObject * +SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNUSEDPARM(type)) { + if (descr->d_getset->get != NULL) + return descr->d_getset->get(obj, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif + return NULL; +} + +SWIGINTERN int +SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) { + if (descr->d_getset->set != NULL) + return descr->d_getset->set(obj, value, descr->d_getset->closure); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name); +#else + PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name); +#endif + return -1; +} + +SWIGINTERN int +SwigPyObjectType_setattro(PyObject *typeobject, PyObject *name, PyObject *value) { + PyObject *attribute; + PyTypeObject *type; + descrsetfunc local_set; + + assert(PyType_Check(typeobject)); + type = (PyTypeObject *)typeobject; + attribute = _PyType_Lookup(type, name); + if (attribute != NULL) { + /* Implement descriptor functionality, if any */ + local_set = attribute->ob_type->tp_descr_set; + if (local_set != NULL) + return local_set(attribute, (PyObject *)type, value); +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400S'", type->tp_name, name); +#else + PyErr_Format(PyExc_AttributeError, "cannot modify read-only attribute '%.50s.%.400s'", type->tp_name, PyString_AS_STRING(name)); +#endif + } else { +#if PY_VERSION_HEX >= 0x03000000 + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400S'", type->tp_name, name); +#else + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", type->tp_name, PyString_AS_STRING(name)); +#endif + } + + return -1; +} + +SWIGINTERN PyTypeObject* +SwigPyStaticVar_Type(void) { + static PyTypeObject staticvar_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ +#endif + "swig_static_var_getset_descriptor", /* tp_name */ + sizeof(PyGetSetDescrObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)SwigPyStaticVar_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ + 0, /* tp_doc */ + SwigPyStaticVar_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + (descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */ + (descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + staticvar_type = tmp; + type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + staticvar_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&staticvar_type) < 0) + return NULL; +#endif + } + return &staticvar_type; +} + +SWIGINTERN PyTypeObject* +SwigPyObjectType(void) { + static char swigpyobjecttype_doc[] = "Metaclass for SWIG wrapped types"; + static PyTypeObject swigpyobjecttype_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp = { +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ +#endif + "SwigPyObjectType", /* tp_name */ + PyType_Type.tp_basicsize, /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + SwigPyObjectType_setattro, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */ + swigpyobjecttype_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#if PY_VERSION_HEX >= 0x02060000 + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ +#endif +#ifdef COUNT_ALLOCS + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ +#endif + }; + swigpyobjecttype_type = tmp; + type_init = 1; + swigpyobjecttype_type.tp_base = &PyType_Type; +#if PY_VERSION_HEX < 0x02020000 + swigpyobjecttype_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobjecttype_type) < 0) + return NULL; +#endif + } + return &swigpyobjecttype_type; +} + +SWIGINTERN PyGetSetDescrObject * +SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) { + + PyGetSetDescrObject *descr; + descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0); + assert(descr); + Py_XINCREF(type); + PyDescr_TYPE(descr) = type; + PyDescr_NAME(descr) = PyString_InternFromString(getset->name); + descr->d_getset = getset; + if (PyDescr_NAME(descr) == NULL) { + Py_DECREF(descr); + descr = NULL; + } + return descr; +} + +SWIGINTERN void +SwigPyBuiltin_InitBases (PyTypeObject *type, PyTypeObject **bases) { + int base_count = 0; + PyTypeObject **b; + PyObject *tuple; + int i; + + if (!bases[0]) { + bases[0] = SwigPyObject_type(); + bases[1] = NULL; + } + type->tp_base = bases[0]; + Py_INCREF((PyObject *)bases[0]); + for (b = bases; *b != NULL; ++b) + ++base_count; + tuple = PyTuple_New(base_count); + for (i = 0; i < base_count; ++i) { + PyTuple_SET_ITEM(tuple, i, (PyObject *)bases[i]); + Py_INCREF((PyObject *)bases[i]); + } + type->tp_bases = tuple; +} + +SWIGINTERN PyObject * +SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { + PyObject *result; + result = (PyObject *)SWIG_Python_GetSwigThis(self); + Py_XINCREF(result); + return result; +} + +SWIGINTERN void +SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) +{ +#if PY_VERSION_HEX >= 0x03000000 + type->ob_base.ob_base.ob_type = metatype; +#else + type->ob_type = metatype; +#endif +} + + +/* Start of callback function macros for use in PyTypeObject */ + +typedef PyObject *(*SwigPyWrapperFunction)(PyObject *, PyObject *); + +#define SWIGPY_UNARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_unaryfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_unaryfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_unaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_DESTRUCTOR_CLOSURE(wrapper) \ +SWIGINTERN void \ +wrapper##_destructor_closure(PyObject *a) { \ + SwigPyBuiltin_destructor_closure(wrapper, #wrapper, a); \ +} +SWIGINTERN void +SwigPyBuiltin_destructor_closure(SwigPyWrapperFunction wrapper, const char *wrappername, PyObject *a) { + SwigPyObject *sobj; + sobj = (SwigPyObject *)a; + Py_XDECREF(sobj->dict); + if (sobj->own) { + PyObject *o; + PyObject *val = 0, *type = 0, *tb = 0; + PyErr_Fetch(&val, &type, &tb); + o = wrapper(a, NULL); + if (!o) { + PyObject *deallocname = PyString_FromString(wrappername); + PyErr_WriteUnraisable(deallocname); + Py_DECREF(deallocname); + } + PyErr_Restore(val, type, tb); + Py_XDECREF(o); + } + if (PyType_IS_GC(a->ob_type)) { + PyObject_GC_Del(a); + } else { + PyObject_Del(a); + } +} + +#define SWIGPY_INQUIRY_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_inquiry_closure(PyObject *a) { \ + return SwigPyBuiltin_inquiry_closure(wrapper, a); \ +} +SWIGINTERN int +SwigPyBuiltin_inquiry_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *pyresult; + int result; + pyresult = wrapper(a, NULL); + result = pyresult && PyObject_IsTrue(pyresult) ? 1 : 0; + Py_XDECREF(pyresult); + return result; +} + +#define SWIGPY_GETITERFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_getiterfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_getiterfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_getiterfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_BINARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_binaryfunc_closure(PyObject *a, PyObject *b) { \ + return SwigPyBuiltin_binaryfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_binaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b) { + PyObject *tuple, *result; + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + Py_XINCREF(b); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +typedef ternaryfunc ternarycallfunc; + +#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ternaryfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_ternaryfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ternaryfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + PyObject *tuple, *result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(b); + Py_XINCREF(c); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ternarycallfunc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_ternarycallfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ternarycallfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + (void) c; + return wrapper(a, b); +} + +#define SWIGPY_LENFUNC_CLOSURE(wrapper) \ +SWIGINTERN Py_ssize_t \ +wrapper##_lenfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_lenfunc_closure(wrapper, a); \ +} +SWIGINTERN Py_ssize_t +SwigPyBuiltin_lenfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *resultobj; + Py_ssize_t result; + resultobj = wrapper(a, NULL); + result = PyNumber_AsSsize_t(resultobj, NULL); + Py_DECREF(resultobj); + return result; +} + +#define SWIGPY_SSIZESSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizessizeargfunc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c) { \ + return SwigPyBuiltin_ssizessizeargfunc_closure(wrapper, a, b, c); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ssizessizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c) { + PyObject *tuple, *result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_SSIZESSIZEOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_ssizessizeobjargproc_closure(PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { \ + return SwigPyBuiltin_ssizessizeobjargproc_closure(wrapper, a, b, c, d); \ +} +SWIGINTERN int +SwigPyBuiltin_ssizessizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, Py_ssize_t c, PyObject *d) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(d ? 3 : 2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, _PyLong_FromSsize_t(c)); + if (d) { + PyTuple_SET_ITEM(tuple, 2, d); + Py_INCREF(d); + } + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_DECREF(tuple); + Py_XDECREF(resultobj); + return result; +} + +#define SWIGPY_SSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \ + return SwigPyBuiltin_funpack_ssizeargfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_funpack_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) { + PyObject *tuple, *result; + tuple = PyTuple_New(1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + result = wrapper(a, tuple); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_FUNPACK_SSIZEARGFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_ssizeargfunc_closure(PyObject *a, Py_ssize_t b) { \ + return SwigPyBuiltin_ssizeargfunc_closure(wrapper, a, b); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_ssizeargfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b) { + PyObject *arg, *result; + arg = _PyLong_FromSsize_t(b); + result = wrapper(a, arg); + Py_DECREF(arg); + return result; +} + +#define SWIGPY_SSIZEOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_ssizeobjargproc_closure(PyObject *a, Py_ssize_t b, PyObject *c) { \ + return SwigPyBuiltin_ssizeobjargproc_closure(wrapper, a, b, c); \ +} +SWIGINTERN int +SwigPyBuiltin_ssizeobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, Py_ssize_t b, PyObject *c) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(2); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, _PyLong_FromSsize_t(b)); + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(c); + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_XDECREF(resultobj); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_OBJOBJARGPROC_CLOSURE(wrapper) \ +SWIGINTERN int \ +wrapper##_objobjargproc_closure(PyObject *a, PyObject *b, PyObject *c) { \ + return SwigPyBuiltin_objobjargproc_closure(wrapper, a, b, c); \ +} +SWIGINTERN int +SwigPyBuiltin_objobjargproc_closure(SwigPyWrapperFunction wrapper, PyObject *a, PyObject *b, PyObject *c) { + PyObject *tuple, *resultobj; + int result; + tuple = PyTuple_New(c ? 2 : 1); + assert(tuple); + PyTuple_SET_ITEM(tuple, 0, b); + Py_XINCREF(b); + if (c) { + PyTuple_SET_ITEM(tuple, 1, c); + Py_XINCREF(c); + } + resultobj = wrapper(a, tuple); + result = resultobj ? 0 : -1; + Py_XDECREF(resultobj); + Py_DECREF(tuple); + return result; +} + +#define SWIGPY_REPRFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_reprfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_reprfunc_closure(wrapper, a); \ +} +SWIGINTERN PyObject * +SwigPyBuiltin_reprfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +#define SWIGPY_HASHFUNC_CLOSURE(wrapper) \ +SWIGINTERN Py_hash_t \ +wrapper##_hashfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_hashfunc_closure(wrapper, a); \ +} +SWIGINTERN Py_hash_t +SwigPyBuiltin_hashfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + PyObject *pyresult; + Py_hash_t result; + pyresult = wrapper(a, NULL); + if (!pyresult) + return -1; + result = SWIG_PyNumber_AsPyHash(pyresult); + Py_DECREF(pyresult); + return result; +} + +#define SWIGPY_ITERNEXTFUNC_CLOSURE(wrapper) \ +SWIGINTERN PyObject * \ +wrapper##_iternextfunc_closure(PyObject *a) { \ + return SwigPyBuiltin_iternextfunc_closure(wrapper, a);\ +} +SWIGINTERN PyObject * +SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) { + return wrapper(a, NULL); +} + +/* End of callback function macros for use in PyTypeObject */ + +#ifdef __cplusplus +} +#endif +
diff --git a/share/swig/3.0.12/python/carrays.i b/share/swig/3.0.12/python/carrays.i new file mode 100644 index 0000000..74b2be9 --- /dev/null +++ b/share/swig/3.0.12/python/carrays.i
@@ -0,0 +1,13 @@ +%define %array_class(TYPE,NAME) +#if defined(SWIGPYTHON_BUILTIN) + %feature("python:slot", "sq_item", functype="ssizeargfunc") NAME::__getitem__; + %feature("python:slot", "sq_ass_item", functype="ssizeobjargproc") NAME::__setitem__; +#endif +%array_class_wrap(TYPE,NAME,__getitem__,__setitem__) +%enddef + +%include <typemaps/carrays.swg> + + + +
diff --git a/share/swig/2.0.11/python/ccomplex.i b/share/swig/3.0.12/python/ccomplex.i similarity index 100% rename from share/swig/2.0.11/python/ccomplex.i rename to share/swig/3.0.12/python/ccomplex.i
diff --git a/share/swig/2.0.11/python/cdata.i b/share/swig/3.0.12/python/cdata.i similarity index 100% rename from share/swig/2.0.11/python/cdata.i rename to share/swig/3.0.12/python/cdata.i
diff --git a/share/swig/2.0.11/python/cmalloc.i b/share/swig/3.0.12/python/cmalloc.i similarity index 100% rename from share/swig/2.0.11/python/cmalloc.i rename to share/swig/3.0.12/python/cmalloc.i
diff --git a/share/swig/2.0.11/python/cni.i b/share/swig/3.0.12/python/cni.i similarity index 100% rename from share/swig/2.0.11/python/cni.i rename to share/swig/3.0.12/python/cni.i
diff --git a/share/swig/2.0.11/python/complex.i b/share/swig/3.0.12/python/complex.i similarity index 100% rename from share/swig/2.0.11/python/complex.i rename to share/swig/3.0.12/python/complex.i
diff --git a/share/swig/2.0.11/python/cpointer.i b/share/swig/3.0.12/python/cpointer.i similarity index 100% rename from share/swig/2.0.11/python/cpointer.i rename to share/swig/3.0.12/python/cpointer.i
diff --git a/share/swig/2.0.11/python/cstring.i b/share/swig/3.0.12/python/cstring.i similarity index 100% rename from share/swig/2.0.11/python/cstring.i rename to share/swig/3.0.12/python/cstring.i
diff --git a/share/swig/2.0.11/python/cwstring.i b/share/swig/3.0.12/python/cwstring.i similarity index 100% rename from share/swig/2.0.11/python/cwstring.i rename to share/swig/3.0.12/python/cwstring.i
diff --git a/share/swig/2.0.11/python/defarg.swg b/share/swig/3.0.12/python/defarg.swg similarity index 100% rename from share/swig/2.0.11/python/defarg.swg rename to share/swig/3.0.12/python/defarg.swg
diff --git a/share/swig/2.0.11/python/director.swg b/share/swig/3.0.12/python/director.swg similarity index 62% rename from share/swig/2.0.11/python/director.swg rename to share/swig/3.0.12/python/director.swg index 97edc7e..4bdc94d 100644 --- a/share/swig/2.0.11/python/director.swg +++ b/share/swig/3.0.12/python/director.swg
@@ -1,15 +1,13 @@ /* ----------------------------------------------------------------------------- * director.swg * - * This file contains support for director classes that proxy - * method calls from C++ to Python extensions. + * This file contains support for director classes so that Python proxy + * methods can be called from C++. * ----------------------------------------------------------------------------- */ #ifndef SWIG_DIRECTOR_PYTHON_HEADER_ #define SWIG_DIRECTOR_PYTHON_HEADER_ -#ifdef __cplusplus - #include <string> #include <iostream> #include <exception> @@ -43,33 +41,22 @@ /* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif - - -/* Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the native C++ RTTI and dynamic_cast<>. But be aware that directors could stop working when using this option. */ #ifdef SWIG_DIRECTOR_NORTTI -/* +/* When we don't use the native C++ RTTI, we implement a minimal one only for Directors. */ # ifndef SWIG_DIRECTOR_RTDIR # define SWIG_DIRECTOR_RTDIR -#include <map> namespace Swig { class Director; - SWIGINTERN std::map<void*,Director*>& get_rtdir_map() { - static std::map<void*,Director*> rtdir_map; + SWIGINTERN std::map<void *, Director *>& get_rtdir_map() { + static std::map<void *, Director *> rtdir_map; return rtdir_map; } @@ -78,15 +65,15 @@ } SWIGINTERNINLINE Director *get_rtdir(void *vptr) { - std::map<void*,Director*>::const_iterator pos = get_rtdir_map().find(vptr); + std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr); Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0; return rtdir; } } # endif /* SWIG_DIRECTOR_RTDIR */ -# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void*>(ARG)) -# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void*>(ARG1), ARG2) +# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG)) +# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2) #else @@ -99,154 +86,139 @@ struct swig_type_info; } -namespace Swig { +namespace Swig { /* memory handler */ - struct GCItem - { + struct GCItem { virtual ~GCItem() {} - virtual int get_own() const - { + virtual int get_own() const { return 0; } }; - struct GCItem_var - { - GCItem_var(GCItem *item = 0) : _item(item) - { + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { } - GCItem_var& operator=(GCItem *item) - { + GCItem_var& operator=(GCItem *item) { GCItem *tmp = _item; _item = item; delete tmp; return *this; } - ~GCItem_var() - { + ~GCItem_var() { delete _item; } - - GCItem * operator->() const - { + + GCItem * operator->() const { return _item; } - + private: GCItem *_item; }; - - struct GCItem_Object : GCItem - { - GCItem_Object(int own) : _own(own) - { - } - - virtual ~GCItem_Object() - { + + struct GCItem_Object : GCItem { + GCItem_Object(int own) : _own(own) { } - int get_own() const - { + virtual ~GCItem_Object() { + } + + int get_own() const { return _own; } - + private: int _own; }; template <typename Type> - struct GCItem_T : GCItem - { - GCItem_T(Type *ptr) : _ptr(ptr) - { + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { } - - virtual ~GCItem_T() - { + + virtual ~GCItem_T() { delete _ptr; } - + private: Type *_ptr; }; template <typename Type> - struct GCArray_T : GCItem - { - GCArray_T(Type *ptr) : _ptr(ptr) - { + struct GCArray_T : GCItem { + GCArray_T(Type *ptr) : _ptr(ptr) { } - - virtual ~GCArray_T() - { + + virtual ~GCArray_T() { delete[] _ptr; } - + private: Type *_ptr; }; /* base class for director exceptions */ - class DirectorException { + class DirectorException : public std::exception { protected: std::string swig_msg; public: - DirectorException(PyObject *error, const char* hdr ="", const char* msg ="") - : swig_msg(hdr) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (strlen(msg)) { + DirectorException(PyObject *error, const char *hdr ="", const char *msg ="") : swig_msg(hdr) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + if (msg[0]) { swig_msg += " "; swig_msg += msg; } if (!PyErr_Occurred()) { - PyErr_SetString(error, getMessage()); + PyErr_SetString(error, what()); } - SWIG_PYTHON_THREAD_END_BLOCK; + SWIG_PYTHON_THREAD_END_BLOCK; } - const char *getMessage() const - { - return swig_msg.c_str(); + virtual ~DirectorException() throw() { } - static void raise(PyObject *error, const char *msg) - { + /* Deprecated, use what() instead */ + const char *getMessage() const { + return what(); + } + + const char *what() const throw() { + return swig_msg.c_str(); + } + + static void raise(PyObject *error, const char *msg) { throw DirectorException(error, msg); } - static void raise(const char *msg) - { + static void raise(const char *msg) { raise(PyExc_RuntimeError, msg); } }; /* unknown exception handler */ - class UnknownExceptionHandler - { + class UnknownExceptionHandler { #ifdef SWIG_DIRECTOR_UEH - static void handler() { + static void handler() { try { throw; } catch (DirectorException& e) { std::cerr << "SWIG Director exception caught:" << std::endl - << e.getMessage() << std::endl; + << e.what() << std::endl; } catch (std::exception& e) { std::cerr << "std::exception caught: "<< e.what() << std::endl; } catch (...) { std::cerr << "Unknown exception caught." << std::endl; } - + std::cerr << std::endl << "Python interpreter traceback:" << std::endl; PyErr_Print(); std::cerr << std::endl; - + std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl << std::endl @@ -255,69 +227,58 @@ } public: - + std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) - { + UnknownExceptionHandler(std::unexpected_handler nh = handler) { old = std::set_unexpected(nh); } - ~UnknownExceptionHandler() - { + ~UnknownExceptionHandler() { std::set_unexpected(old); } #endif }; /* type mismatch in the return value from a python method call */ - class DirectorTypeMismatchException : public Swig::DirectorException { + class DirectorTypeMismatchException : public DirectorException { public: - DirectorTypeMismatchException(PyObject *error, const char* msg="") - : Swig::DirectorException(error, "SWIG director type mismatch", msg) - { + DirectorTypeMismatchException(PyObject *error, const char *msg="") + : DirectorException(error, "SWIG director type mismatch", msg) { } - DirectorTypeMismatchException(const char* msg="") - : Swig::DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg) - { + DirectorTypeMismatchException(const char *msg="") + : DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg) { } - static void raise(PyObject *error, const char *msg) - { + static void raise(PyObject *error, const char *msg) { throw DirectorTypeMismatchException(error, msg); } - static void raise(const char *msg) - { + static void raise(const char *msg) { throw DirectorTypeMismatchException(msg); } }; /* any python exception that occurs during a director method call */ - class DirectorMethodException : public Swig::DirectorException { + class DirectorMethodException : public DirectorException { public: - DirectorMethodException(const char* msg = "") - : DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg) - { - } + DirectorMethodException(const char *msg = "") + : DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg) { + } - static void raise(const char *msg) - { + static void raise(const char *msg) { throw DirectorMethodException(msg); } }; /* attempt to call a pure virtual method via a director method */ - class DirectorPureVirtualException : public Swig::DirectorException - { + class DirectorPureVirtualException : public DirectorException { public: - DirectorPureVirtualException(const char* msg = "") - : DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg) - { + DirectorPureVirtualException(const char *msg = "") + : DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg) { } - static void raise(const char *msg) - { + static void raise(const char *msg) { throw DirectorPureVirtualException(msg); } }; @@ -332,88 +293,81 @@ #ifdef __THREAD__ # include "pythread.h" - class Guard - { - PyThread_type_lock & mutex_; - + class Guard { + PyThread_type_lock &mutex_; + public: - Guard(PyThread_type_lock & mutex) : mutex_(mutex) - { + Guard(PyThread_type_lock & mutex) : mutex_(mutex) { PyThread_acquire_lock(mutex_, WAIT_LOCK); } - - ~Guard() - { + + ~Guard() { PyThread_release_lock(mutex_); } }; # define SWIG_GUARD(mutex) Guard _guard(mutex) #else -# define SWIG_GUARD(mutex) +# define SWIG_GUARD(mutex) #endif /* director base class */ class Director { private: /* pointer to the wrapped python object */ - PyObject* swig_self; + PyObject *swig_self; /* flag indicating whether the object is owned by python or c++ */ mutable bool swig_disown_flag; /* decrement the reference count of the wrapped python object */ - void swig_decref() const { + void swig_decref() const { if (swig_disown_flag) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_DECREF(swig_self); - SWIG_PYTHON_THREAD_END_BLOCK; + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + Py_DECREF(swig_self); + SWIG_PYTHON_THREAD_END_BLOCK; } } public: - /* wrap a python object, optionally taking ownership */ - Director(PyObject* self) : swig_self(self), swig_disown_flag(false) { - swig_incref(); + /* wrap a python object. */ + Director(PyObject *self) : swig_self(self), swig_disown_flag(false) { } - /* discard our reference at destruction */ virtual ~Director() { - swig_decref(); + swig_decref(); } - /* return a pointer to the wrapped python object */ - PyObject *swig_get_self() const { - return swig_self; + PyObject *swig_get_self() const { + return swig_self; } - /* acquire ownership of the wrapped python object (the sense of "disown" - * is from python) */ - void swig_disown() const { - if (!swig_disown_flag) { + /* acquire ownership of the wrapped python object (the sense of "disown" is from python) */ + void swig_disown() const { + if (!swig_disown_flag) { swig_disown_flag=true; - swig_incref(); - } + swig_incref(); + } } /* increase the reference count of the wrapped python object */ - void swig_incref() const { + void swig_incref() const { if (swig_disown_flag) { - Py_INCREF(swig_self); + Py_INCREF(swig_self); } } /* methods to implement pseudo protected director members */ - virtual bool swig_get_inner(const char* /* swig_protected_method_name */) const { + virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const { return true; } - - virtual void swig_set_inner(const char* /* swig_protected_method_name */, bool /* swig_val */) const { + + virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const { } /* ownership management */ private: - typedef std::map<void*, GCItem_var> swig_ownership_map; + typedef std::map<void *, GCItem_var> swig_ownership_map; mutable swig_ownership_map swig_owner; #ifdef __THREAD__ static PyThread_type_lock swig_mutex_own; @@ -421,33 +375,29 @@ public: template <typename Type> - void swig_acquire_ownership_array(Type *vptr) const - { + void swig_acquire_ownership_array(Type *vptr) const { if (vptr) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCArray_T<Type>(vptr); } } - + template <typename Type> - void swig_acquire_ownership(Type *vptr) const - { + void swig_acquire_ownership(Type *vptr) const { if (vptr) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCItem_T<Type>(vptr); } } - void swig_acquire_ownership_obj(void *vptr, int own) const - { + void swig_acquire_ownership_obj(void *vptr, int own) const { if (vptr && own) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCItem_Object(own); } } - - int swig_release_ownership(void *vptr) const - { + + int swig_release_ownership(void *vptr) const { int own = 0; if (vptr) { SWIG_GUARD(swig_mutex_own); @@ -461,8 +411,7 @@ } template <typename Type> - static PyObject* swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) - { + static PyObject *swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) { SwigPyObject *sobj = (SwigPyObject *)pyobj; sobj->own = 0; Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<Type *>(sobj->ptr)); @@ -470,7 +419,6 @@ d->swig_disown(); return PyWeakref_NewProxy(pyobj, NULL); } - }; #ifdef __THREAD__ @@ -478,7 +426,4 @@ #endif } -#endif /* __cplusplus */ - - #endif
diff --git a/share/swig/2.0.11/python/embed.i b/share/swig/3.0.12/python/embed.i similarity index 80% rename from share/swig/2.0.11/python/embed.i rename to share/swig/3.0.12/python/embed.i index c29e8fd..efd0487 100644 --- a/share/swig/2.0.11/python/embed.i +++ b/share/swig/3.0.12/python/embed.i
@@ -1,8 +1,8 @@ // // embed.i // SWIG file embedding the Python interpreter in something else. -// This file is based on Python-1.5. It will not work with -// earlier versions. +// This file is deprecated and no longer actively maintained, but it still +// seems to work with Python 2.7. Status with Python 3 is unknown. // // This file makes it possible to extend Python and all of its // built-in functions without having to hack its setup script. @@ -24,13 +24,8 @@ purpose modules you have enabled such as Tkinter). Thus, you may need to provide additional link libraries when compiling. -This library file only works with Python 1.5. A version -compatible with Python 1.4 is available as embed14.i and -a Python1.3 version is available as embed13.i. As far as -I know, this module is C++ safe. +As far as I know, this module is C++ safe. %} -#else -%echo "embed.i : Using Python 1.5" #endif %wrapper %{ @@ -51,12 +46,12 @@ #endif #include <config.c> -#undef _PyImport_Inittab +#undef _PyImport_Inittab /* Now define our own version of it. Hopefully someone does not have more than 1000 built-in modules */ -struct _inittab SWIG_Import_Inittab[1000]; +struct _inittab SWIG_Import_Inittab[1000]; static int swig_num_modules = 0; @@ -68,18 +63,18 @@ swig_num_modules++; SWIG_Import_Inittab[swig_num_modules].name = (char *) 0; SWIG_Import_Inittab[swig_num_modules].initfunc = 0; -} +} -/* Function to add all of Python's build in modules to our interpreter */ +/* Function to add all of Python's built-in modules to our interpreter */ static void swig_add_builtin() { int i = 0; while (swig_inittab[i].name) { swig_add_module(swig_inittab[i].name, swig_inittab[i].initfunc); - i++; - } + i++; + } #ifdef SWIGMODINIT - SWIGMODINIT + SWIGMODINIT #endif /* Add SWIG builtin function */ swig_add_module(SWIG_name, SWIG_init); @@ -109,7 +104,3 @@ } %} - - - -
diff --git a/share/swig/2.0.11/python/exception.i b/share/swig/3.0.12/python/exception.i similarity index 100% rename from share/swig/2.0.11/python/exception.i rename to share/swig/3.0.12/python/exception.i
diff --git a/share/swig/2.0.11/python/factory.i b/share/swig/3.0.12/python/factory.i similarity index 100% rename from share/swig/2.0.11/python/factory.i rename to share/swig/3.0.12/python/factory.i
diff --git a/share/swig/2.0.11/python/file.i b/share/swig/3.0.12/python/file.i similarity index 100% rename from share/swig/2.0.11/python/file.i rename to share/swig/3.0.12/python/file.i
diff --git a/share/swig/2.0.11/python/implicit.i b/share/swig/3.0.12/python/implicit.i similarity index 100% rename from share/swig/2.0.11/python/implicit.i rename to share/swig/3.0.12/python/implicit.i
diff --git a/share/swig/2.0.11/python/jstring.i b/share/swig/3.0.12/python/jstring.i similarity index 100% rename from share/swig/2.0.11/python/jstring.i rename to share/swig/3.0.12/python/jstring.i
diff --git a/share/swig/2.0.11/python/pyabc.i b/share/swig/3.0.12/python/pyabc.i similarity index 91% rename from share/swig/2.0.11/python/pyabc.i rename to share/swig/3.0.12/python/pyabc.i index 3da06b5..12ce659 100644 --- a/share/swig/2.0.11/python/pyabc.i +++ b/share/swig/3.0.12/python/pyabc.i
@@ -1,7 +1,7 @@ %define %pythonabc(Type, Abc) %feature("python:abc", #Abc) Type; %enddef -%pythoncode {import collections}; +%pythoncode %{import collections%} %pythonabc(std::vector, collections.MutableSequence); %pythonabc(std::list, collections.MutableSequence); %pythonabc(std::map, collections.MutableMapping);
diff --git a/share/swig/2.0.11/python/pyapi.swg b/share/swig/3.0.12/python/pyapi.swg similarity index 100% rename from share/swig/2.0.11/python/pyapi.swg rename to share/swig/3.0.12/python/pyapi.swg
diff --git a/share/swig/2.0.11/python/pybackward.swg b/share/swig/3.0.12/python/pybackward.swg similarity index 100% rename from share/swig/2.0.11/python/pybackward.swg rename to share/swig/3.0.12/python/pybackward.swg
diff --git a/share/swig/2.0.11/python/pybuffer.i b/share/swig/3.0.12/python/pybuffer.i similarity index 100% rename from share/swig/2.0.11/python/pybuffer.i rename to share/swig/3.0.12/python/pybuffer.i
diff --git a/share/swig/2.0.11/python/pyclasses.swg b/share/swig/3.0.12/python/pyclasses.swg similarity index 91% rename from share/swig/2.0.11/python/pyclasses.swg rename to share/swig/3.0.12/python/pyclasses.swg index b73ebdb..9d6299f 100644 --- a/share/swig/2.0.11/python/pyclasses.swg +++ b/share/swig/3.0.12/python/pyclasses.swg
@@ -72,27 +72,35 @@ SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; } SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) { if (initial_ref) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; Py_XINCREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; } } SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; Py_XINCREF(item._obj); Py_XDECREF(_obj); _obj = item._obj; + SWIG_PYTHON_THREAD_END_BLOCK; return *this; } ~SwigPtr_PyObject() { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; Py_XDECREF(_obj); + SWIG_PYTHON_THREAD_END_BLOCK; } operator PyObject *() const
diff --git a/share/swig/2.0.11/python/pycomplex.swg b/share/swig/3.0.12/python/pycomplex.swg similarity index 96% rename from share/swig/2.0.11/python/pycomplex.swg rename to share/swig/3.0.12/python/pycomplex.swg index 74be5b9..087c50f 100644 --- a/share/swig/2.0.11/python/pycomplex.swg +++ b/share/swig/3.0.12/python/pycomplex.swg
@@ -4,7 +4,7 @@ the complex Constructor method, and the Real and Imag complex accessor methods. - See the std_complex.i and ccomplex.i for concret examples. + See the std_complex.i and ccomplex.i for concrete examples. */ /* the common from converter */
diff --git a/share/swig/2.0.11/python/pycontainer.swg b/share/swig/3.0.12/python/pycontainer.swg similarity index 84% rename from share/swig/2.0.11/python/pycontainer.swg rename to share/swig/3.0.12/python/pycontainer.swg index d438662..d40b0ba 100644 --- a/share/swig/2.0.11/python/pycontainer.swg +++ b/share/swig/3.0.12/python/pycontainer.swg
@@ -32,9 +32,7 @@ /**** The PySequence C++ Wrap ***/ -%insert(header) %{ -#include <stdexcept> -%} +%fragment("<stdexcept>"); %include <std_except.i> @@ -110,7 +108,7 @@ namespace std { template <> - struct less <PyObject *>: public binary_function<PyObject *, PyObject *, bool> + struct less <PyObject *> { bool operator()(PyObject * v, PyObject *w) const @@ -135,7 +133,7 @@ }; template <> - struct less <swig::SwigPtr_PyObject>: public binary_function<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject, bool> + struct less <swig::SwigPtr_PyObject> { bool operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const @@ -145,7 +143,7 @@ }; template <> - struct less <swig::SwigVar_PyObject>: public binary_function<swig::SwigVar_PyObject, swig::SwigVar_PyObject, bool> + struct less <swig::SwigVar_PyObject> { bool operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const @@ -208,7 +206,7 @@ if (step == 0) { throw std::invalid_argument("slice step cannot be zero"); } else if (step > 0) { - // Required range: 0 <= i < size, 0 <= j < size + // Required range: 0 <= i < size, 0 <= j < size, i <= j if (i < 0) { ii = 0; } else if (i < (Difference)size) { @@ -216,13 +214,15 @@ } else if (insert && (i >= (Difference)size)) { ii = (Difference)size; } - if ( j < 0 ) { + if (j < 0) { jj = 0; } else { jj = (j < (Difference)size) ? j : (Difference)size; } + if (jj < ii) + jj = ii; } else { - // Required range: -1 <= i < size-1, -1 <= j < size-1 + // Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j if (i < -1) { ii = -1; } else if (i < (Difference) size) { @@ -235,6 +235,8 @@ } else { jj = (j < (Difference)size ) ? j : (Difference)(size-1); } + if (ii < jj) + ii = jj; } } @@ -254,6 +256,19 @@ return pos; } + template <class Sequence> + inline void + erase(Sequence* seq, const typename Sequence::iterator& position) { + seq->erase(position); + } + + template <class Sequence> + struct traits_reserve { + static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) { + // This should be specialized for types that support reserve + } + }; + template <class Sequence, class Difference> inline Sequence* getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) { @@ -271,6 +286,7 @@ return new Sequence(sb, se); } else { Sequence *sequence = new Sequence(); + swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step); typename Sequence::const_iterator it = sb; while (it!=se) { sequence->push_back(*it); @@ -281,17 +297,16 @@ } } else { Sequence *sequence = new Sequence(); - if (ii > jj) { - typename Sequence::const_reverse_iterator sb = self->rbegin(); - typename Sequence::const_reverse_iterator se = self->rbegin(); - std::advance(sb,size-ii-1); - std::advance(se,size-jj-1); - typename Sequence::const_reverse_iterator it = sb; - while (it!=se) { - sequence->push_back(*it); - for (Py_ssize_t c=0; c<-step && it!=se; ++c) - it++; - } + swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step); + typename Sequence::const_reverse_iterator sb = self->rbegin(); + typename Sequence::const_reverse_iterator se = self->rbegin(); + std::advance(sb,size-ii-1); + std::advance(se,size-jj-1); + typename Sequence::const_reverse_iterator it = sb; + while (it!=se) { + sequence->push_back(*it); + for (Py_ssize_t c=0; c<-step && it!=se; ++c) + it++; } return sequence; } @@ -305,12 +320,11 @@ Difference jj = 0; swig::slice_adjust(i, j, step, size, ii, jj, true); if (step > 0) { - if (jj < ii) - jj = ii; if (step == 1) { size_t ssize = jj - ii; if (ssize <= is.size()) { // expanding/staying the same size + swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size()); typename Sequence::iterator sb = self->begin(); typename InputSeq::const_iterator isit = is.begin(); std::advance(sb,ii); @@ -344,8 +358,6 @@ } } } else { - if (jj > ii) - jj = ii; size_t replacecount = (ii - jj - step - 1) / -step; if (is.size() != replacecount) { char msg[1024]; @@ -371,37 +383,33 @@ Difference jj = 0; swig::slice_adjust(i, j, step, size, ii, jj, true); if (step > 0) { - if (jj > ii) { - typename Sequence::iterator sb = self->begin(); - std::advance(sb,ii); - if (step == 1) { - typename Sequence::iterator se = self->begin(); - std::advance(se,jj); - self->erase(sb,se); - } else { - typename Sequence::iterator it = sb; - size_t delcount = (jj - ii + step - 1) / step; - while (delcount) { - it = self->erase(it); - for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) - it++; - delcount--; - } - } - } - } else { - if (ii > jj) { - typename Sequence::reverse_iterator sb = self->rbegin(); - std::advance(sb,size-ii-1); - typename Sequence::reverse_iterator it = sb; - size_t delcount = (ii - jj - step - 1) / -step; + typename Sequence::iterator sb = self->begin(); + std::advance(sb,ii); + if (step == 1) { + typename Sequence::iterator se = self->begin(); + std::advance(se,jj); + self->erase(sb,se); + } else { + typename Sequence::iterator it = sb; + size_t delcount = (jj - ii + step - 1) / step; while (delcount) { - it = typename Sequence::reverse_iterator(self->erase((++it).base())); - for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) + it = self->erase(it); + for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) it++; delcount--; } } + } else { + typename Sequence::reverse_iterator sb = self->rbegin(); + std::advance(sb,size-ii-1); + typename Sequence::reverse_iterator it = sb; + size_t delcount = (ii - jj - step - 1) / -step; + while (delcount) { + it = typename Sequence::reverse_iterator(self->erase((++it).base())); + for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) + it++; + delcount--; + } } } } @@ -417,7 +425,7 @@ template <class T> struct SwigPySequence_Ref { - SwigPySequence_Ref(PyObject* seq, int index) + SwigPySequence_Ref(PyObject* seq, Py_ssize_t index) : _seq(seq), _index(index) { } @@ -429,7 +437,7 @@ return swig::as<T>(item, true); } catch (std::exception& e) { char msg[1024]; - sprintf(msg, "in sequence element %d ", _index); + sprintf(msg, "in sequence element %d ", (int)_index); if (!PyErr_Occurred()) { ::%type_error(swig::type_name<T>()); } @@ -447,7 +455,7 @@ private: PyObject* _seq; - int _index; + Py_ssize_t _index; }; template <class T> @@ -468,13 +476,13 @@ typedef Reference reference; typedef T value_type; typedef T* pointer; - typedef int difference_type; + typedef Py_ssize_t difference_type; SwigPySequence_InputIterator() { } - SwigPySequence_InputIterator(PyObject* seq, int index) + SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index) : _seq(seq), _index(index) { } @@ -554,6 +562,7 @@ difference_type _index; }; + // STL container wrapper around a Python sequence template <class T> struct SwigPySequence_Cont { @@ -561,8 +570,8 @@ typedef const SwigPySequence_Ref<T> const_reference; typedef T value_type; typedef T* pointer; - typedef int difference_type; - typedef int size_type; + typedef Py_ssize_t difference_type; + typedef size_t size_type; typedef const pointer const_pointer; typedef SwigPySequence_InputIterator<T, reference> iterator; typedef SwigPySequence_InputIterator<T, const_reference> const_iterator; @@ -623,13 +632,13 @@ bool check(bool set_err = true) const { - int s = size(); - for (int i = 0; i < s; ++i) { + Py_ssize_t s = size(); + for (Py_ssize_t i = 0; i < s; ++i) { swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i); if (!swig::check<value_type>(item)) { if (set_err) { char msg[1024]; - sprintf(msg, "in sequence element %d", i); + sprintf(msg, "in sequence element %d", (int)i); SWIG_Error(SWIG_RuntimeError, msg); } return false; @@ -712,7 +721,8 @@ #if defined(SWIGPYTHON_BUILTIN) %feature("python:slot", "tp_iter", functype="getiterfunc") iterator; #else - %pythoncode {def __iter__(self): return self.iterator()} + %pythoncode %{def __iter__(self): + return self.iterator()%} #endif } @@ -749,7 +759,6 @@ return self->size(); } } - %enddef @@ -757,7 +766,7 @@ %define %swig_sequence_methods_common(Sequence...) %swig_sequence_iterator(%arg(Sequence)) %swig_container_methods(%arg(Sequence)) - + %fragment("SwigPySequence_Base"); #if defined(SWIGPYTHON_BUILTIN) @@ -770,14 +779,6 @@ #endif // SWIGPYTHON_BUILTIN %extend { - value_type pop() throw (std::out_of_range) { - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - Sequence::value_type x = self->back(); - self->pop_back(); - return x; - } - /* typemap for slice object support */ %typemap(in) PySliceObject* { if (!PySlice_Check($input)) { @@ -795,7 +796,11 @@ return swig::getslice(self, i, j, 1); } - void __setslice__(difference_type i, difference_type j, const Sequence& v = Sequence()) throw (std::out_of_range, std::invalid_argument) { + void __setslice__(difference_type i, difference_type j) throw (std::out_of_range, std::invalid_argument) { + swig::setslice(self, i, j, 1, Sequence()); + } + + void __setslice__(difference_type i, difference_type j, const Sequence& v) throw (std::out_of_range, std::invalid_argument) { swig::setslice(self, i, j, 1, v); } @@ -804,11 +809,10 @@ } #endif - void __delitem__(difference_type i) throw (std::out_of_range) { - self->erase(swig::getpos(self,i)); + void __delitem__(difference_type i) throw (std::out_of_range, std::invalid_argument) { + swig::erase(self, swig::getpos(self, i)); } - /* Overloaded methods for Python 3 compatibility * (Also useful in Python 2.x) */ @@ -859,12 +863,11 @@ Sequence::difference_type jd = j; swig::delslice(self, id, jd, step); } - - } + } %enddef -%define %swig_sequence_methods(Sequence...) +%define %swig_sequence_methods_non_resizable(Sequence...) %swig_sequence_methods_common(%arg(Sequence)) %extend { const value_type& __getitem__(difference_type i) const throw (std::out_of_range) { @@ -875,14 +878,34 @@ *(swig::getpos(self,i)) = x; } +#if defined(SWIGPYTHON_BUILTIN) + // This will be called through the mp_ass_subscript slot to delete an entry. + void __setitem__(difference_type i) throw (std::out_of_range, std::invalid_argument) { + swig::erase(self, swig::getpos(self, i)); + } +#endif + + } +%enddef + +%define %swig_sequence_methods(Sequence...) + %swig_sequence_methods_non_resizable(%arg(Sequence)) + %extend { + value_type pop() throw (std::out_of_range) { + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + Sequence::value_type x = self->back(); + self->pop_back(); + return x; + } + void append(const value_type& x) { self->push_back(x); } - } - + } %enddef -%define %swig_sequence_methods_val(Sequence...) +%define %swig_sequence_methods_non_resizable_val(Sequence...) %swig_sequence_methods_common(%arg(Sequence)) %extend { value_type __getitem__(difference_type i) throw (std::out_of_range) { @@ -893,11 +916,30 @@ *(swig::getpos(self,i)) = x; } +#if defined(SWIGPYTHON_BUILTIN) + // This will be called through the mp_ass_subscript slot to delete an entry. + void __setitem__(difference_type i) throw (std::out_of_range, std::invalid_argument) { + swig::erase(self, swig::getpos(self, i)); + } +#endif + } +%enddef + +%define %swig_sequence_methods_val(Sequence...) + %swig_sequence_methods_non_resizable_val(%arg(Sequence)) + %extend { + value_type pop() throw (std::out_of_range) { + if (self->size() == 0) + throw std::out_of_range("pop from empty container"); + Sequence::value_type x = self->back(); + self->pop_back(); + return x; + } + void append(value_type x) { self->push_back(x); } - } - + } %enddef @@ -930,8 +972,8 @@ static int asptr(PyObject *obj, sequence **seq) { if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) { sequence *p; - if (::SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<sequence>(),0) == SWIG_OK) { + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { if (seq) *seq = p; return SWIG_OLDOBJ; } @@ -970,15 +1012,14 @@ %#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS swig_type_info *desc = swig::type_info<sequence>(); if (desc && desc->clientdata) { - return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); + return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); } %#endif size_type size = seq.size(); if (size <= (size_type)INT_MAX) { - PyObject *obj = PyTuple_New((int)size); - int i = 0; - for (const_iterator it = seq.begin(); - it != seq.end(); ++it, ++i) { + PyObject *obj = PyTuple_New((Py_ssize_t)size); + Py_ssize_t i = 0; + for (const_iterator it = seq.begin(); it != seq.end(); ++it, ++i) { PyTuple_SetItem(obj,i,swig::from<value_type>(*it)); } return obj;
diff --git a/share/swig/2.0.11/python/pydocs.swg b/share/swig/3.0.12/python/pydocs.swg similarity index 89% rename from share/swig/2.0.11/python/pydocs.swg rename to share/swig/3.0.12/python/pydocs.swg index f4ab9db..969af92 100644 --- a/share/swig/2.0.11/python/pydocs.swg +++ b/share/swig/3.0.12/python/pydocs.swg
@@ -5,6 +5,7 @@ %typemap(doc) SWIGTYPE "@param $1_name $1_type"; %typemap(doc) SWIGTYPE * "@param $1_name $1_type"; %typemap(doc) const SWIGTYPE & "@param $1_name $1_type"; +%typemap(doc) const SWIGTYPE && "@param $1_name $1_type"; %typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type"; %typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "@param $1_name $1_type (input/output)"; @@ -14,6 +15,7 @@ %typemap(doc) SWIGTYPE "$1_name: $1_type"; %typemap(doc) SWIGTYPE * "$1_name: $1_type"; %typemap(doc) const SWIGTYPE & "$1_name: $1_type"; +%typemap(doc) const SWIGTYPE && "$1_name: $1_type"; %typemap(doc) enum SWIGTYPE "$1_name: enum $1_type"; %typemap(doc) SWIGTYPE *INOUT, SWIGTYPE &INOUT "$1_name: $1_type (input/output)";
diff --git a/share/swig/2.0.11/python/pyerrors.swg b/share/swig/3.0.12/python/pyerrors.swg similarity index 100% rename from share/swig/2.0.11/python/pyerrors.swg rename to share/swig/3.0.12/python/pyerrors.swg
diff --git a/share/swig/2.0.11/python/pyfragments.swg b/share/swig/3.0.12/python/pyfragments.swg similarity index 100% rename from share/swig/2.0.11/python/pyfragments.swg rename to share/swig/3.0.12/python/pyfragments.swg
diff --git a/share/swig/2.0.11/python/pyhead.swg b/share/swig/3.0.12/python/pyhead.swg similarity index 97% rename from share/swig/2.0.11/python/pyhead.swg rename to share/swig/3.0.12/python/pyhead.swg index cedd017..55eb95a 100644 --- a/share/swig/2.0.11/python/pyhead.swg +++ b/share/swig/3.0.12/python/pyhead.swg
@@ -97,10 +97,6 @@ } #endif -/* Add PyObject_Del for old Pythons */ -#if PY_VERSION_HEX < 0x01060000 -# define PyObject_Del(op) PyMem_DEL((op)) -#endif #ifndef PyObject_DEL # define PyObject_DEL PyObject_Del #endif @@ -215,4 +211,5 @@ #if PY_VERSION_HEX < 0x03020000 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) +#define Py_hash_t long #endif
diff --git a/share/swig/2.0.11/python/pyinit.swg b/share/swig/3.0.12/python/pyinit.swg similarity index 91% rename from share/swig/2.0.11/python/pyinit.swg rename to share/swig/3.0.12/python/pyinit.swg index 6a6de09..2cc5828 100644 --- a/share/swig/2.0.11/python/pyinit.swg +++ b/share/swig/3.0.12/python/pyinit.swg
@@ -4,6 +4,10 @@ %insert(init) "swiginit.swg" +#if defined(SWIGPYTHON_BUILTIN) +%fragment("<stddef.h>"); // For offsetof +#endif + %init %{ #ifdef __cplusplus @@ -112,7 +116,7 @@ var = var->next; } if (res == NULL && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } @@ -129,7 +133,7 @@ var = var->next; } if (res == 1 && !PyErr_Occurred()) { - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); } return res; } @@ -141,7 +145,6 @@ static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -179,10 +182,19 @@ 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; varlink_type = tmp; @@ -271,7 +283,9 @@ size_t i; for (i = 0; methods[i].ml_name; ++i) { const char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { + if (!c) continue; + c = strstr(c, "swig_ptr: "); + if (c) { int j; swig_const_info *ci = 0; const char *name = c + 10; @@ -360,17 +374,18 @@ static PyGetSetDef thisown_getset_def = { (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure }; - PyObject *metatype_args; PyTypeObject *builtin_pytype; int builtin_base_count; swig_type_info *builtin_basetype; PyObject *tuple; PyGetSetDescrObject *static_getset; PyTypeObject *metatype; + PyTypeObject *swigpyobject; SwigPyClientData *cd; PyObject *public_interface, *public_symbol; PyObject *this_descr; PyObject *thisown_descr; + PyObject *self = 0; int i; (void)builtin_pytype; @@ -378,15 +393,11 @@ (void)builtin_basetype; (void)tuple; (void)static_getset; + (void)self; - /* metatype is used to implement static member variables. */ - metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type); - assert(metatype_args); - metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL); + /* Metaclass is used to implement static member variables */ + metatype = SwigPyObjectType(); assert(metatype); - Py_DECREF(metatype_args); - metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro; - assert(PyType_Ready(metatype) >= 0); #endif /* Fix SwigMethods to carry the callback ptrs when needed */ @@ -397,19 +408,22 @@ #else m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif + md = d = PyModule_GetDict(m); (void)md; SWIG_InitializeModule(0); #ifdef SWIGPYTHON_BUILTIN + swigpyobject = SwigPyObject_TypeOnce(); + SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); assert(SwigPyObject_stype); cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; if (!cd) { SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce(); - } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) { + SwigPyObject_clientdata.pytype = swigpyobject; + } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); # if PY_VERSION_HEX >= 0x03000000 return NULL;
diff --git a/share/swig/2.0.11/python/pyiterators.swg b/share/swig/3.0.12/python/pyiterators.swg similarity index 99% rename from share/swig/2.0.11/python/pyiterators.swg rename to share/swig/3.0.12/python/pyiterators.swg index f93594c..8fbb312 100644 --- a/share/swig/2.0.11/python/pyiterators.swg +++ b/share/swig/3.0.12/python/pyiterators.swg
@@ -344,7 +344,8 @@ %feature("python:slot", "tp_iternext", functype="iternextfunc") SwigPyIterator::__next__; #else %extend SwigPyIterator { - %pythoncode {def __iter__(self): return self} + %pythoncode %{def __iter__(self): + return self%} } #endif
diff --git a/share/swig/2.0.11/python/pymacros.swg b/share/swig/3.0.12/python/pymacros.swg similarity index 100% rename from share/swig/2.0.11/python/pymacros.swg rename to share/swig/3.0.12/python/pymacros.swg
diff --git a/share/swig/2.0.11/python/pyname_compat.i b/share/swig/3.0.12/python/pyname_compat.i similarity index 100% rename from share/swig/2.0.11/python/pyname_compat.i rename to share/swig/3.0.12/python/pyname_compat.i
diff --git a/share/swig/2.0.11/python/pyopers.swg b/share/swig/3.0.12/python/pyopers.swg similarity index 80% rename from share/swig/2.0.11/python/pyopers.swg rename to share/swig/3.0.12/python/pyopers.swg index ecbe783..fd2fcc5 100644 --- a/share/swig/2.0.11/python/pyopers.swg +++ b/share/swig/3.0.12/python/pyopers.swg
@@ -18,31 +18,35 @@ where <slot> is the name of a field in a PyTypeObject, PyNumberMethods, PyMappingMethods, PySequenceMethods, or PyBufferProcs. For example: - %{ - - static long myHashFunc (PyObject *pyobj) { - MyClass *cobj; - // Convert pyobj to cobj - return (cobj->field1 * (cobj->field2 << 7)); - } - - %} - %feature("python:tp_hash") MyClass "myHashFunc"; + class MyClass { + public: + ... + }; + + %{ + // Note: Py_hash_t was introduced in Python 3.2 + static Py_hash_t myHashFunc(PyObject *pyobj) { + MyClass *cobj; + // Convert pyobj to cobj + return (cobj->field1 * (cobj->field2 << 7)); + } + %} + NOTE: It is the responsibility of the programmer (that's you) to ensure that a statically defined slot function has the correct signature. If, instead, you want to dispatch to an instance method, you can use %feature("python:slot"). For example: + %feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc; + class MyClass { public: - long myHashFunc () const; + Py_hash_t myHashFunc () const; ... }; - - %feature("python:slot", "tp_hash", functype="hashfunc") MyClass::myHashFunc; NOTE: Some python slots use a method signature which does not match the signature of SWIG-wrapped methods. For those slots, @@ -58,20 +62,21 @@ operator overloads for comparison (operator==, operator<, etc.), they will be called from the generated rich compare function. If you want to explicitly choose a method to handle a certain comparison - operation, you may use %feature("python:slot") like this: + operation, you may use a different feature, %feature("python:compare") + like this: + + %feature("python:compare", "Py_LT") MyClass::lessThan; class MyClass { public: - bool lessThan (const MyClass& x) const; + bool lessThan(const MyClass& other) const; ... }; - %feature("python:slot", "Py_LT") MyClass::lessThan; - ... where "Py_LT" is one of the rich comparison opcodes defined in the python header file object.h. - If there's no method defined to handle a particular comparsion operation, + If there's no method defined to handle a particular comparison operation, the default behavior is to compare pointer values of the wrapped C++ objects. @@ -103,7 +108,6 @@ %pybinoperator(__neg__, *::operator-(), unaryfunc, nb_negative); %pybinoperator(__neg__, *::operator-() const, unaryfunc, nb_negative); %pybinoperator(__mul__, *::operator*, binaryfunc, nb_multiply); -%pybinoperator(__div__, *::operator/, binaryfunc, nb_div); %pybinoperator(__mod__, *::operator%, binaryfunc, nb_remainder); %pybinoperator(__lshift__, *::operator<<, binaryfunc, nb_lshift); %pybinoperator(__rshift__, *::operator>>, binaryfunc, nb_rshift); @@ -117,8 +121,6 @@ %pycompare(__eq__, *::operator==, Py_EQ); %pycompare(__ne__, *::operator!=, Py_NE); -%feature("python:slot", "nb_truediv", functype="binaryfunc") *::operator/; - /* Special cases */ %rename(__invert__) *::operator~; %feature("python:slot", "nb_invert", functype="unaryfunc") *::operator~; @@ -127,6 +129,7 @@ #if defined(SWIGPYTHON_BUILTIN) %pybinoperator(__nonzero__, *::operator bool, inquiry, nb_nonzero); +%pybinoperator(__truediv__, *::operator/ , binaryfunc, nb_divide); #else %feature("shadow") *::operator bool %{ def __nonzero__(self): @@ -134,6 +137,13 @@ __bool__ = __nonzero__ %}; %rename(__nonzero__) *::operator bool; +%feature("shadow") *::operator/ %{ +def __truediv__(self, *args): + return $action(self, *args) +__div__ = __truediv__ +%}; +%rename(__truediv__) *::operator/; +%pythonmaybecall *::operator/; #endif /* Ignored operators */ @@ -151,11 +161,11 @@ They translate the inplace C++ operators (+=, -=, ...) into the corresponding python equivalents(__iadd__,__isub__), etc, - disabling the ownership of the input 'self' pointer, and assigning + disabling the ownership of the input 'this' pointer, and assigning it to the returning object: - %feature("del") *::Operator; - %feature("new") *::Operator; + %feature("del") *::Operator; // disables ownership by generating SWIG_POINTER_DISOWN + %feature("new") *::Operator; // claims ownership by generating SWIG_POINTER_OWN This makes the most common case safe, ie: @@ -174,8 +184,8 @@ that never get deleted (maybe, not sure, it depends). But if that is the case, you could recover the old behaviour using - %feature("del","") A::operator+=; - %feature("new","") A::operator+=; + %feature("del","0") A::operator+=; + %feature("new","0") A::operator+=; which recovers the old behaviour for the class 'A', or if you are 100% sure your entire system works fine in the old way, use: @@ -183,6 +193,12 @@ %feature("del","") *::operator+=; %feature("new","") *::operator+=; + The default behaviour assumes that the 'this' pointer's memory is + already owned by the SWIG object; it relinquishes ownership then + takes it back. This may not be the case though as the SWIG object + might be owned by memory managed elsewhere, eg after calling a + function that returns a C++ reference. In such case you will need + to use the features above to recover the old behaviour too. */ #if defined(SWIGPYTHON_BUILTIN) @@ -194,7 +210,6 @@ %pyinplaceoper(__iadd__ , *::operator +=, binaryfunc, nb_inplace_add); %pyinplaceoper(__isub__ , *::operator -=, binaryfunc, nb_inplace_subtract); %pyinplaceoper(__imul__ , *::operator *=, binaryfunc, nb_inplace_multiply); -%pyinplaceoper(__idiv__ , *::operator /=, binaryfunc, nb_inplace_divide); %pyinplaceoper(__imod__ , *::operator %=, binaryfunc, nb_inplace_remainder); %pyinplaceoper(__iand__ , *::operator &=, binaryfunc, nb_inplace_and); %pyinplaceoper(__ior__ , *::operator |=, binaryfunc, nb_inplace_or); @@ -202,6 +217,19 @@ %pyinplaceoper(__ilshift__, *::operator <<=, binaryfunc, nb_inplace_lshift); %pyinplaceoper(__irshift__, *::operator >>=, binaryfunc, nb_inplace_rshift); +/* Special cases */ +#if defined(SWIGPYTHON_BUILTIN) +%pyinplaceoper(__itruediv__ , *::operator /=, binaryfunc, nb_inplace_divide); +#else +%delobject *::operator /=; +%newobject *::operator /=; +%feature("shadow") *::operator /= %{ +def __itruediv__(self, *args): + return $action(self, *args) +__idiv__ = __itruediv__ +%}; +%rename(__itruediv__) *::operator /=; +#endif /* Finally, in python we need to mark the binary operations to fail as 'maybecall' methods */ @@ -216,6 +244,7 @@ %pybinopermaybecall(neg); %pybinopermaybecall(mul); %pybinopermaybecall(div); +%pybinopermaybecall(truediv); %pybinopermaybecall(mod); %pybinopermaybecall(lshift); %pybinopermaybecall(rshift);
diff --git a/share/swig/2.0.11/python/pyprimtypes.swg b/share/swig/3.0.12/python/pyprimtypes.swg similarity index 81% rename from share/swig/2.0.11/python/pyprimtypes.swg rename to share/swig/3.0.12/python/pyprimtypes.swg index 66ff104..6a01af1 100644 --- a/share/swig/2.0.11/python/pyprimtypes.swg +++ b/share/swig/3.0.12/python/pyprimtypes.swg
@@ -12,6 +12,8 @@ } } +#ifdef SWIG_PYTHON_LEGACY_BOOL +// Default prior to SWIG 3.0.0 %fragment(SWIG_AsVal_frag(bool),"header", fragment=SWIG_AsVal_frag(long)) { SWIGINTERN int @@ -24,6 +26,23 @@ return SWIG_OK; } } +#else +%fragment(SWIG_AsVal_frag(bool),"header", + fragment=SWIG_AsVal_frag(long)) { +SWIGINTERN int +SWIG_AsVal_dec(bool)(PyObject *obj, bool *val) +{ + int r; + if (!PyBool_Check(obj)) + return SWIG_ERROR; + r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; +} +} +#endif /* int */ @@ -48,7 +67,7 @@ /* long */ %fragment(SWIG_From_frag(long),"header") { - %define_as(SWIG_From_dec(long), PyLong_FromLong) + %define_as(SWIG_From_dec(long), PyInt_FromLong) } %fragment(SWIG_AsVal_frag(long),"header", @@ -56,16 +75,20 @@ SWIGINTERN int SWIG_AsVal_dec(long)(PyObject *obj, long* val) { +%#if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(obj)) { if (val) *val = PyInt_AsLong(obj); return SWIG_OK; - } else if (PyLong_Check(obj)) { + } else +%#endif + if (PyLong_Check(obj)) { long v = PyLong_AsLong(obj); if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; } else { PyErr_Clear(); + return SWIG_OverflowError; } } %#ifdef SWIG_PYTHON_CAST_MODE @@ -100,7 +123,7 @@ SWIG_From_dec(unsigned long)(unsigned long value) { return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyLong_FromLong(%numeric_cast(value,long)); + PyLong_FromUnsignedLong(value) : PyInt_FromLong(%numeric_cast(value,long)); } } @@ -127,18 +150,7 @@ return SWIG_OK; } else { PyErr_Clear(); -%#if PY_VERSION_HEX >= 0x03000000 - { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (v < 0) { - return SWIG_OverflowError; - } - } else { - PyErr_Clear(); - } - } -%#endif + return SWIG_OverflowError; } } %#ifdef SWIG_PYTHON_CAST_MODE @@ -168,20 +180,22 @@ /* long long */ %fragment(SWIG_From_frag(long long),"header", - fragment=SWIG_From_frag(long), - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE PyObject* SWIG_From_dec(long long)(long long value) { return ((value < LONG_MIN) || (value > LONG_MAX)) ? - PyLong_FromLongLong(value) : PyLong_FromLong(%numeric_cast(value,long)); + PyLong_FromLongLong(value) : PyInt_FromLong(%numeric_cast(value,long)); } +%#endif } %fragment(SWIG_AsVal_frag(long long),"header", fragment=SWIG_AsVal_frag(long), fragment="SWIG_CanCastAsInteger", - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(long long)(PyObject *obj, long long *val) { @@ -193,6 +207,7 @@ return SWIG_OK; } else { PyErr_Clear(); + res = SWIG_OverflowError; } } else { long v; @@ -208,6 +223,8 @@ const double mant_min = -mant_max; double d; res = SWIG_AsVal(double)(obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max)) + return SWIG_OverflowError; if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { if (val) *val = (long long)(d); return SWIG_AddCast(res); @@ -217,25 +234,28 @@ %#endif return res; } +%#endif } /* unsigned long long */ %fragment(SWIG_From_frag(unsigned long long),"header", - fragment=SWIG_From_frag(long long), - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE PyObject* SWIG_From_dec(unsigned long long)(unsigned long long value) { return (value > LONG_MAX) ? - PyLong_FromUnsignedLongLong(value) : PyLong_FromLong(%numeric_cast(value,long)); + PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(%numeric_cast(value,long)); } +%#endif } %fragment(SWIG_AsVal_frag(unsigned long long),"header", fragment=SWIG_AsVal_frag(unsigned long), fragment="SWIG_CanCastAsInteger", - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(unsigned long long)(PyObject *obj, unsigned long long *val) { @@ -247,6 +267,7 @@ return SWIG_OK; } else { PyErr_Clear(); + res = SWIG_OverflowError; } } else { unsigned long v; @@ -261,6 +282,8 @@ const double mant_max = 1LL << DBL_MANT_DIG; double d; res = SWIG_AsVal(double)(obj,&d); + if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) + return SWIG_OverflowError; if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { if (val) *val = (unsigned long long)(d); return SWIG_AddCast(res); @@ -270,6 +293,7 @@ %#endif return res; } +%#endif } /* double */ @@ -286,9 +310,11 @@ if (PyFloat_Check(obj)) { if (val) *val = PyFloat_AsDouble(obj); return SWIG_OK; +%#if PY_VERSION_HEX < 0x03000000 } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); + if (val) *val = (double) PyInt_AsLong(obj); return SWIG_OK; +%#endif } else if (PyLong_Check(obj)) { double v = PyLong_AsDouble(obj); if (!PyErr_Occurred()) {
diff --git a/share/swig/2.0.11/python/pyrun.swg b/share/swig/3.0.12/python/pyrun.swg similarity index 93% rename from share/swig/2.0.11/python/pyrun.swg rename to share/swig/3.0.12/python/pyrun.swg index b077fad..ab1237f 100644 --- a/share/swig/2.0.11/python/pyrun.swg +++ b/share/swig/3.0.12/python/pyrun.swg
@@ -161,7 +161,7 @@ /* Unpack the argument tuple */ -SWIGINTERN int +SWIGINTERN Py_ssize_t SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) { if (!args) { @@ -175,7 +175,7 @@ } if (!PyTuple_Check(args)) { if (min <= 1 && max >= 1) { - register int i; + Py_ssize_t i; objs[0] = args; for (i = 1; i < max; ++i) { objs[i] = 0; @@ -185,7 +185,7 @@ PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); return 0; } else { - register Py_ssize_t l = PyTuple_GET_SIZE(args); + Py_ssize_t l = PyTuple_GET_SIZE(args); if (l < min) { PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int)min, (int)l); @@ -195,7 +195,7 @@ name, (min == max ? "" : "at most "), (int)max, (int)l); return 0; } else { - register int i; + Py_ssize_t i; for (i = 0; i < l; ++i) { objs[i] = PyTuple_GET_ITEM(args, i); } @@ -381,6 +381,23 @@ #endif } SwigPyObject; + +#ifdef SWIGPYTHON_BUILTIN + +SWIGRUNTIME PyObject * +SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) +{ + SwigPyObject *sobj = (SwigPyObject *)v; + + if (!sobj->dict) + sobj->dict = PyDict_New(); + + Py_INCREF(sobj->dict); + return sobj->dict; +} + +#endif + SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v) { @@ -519,16 +536,32 @@ if (destroy) { /* destroy is always a VARARGS method */ PyObject *res; + + /* PyObject_CallFunction() has the potential to silently drop + the active active exception. In cases of unnamed temporary + variable or where we just finished iterating over a generator + StopIteration will be active right now, and this needs to + remain true upon return from SwigPyObject_dealloc. So save + and restore. */ + + PyObject *val = NULL, *type = NULL, *tb = NULL; + PyErr_Fetch(&val, &type, &tb); + if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); + /* we need to create a temporary object to carry the destroy operation */ + PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); } + if (!res) + PyErr_WriteUnraisable(destroy); + + PyErr_Restore(val, type, tb); + Py_XDECREF(res); } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) @@ -552,6 +585,7 @@ next = tmp; #endif if (!SwigPyObject_Check(next)) { + PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); return NULL; } sobj->next = next; @@ -651,7 +685,7 @@ static PyMethodDef swigobject_methods[] = { {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, - {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"}, {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, @@ -707,7 +741,9 @@ (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ @@ -722,7 +758,6 @@ static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -733,7 +768,7 @@ sizeof(SwigPyObject), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ + 0, /* tp_print */ #if PY_VERSION_HEX < 0x02020000 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */ #else @@ -741,7 +776,7 @@ #endif (setattrfunc)0, /* tp_setattr */ #if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ + 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ #else (cmpfunc)SwigPyObject_compare, /* tp_compare */ #endif @@ -751,7 +786,7 @@ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ - 0, /* tp_str */ + 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ @@ -787,10 +822,19 @@ 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpyobject_type = tmp; @@ -905,7 +949,6 @@ static int type_init = 0; if (!type_init) { const PyTypeObject tmp = { - /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 PyVarObject_HEAD_INIT(NULL, 0) #else @@ -966,10 +1009,19 @@ 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpypacked_type = tmp; @@ -1310,7 +1362,7 @@ } } else { #if PY_VERSION_HEX >= 0x03000000 - inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); if (inst) { PyObject_SetAttr(inst, SWIG_This(), swig_this); Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; @@ -1420,18 +1472,21 @@ newobj = (SwigPyObject *) newobj->next; newobj->next = next_self; newobj = (SwigPyObject *)next_self; +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif } } else { newobj = PyObject_New(SwigPyObject, clientdata->pytype); +#ifdef SWIGPYTHON_BUILTIN + newobj->dict = 0; +#endif } if (newobj) { newobj->ptr = ptr; newobj->ty = type; newobj->own = own; newobj->next = 0; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif return (PyObject*) newobj; } return SWIG_Py_Void(); @@ -1494,13 +1549,11 @@ { PyObject *dict; if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return SWIG_ERROR; } if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); + PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value"); return SWIG_ERROR; }
diff --git a/share/swig/2.0.11/python/pyruntime.swg b/share/swig/3.0.12/python/pyruntime.swg similarity index 100% rename from share/swig/2.0.11/python/pyruntime.swg rename to share/swig/3.0.12/python/pyruntime.swg
diff --git a/share/swig/2.0.11/python/pystdcommon.swg b/share/swig/3.0.12/python/pystdcommon.swg similarity index 94% rename from share/swig/2.0.11/python/pystdcommon.swg rename to share/swig/3.0.12/python/pystdcommon.swg index 2f223a8..8372426 100644 --- a/share/swig/2.0.11/python/pystdcommon.swg +++ b/share/swig/3.0.12/python/pystdcommon.swg
@@ -46,7 +46,8 @@ struct traits_asptr { static int asptr(PyObject *obj, Type **val) { Type *p; - int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = p; } @@ -195,9 +196,8 @@ // #ifdef SWIG_PYTHON_BACKWARD_COMP +%fragment("<string>"); %{ -#include <string> - PyObject* SwigInt_FromBool(bool b) { return PyInt_FromLong(b ? 1L : 0L); } @@ -257,3 +257,5 @@ #define specialize_std_deque(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From) #define specialize_std_set(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From) #define specialize_std_multiset(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From) +#define specialize_std_unordered_set(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From) +#define specialize_std_unordered_multiset(Type,Check,As,From) %specialize_std_container(%arg(Type),Check,As,From)
diff --git a/share/swig/2.0.11/python/pystrings.swg b/share/swig/3.0.12/python/pystrings.swg similarity index 64% rename from share/swig/2.0.11/python/pystrings.swg rename to share/swig/3.0.12/python/pystrings.swg index f6a4eba..fd37855 100644 --- a/share/swig/2.0.11/python/pystrings.swg +++ b/share/swig/3.0.12/python/pystrings.swg
@@ -6,13 +6,18 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { %#if PY_VERSION_HEX>=0x03000000 +%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + if (PyBytes_Check(obj)) +%#else if (PyUnicode_Check(obj)) +%#endif %#else if (PyString_Check(obj)) %#endif { char *cstr; Py_ssize_t len; %#if PY_VERSION_HEX>=0x03000000 +%#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) if (!alloc && cptr) { /* We can't allow converting without allocation, since the internal representation of string in Python 3 is UCS-2/UCS-4 but we require @@ -21,8 +26,9 @@ return SWIG_RuntimeError; } obj = PyUnicode_AsUTF8String(obj); - PyBytes_AsStringAndSize(obj, &cstr, &len); if(alloc) *alloc = SWIG_NEWOBJ; +%#endif + PyBytes_AsStringAndSize(obj, &cstr, &len); %#else PyString_AsStringAndSize(obj, &cstr, &len); %#endif @@ -42,27 +48,58 @@ %#else if (*alloc == SWIG_NEWOBJ) %#endif - { - *cptr = %new_copy_array(cstr, len + 1, char); - *alloc = SWIG_NEWOBJ; - } - else { + { + *cptr = %new_copy_array(cstr, len + 1, char); + *alloc = SWIG_NEWOBJ; + } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; } } else { - %#if PY_VERSION_HEX>=0x03000000 - assert(0); /* Should never reach here in Python 3 */ - %#endif +%#if PY_VERSION_HEX>=0x03000000 +%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + *cptr = PyBytes_AsString(obj); +%#else + assert(0); /* Should never reach here with Unicode strings in Python 3 */ +%#endif +%#else *cptr = SWIG_Python_str_AsChar(obj); +%#endif } } if (psize) *psize = len + 1; -%#if PY_VERSION_HEX>=0x03000000 +%#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) Py_XDECREF(obj); %#endif return SWIG_OK; } else { +%#if defined(SWIG_PYTHON_2_UNICODE) +%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) +%#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" +%#endif +%#if PY_VERSION_HEX<0x03000000 + if (PyUnicode_Check(obj)) { + char *cstr; Py_ssize_t len; + if (!alloc && cptr) { + return SWIG_RuntimeError; + } + obj = PyUnicode_AsUTF8String(obj); + if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { + if (cptr) { + if (alloc) *alloc = SWIG_NEWOBJ; + *cptr = %new_copy_array(cstr, len + 1, char); + } + if (psize) *psize = len + 1; + + Py_XDECREF(obj); + return SWIG_OK; + } else { + Py_XDECREF(obj); + } + } +%#endif +%#endif + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); if (pchar_descriptor) { void* vptr = 0; @@ -89,9 +126,17 @@ SWIG_InternalNewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void(); } else { %#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromStringAndSize(carray, %numeric_cast(size,int)); +%#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) + return PyBytes_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t)); %#else - return PyString_FromStringAndSize(carray, %numeric_cast(size,int)); +%#if PY_VERSION_HEX >= 0x03010000 + return PyUnicode_DecodeUTF8(carray, %numeric_cast(size, Py_ssize_t), "surrogateescape"); +%#else + return PyUnicode_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t)); +%#endif +%#endif +%#else + return PyString_FromStringAndSize(carray, %numeric_cast(size, Py_ssize_t)); %#endif } } else { @@ -100,4 +145,3 @@ } } -
diff --git a/share/swig/2.0.11/python/python.swg b/share/swig/3.0.12/python/python.swg similarity index 100% rename from share/swig/2.0.11/python/python.swg rename to share/swig/3.0.12/python/python.swg
diff --git a/share/swig/2.0.11/python/pythonkw.swg b/share/swig/3.0.12/python/pythonkw.swg similarity index 92% rename from share/swig/2.0.11/python/pythonkw.swg rename to share/swig/3.0.12/python/pythonkw.swg index 8ad0ef1..1a4329d 100644 --- a/share/swig/2.0.11/python/pythonkw.swg +++ b/share/swig/3.0.12/python/pythonkw.swg
@@ -8,10 +8,11 @@ /* Warnings for Python keywords - http://www.fnorb.org/docs/1.2/Fnorb-Guide/node62.html + https://docs.python.org/2/reference/lexical_analysis.html#keywords */ PYTHONKW(and); +PYTHONKW(as); PYTHONKW(assert); PYTHONKW(break); PYTHONKW(class); @@ -39,11 +40,12 @@ PYTHONKW(return); PYTHONKW(try); PYTHONKW(while); +PYTHONKW(with); PYTHONKW(yield); /* built-in functions - http://www.zvon.org/other/python/doc21/lib/built-in-funcs.html + https://docs.python.org/2/library/functions.html */ PYTHONBN(abs); @@ -130,7 +132,7 @@ /* 'self' is also a bad Name */ -PYTHONBN(self); +PYTHONKW(self); #undef PYTHONBN #undef PYTHONKW
diff --git a/share/swig/2.0.11/python/pythreads.swg b/share/swig/3.0.12/python/pythreads.swg similarity index 100% rename from share/swig/2.0.11/python/pythreads.swg rename to share/swig/3.0.12/python/pythreads.swg
diff --git a/share/swig/2.0.11/python/pytuplehlp.swg b/share/swig/3.0.12/python/pytuplehlp.swg similarity index 100% rename from share/swig/2.0.11/python/pytuplehlp.swg rename to share/swig/3.0.12/python/pytuplehlp.swg
diff --git a/share/swig/2.0.11/python/pytypemaps.swg b/share/swig/3.0.12/python/pytypemaps.swg similarity index 90% rename from share/swig/2.0.11/python/pytypemaps.swg rename to share/swig/3.0.12/python/pytypemaps.swg index c64b47b..48b0bcd 100644 --- a/share/swig/2.0.11/python/pytypemaps.swg +++ b/share/swig/3.0.12/python/pytypemaps.swg
@@ -5,11 +5,13 @@ /* ------------------------------------------------------------ * Fragment section * ------------------------------------------------------------ */ -/* bool is dangerous in Python, change precedence */ +#ifdef SWIG_PYTHON_LEGACY_BOOL +// Default prior to SWIG 3.0.0 #undef SWIG_TYPECHECK_BOOL %define SWIG_TYPECHECK_BOOL 10000 %enddef +#endif -/* Include fundamental fragemt definitions */ +/* Include fundamental fragment definitions */ %include <typemaps/fragments.swg> /* Look for user fragments file. */ @@ -77,10 +79,12 @@ /* Consttab, needed for callbacks, it should be removed later */ -%typemap(consttab) SWIGTYPE ((*)(ANY)) +%typemap(consttab) SWIGTYPE ((*)(ANY)) { SWIG_PY_POINTER, (char*)"$symname", 0, 0, (void *)($value), &$descriptor } +%typemap(consttab) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); %typemap(constcode) SWIGTYPE ((*)(ANY)) ""; +%typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); /* Smart Pointers */
diff --git a/share/swig/2.0.11/python/pyuserdir.swg b/share/swig/3.0.12/python/pyuserdir.swg similarity index 99% rename from share/swig/2.0.11/python/pyuserdir.swg rename to share/swig/3.0.12/python/pyuserdir.swg index d3c3eb1..00aec07 100644 --- a/share/swig/2.0.11/python/pyuserdir.swg +++ b/share/swig/3.0.12/python/pyuserdir.swg
@@ -185,7 +185,6 @@ #define %clearpythonappend %feature("pythonappend","") - /* ------------------------------------------------------------------------- */ /* %extend_smart_pointer extend the smart pointer support.
diff --git a/share/swig/2.0.11/python/pywstrings.swg b/share/swig/3.0.12/python/pywstrings.swg similarity index 92% rename from share/swig/2.0.11/python/pywstrings.swg rename to share/swig/3.0.12/python/pywstrings.swg index 864376b..e646187 100644 --- a/share/swig/2.0.11/python/pywstrings.swg +++ b/share/swig/3.0.12/python/pywstrings.swg
@@ -16,7 +16,7 @@ { PyObject *tmp = 0; int isunicode = PyUnicode_Check(obj); -%#if PY_VERSION_HEX < 0x03000000 +%#if PY_VERSION_HEX < 0x03000000 && !defined(SWIG_PYTHON_STRICT_UNICODE_WCHAR) if (!isunicode && PyString_Check(obj)) { obj = tmp = PyUnicode_FromObject(obj); isunicode = 1; @@ -58,7 +58,7 @@ return pwchar_descriptor ? SWIG_InternalNewPointerObj(%const_cast(carray,wchar_t *), pwchar_descriptor, 0) : SWIG_Py_Void(); } else { - return PyUnicode_FromWideChar(carray, %numeric_cast(size,int)); + return PyUnicode_FromWideChar(carray, %numeric_cast(size, Py_ssize_t)); } } else { return SWIG_Py_Void();
diff --git a/share/swig/2.0.11/python/std_alloc.i b/share/swig/3.0.12/python/std_alloc.i similarity index 100% rename from share/swig/2.0.11/python/std_alloc.i rename to share/swig/3.0.12/python/std_alloc.i
diff --git a/share/swig/3.0.12/python/std_array.i b/share/swig/3.0.12/python/std_array.i new file mode 100644 index 0000000..a3de312 --- /dev/null +++ b/share/swig/3.0.12/python/std_array.i
@@ -0,0 +1,91 @@ +/* + std::array +*/ + +%fragment("StdArrayTraits","header",fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T, size_t N> + struct traits_asptr<std::array<T, N> > { + static int asptr(PyObject *obj, std::array<T, N> **vec) { + return traits_asptr_stdseq<std::array<T, N> >::asptr(obj, vec); + } + }; + + template <class T, size_t N> + struct traits_from<std::array<T, N> > { + static PyObject *from(const std::array<T, N>& vec) { + return traits_from_stdseq<std::array<T, N> >::from(vec); + } + }; + + template <class SwigPySeq, class T, size_t N> + inline void + assign(const SwigPySeq& swigpyseq, std::array<T, N>* seq) { + if (swigpyseq.size() < seq->size()) + throw std::invalid_argument("std::array cannot be expanded in size"); + else if (swigpyseq.size() > seq->size()) + throw std::invalid_argument("std::array cannot be reduced in size"); + std::copy(swigpyseq.begin(), swigpyseq.end(), seq->begin()); + } + + template <class T, size_t N> + inline void + erase(std::array<T, N>* SWIGUNUSEDPARM(seq), const typename std::array<T, N>::iterator& SWIGUNUSEDPARM(position)) { + throw std::invalid_argument("std::array object does not support item deletion"); + } + + // Only limited slicing is supported as std::array is fixed in size + template <class T, size_t N, class Difference> + inline std::array<T, N>* + getslice(const std::array<T, N>* self, Difference i, Difference j, Py_ssize_t step) { + typedef std::array<T, N> Sequence; + typename Sequence::size_type size = self->size(); + Difference ii = 0; + Difference jj = 0; + swig::slice_adjust(i, j, step, size, ii, jj); + + if (step == 1 && ii == 0 && static_cast<typename Sequence::size_type>(jj) == size) { + Sequence *sequence = new Sequence(); + std::copy(self->begin(), self->end(), sequence->begin()); + return sequence; + } else if (step == -1 && static_cast<typename Sequence::size_type>(ii) == (size - 1) && jj == -1) { + Sequence *sequence = new Sequence(); + std::copy(self->rbegin(), self->rend(), sequence->begin()); + return sequence; + } else { + throw std::invalid_argument("std::array object only supports getting a slice that is the size of the array"); + } + } + + template <class T, size_t N, class Difference, class InputSeq> + inline void + setslice(std::array<T, N>* self, Difference i, Difference j, Py_ssize_t step, const InputSeq& is = InputSeq()) { + typedef std::array<T, N> Sequence; + typename Sequence::size_type size = self->size(); + Difference ii = 0; + Difference jj = 0; + swig::slice_adjust(i, j, step, size, ii, jj, true); + + if (step == 1 && ii == 0 && static_cast<typename Sequence::size_type>(jj) == size) { + std::copy(is.begin(), is.end(), self->begin()); + } else if (step == -1 && static_cast<typename Sequence::size_type>(ii) == (size - 1) && jj == -1) { + std::copy(is.rbegin(), is.rend(), self->begin()); + } else { + throw std::invalid_argument("std::array object only supports setting a slice that is the size of the array"); + } + } + + template <class T, size_t N, class Difference> + inline void + delslice(std::array<T, N>* SWIGUNUSEDPARM(self), Difference SWIGUNUSEDPARM(i), Difference SWIGUNUSEDPARM(j), Py_ssize_t SWIGUNUSEDPARM(step)) { + throw std::invalid_argument("std::array object does not support item deletion"); + } + } +%} + +#define %swig_array_methods(Type...) %swig_sequence_methods_non_resizable(Type) +#define %swig_array_methods_val(Type...) %swig_sequence_methods_non_resizable_val(Type); + +%include <std/std_array.i> +
diff --git a/share/swig/3.0.12/python/std_auto_ptr.i b/share/swig/3.0.12/python/std_auto_ptr.i new file mode 100644 index 0000000..e310e00 --- /dev/null +++ b/share/swig/3.0.12/python/std_auto_ptr.i
@@ -0,0 +1,17 @@ +/* + The typemaps here allow to handle functions returning std::auto_ptr<>, + which is the most common use of this type. If you have functions taking it + as parameter, these typemaps can't be used for them and you need to do + something else (e.g. use shared_ptr<> which SWIG supports fully). + */ + +%define %auto_ptr(TYPE) +%typemap (out) std::auto_ptr<TYPE > %{ + %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); +%} +%template() std::auto_ptr<TYPE >; +%enddef + +namespace std { + template <class T> class auto_ptr {}; +}
diff --git a/share/swig/2.0.11/python/std_basic_string.i b/share/swig/3.0.12/python/std_basic_string.i similarity index 100% rename from share/swig/2.0.11/python/std_basic_string.i rename to share/swig/3.0.12/python/std_basic_string.i
diff --git a/share/swig/2.0.11/python/std_carray.i b/share/swig/3.0.12/python/std_carray.i similarity index 100% rename from share/swig/2.0.11/python/std_carray.i rename to share/swig/3.0.12/python/std_carray.i
diff --git a/share/swig/2.0.11/python/std_char_traits.i b/share/swig/3.0.12/python/std_char_traits.i similarity index 100% rename from share/swig/2.0.11/python/std_char_traits.i rename to share/swig/3.0.12/python/std_char_traits.i
diff --git a/share/swig/2.0.11/python/std_common.i b/share/swig/3.0.12/python/std_common.i similarity index 85% rename from share/swig/2.0.11/python/std_common.i rename to share/swig/3.0.12/python/std_common.i index 401bbde..6057662 100644 --- a/share/swig/2.0.11/python/std_common.i +++ b/share/swig/3.0.12/python/std_common.i
@@ -13,17 +13,17 @@ fragment=SWIG_From_frag(Type), fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef value_category category; static const char* type_name() { return #Type; } - }; - template <> struct traits_asval<Type > { + }; + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(PyObject *obj, value_type *val) { + static int asval(PyObject *obj, value_type *val) { return SWIG_AsVal(Type)(obj, val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static PyObject *from(const value_type& val) { return SWIG_From(Type)(val); @@ -46,13 +46,13 @@ fragment=SWIG_From_frag(int), fragment="StdTraits") { namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(PyObject *obj, value_type *val) { + static int asval(PyObject *obj, value_type *val) { return SWIG_AsVal(int)(obj, (int *)val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static PyObject *from(const value_type& val) { return SWIG_From(int)((int)val);
diff --git a/share/swig/2.0.11/python/std_complex.i b/share/swig/3.0.12/python/std_complex.i similarity index 100% rename from share/swig/2.0.11/python/std_complex.i rename to share/swig/3.0.12/python/std_complex.i
diff --git a/share/swig/2.0.11/python/std_container.i b/share/swig/3.0.12/python/std_container.i similarity index 100% rename from share/swig/2.0.11/python/std_container.i rename to share/swig/3.0.12/python/std_container.i
diff --git a/share/swig/2.0.11/python/std_deque.i b/share/swig/3.0.12/python/std_deque.i similarity index 100% rename from share/swig/2.0.11/python/std_deque.i rename to share/swig/3.0.12/python/std_deque.i
diff --git a/share/swig/2.0.11/python/std_except.i b/share/swig/3.0.12/python/std_except.i similarity index 100% rename from share/swig/2.0.11/python/std_except.i rename to share/swig/3.0.12/python/std_except.i
diff --git a/share/swig/2.0.11/python/std_ios.i b/share/swig/3.0.12/python/std_ios.i similarity index 100% rename from share/swig/2.0.11/python/std_ios.i rename to share/swig/3.0.12/python/std_ios.i
diff --git a/share/swig/2.0.11/python/std_iostream.i b/share/swig/3.0.12/python/std_iostream.i similarity index 100% rename from share/swig/2.0.11/python/std_iostream.i rename to share/swig/3.0.12/python/std_iostream.i
diff --git a/share/swig/2.0.11/python/std_list.i b/share/swig/3.0.12/python/std_list.i similarity index 100% rename from share/swig/2.0.11/python/std_list.i rename to share/swig/3.0.12/python/std_list.i
diff --git a/share/swig/2.0.11/python/std_map.i b/share/swig/3.0.12/python/std_map.i similarity index 87% rename from share/swig/2.0.11/python/std_map.i rename to share/swig/3.0.12/python/std_map.i index 66ed68d..f61f79c 100644 --- a/share/swig/2.0.11/python/std_map.i +++ b/share/swig/3.0.12/python/std_map.i
@@ -102,7 +102,8 @@ res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val); } else { map_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0); + swig_type_info *descriptor = swig::type_info<map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } SWIG_PYTHON_THREAD_END_BLOCK; @@ -119,10 +120,9 @@ static PyObject *asdict(const map_type& map) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; size_type size = map.size(); - int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1; + Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, - "map size not valid in python"); + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; } @@ -176,10 +176,14 @@ #else %extend { - %pythoncode {def __iter__(self): return self.key_iterator()} - %pythoncode {def iterkeys(self): return self.key_iterator()} - %pythoncode {def itervalues(self): return self.value_iterator()} - %pythoncode {def iteritems(self): return self.iterator()} + %pythoncode %{def __iter__(self): + return self.key_iterator()%} + %pythoncode %{def iterkeys(self): + return self.key_iterator()%} + %pythoncode %{def itervalues(self): + return self.value_iterator()%} + %pythoncode %{def iteritems(self): + return self.iterator()%} } #endif @@ -207,17 +211,16 @@ PyObject* keys() { Map::size_type size = self->size(); - int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1; + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; SWIG_PYTHON_THREAD_BEGIN_BLOCK; if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, - "map size not valid in python"); + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; } PyObject* keyList = PyList_New(pysize); Map::const_iterator i = self->begin(); - for (int j = 0; j < pysize; ++i, ++j) { + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { PyList_SET_ITEM(keyList, j, swig::from(i->first)); } SWIG_PYTHON_THREAD_END_BLOCK; @@ -226,17 +229,16 @@ PyObject* values() { Map::size_type size = self->size(); - int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1; + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; SWIG_PYTHON_THREAD_BEGIN_BLOCK; if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, - "map size not valid in python"); + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; } PyObject* valList = PyList_New(pysize); Map::const_iterator i = self->begin(); - for (int j = 0; j < pysize; ++i, ++j) { + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { PyList_SET_ITEM(valList, j, swig::from(i->second)); } SWIG_PYTHON_THREAD_END_BLOCK; @@ -245,17 +247,16 @@ PyObject* items() { Map::size_type size = self->size(); - int pysize = (size <= (Map::size_type) INT_MAX) ? (int) size : -1; + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; SWIG_PYTHON_THREAD_BEGIN_BLOCK; if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, - "map size not valid in python"); + PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; } PyObject* itemList = PyList_New(pysize); Map::const_iterator i = self->begin(); - for (int j = 0; j < pysize; ++i, ++j) { + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { PyList_SET_ITEM(itemList, j, swig::from(*i)); } SWIG_PYTHON_THREAD_END_BLOCK;
diff --git a/share/swig/2.0.11/python/std_multimap.i b/share/swig/3.0.12/python/std_multimap.i similarity index 87% rename from share/swig/2.0.11/python/std_multimap.i rename to share/swig/3.0.12/python/std_multimap.i index c81e2ac..3209fb0 100644 --- a/share/swig/2.0.11/python/std_multimap.i +++ b/share/swig/3.0.12/python/std_multimap.i
@@ -26,7 +26,8 @@ return traits_asptr_stdseq<std::multimap<K,T>, std::pair<K, T> >::asptr(items, val); } else { multimap_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<multimap_type>(),0); + swig_type_info *descriptor = swig::type_info<multimap_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } return res; @@ -45,11 +46,10 @@ return SWIG_InternalNewPointerObj(new multimap_type(multimap), desc, SWIG_POINTER_OWN); } else { size_type size = multimap.size(); - int pysize = (size <= (size_type) INT_MAX) ? (int) size : -1; + Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; if (pysize < 0) { SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(PyExc_OverflowError, - "multimap size not valid in python"); + PyErr_SetString(PyExc_OverflowError, "multimap size not valid in python"); SWIG_PYTHON_THREAD_END_BLOCK; return NULL; }
diff --git a/share/swig/2.0.11/python/std_multiset.i b/share/swig/3.0.12/python/std_multiset.i similarity index 100% rename from share/swig/2.0.11/python/std_multiset.i rename to share/swig/3.0.12/python/std_multiset.i
diff --git a/share/swig/2.0.11/python/std_pair.i b/share/swig/3.0.12/python/std_pair.i similarity index 88% rename from share/swig/2.0.11/python/std_pair.i rename to share/swig/3.0.12/python/std_pair.i index 7829695..172572b 100644 --- a/share/swig/2.0.11/python/std_pair.i +++ b/share/swig/3.0.12/python/std_pair.i
@@ -31,7 +31,7 @@ int res2 = swig::asval((PyObject*)second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; - } + } } static int asval(PyObject *obj, std::pair<T,U> *val) { @@ -48,7 +48,8 @@ } } else { value_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = *p; } return res; @@ -67,10 +68,16 @@ value_type *vp = %new_instance(std::pair<T,U>); T *pfirst = &(vp->first); int res1 = swig::asval((PyObject*)first, pfirst); - if (!SWIG_IsOK(res1)) return res1; + if (!SWIG_IsOK(res1)) { + %delete(vp); + return res1; + } U *psecond = &(vp->second); int res2 = swig::asval((PyObject*)second, psecond); - if (!SWIG_IsOK(res2)) return res2; + if (!SWIG_IsOK(res2)) { + %delete(vp); + return res2; + } *val = vp; return SWIG_AddNewMask(res1 > res2 ? res1 : res2); } else { @@ -81,7 +88,7 @@ int res2 = swig::asval((PyObject*)second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; - } + } } static int asptr(PyObject *obj, std::pair<T,U> **val) { @@ -98,7 +105,8 @@ } } else { value_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } return res; @@ -176,18 +184,20 @@ %define %swig_pair_methods(pair...) #if !defined(SWIGPYTHON_BUILTIN) %extend { -%pythoncode {def __len__(self): return 2 -def __repr__(self): return str((self.first, self.second)) +%pythoncode %{def __len__(self): + return 2 +def __repr__(self): + return str((self.first, self.second)) def __getitem__(self, index): - if not (index % 2): - return self.first - else: - return self.second + if not (index % 2): + return self.first + else: + return self.second def __setitem__(self, index, val): - if not (index % 2): - self.first = val - else: - self.second = val} + if not (index % 2): + self.first = val + else: + self.second = val%} } #endif %enddef
diff --git a/share/swig/2.0.11/python/std_set.i b/share/swig/3.0.12/python/std_set.i similarity index 100% rename from share/swig/2.0.11/python/std_set.i rename to share/swig/3.0.12/python/std_set.i
diff --git a/share/swig/2.0.11/python/std_shared_ptr.i b/share/swig/3.0.12/python/std_shared_ptr.i similarity index 100% rename from share/swig/2.0.11/python/std_shared_ptr.i rename to share/swig/3.0.12/python/std_shared_ptr.i
diff --git a/share/swig/2.0.11/python/std_sstream.i b/share/swig/3.0.12/python/std_sstream.i similarity index 100% rename from share/swig/2.0.11/python/std_sstream.i rename to share/swig/3.0.12/python/std_sstream.i
diff --git a/share/swig/2.0.11/python/std_streambuf.i b/share/swig/3.0.12/python/std_streambuf.i similarity index 100% rename from share/swig/2.0.11/python/std_streambuf.i rename to share/swig/3.0.12/python/std_streambuf.i
diff --git a/share/swig/2.0.11/python/std_string.i b/share/swig/3.0.12/python/std_string.i similarity index 100% rename from share/swig/2.0.11/python/std_string.i rename to share/swig/3.0.12/python/std_string.i
diff --git a/share/swig/3.0.12/python/std_unordered_map.i b/share/swig/3.0.12/python/std_unordered_map.i new file mode 100644 index 0000000..894840c --- /dev/null +++ b/share/swig/3.0.12/python/std_unordered_map.i
@@ -0,0 +1,259 @@ +/* + Unordered Maps +*/ + +%fragment("StdMapTraits","header",fragment="StdSequenceTraits") +{ + namespace swig { + template <class SwigPySeq, class K, class T > + inline void + assign(const SwigPySeq& swigpyseq, std::unordered_map<K,T > *unordered_map) { + typedef typename std::unordered_map<K,T>::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + unordered_map->insert(value_type(it->first, it->second)); + } + } + + template <class K, class T> + struct traits_reserve<std::unordered_map<K,T> > { + static void reserve(std::unordered_map<K,T> &seq, typename std::unordered_map<K,T>::size_type n) { + seq.reserve(n); + } + }; + + template <class K, class T> + struct traits_asptr<std::unordered_map<K,T> > { + typedef std::unordered_map<K,T> unordered_map_type; + static int asptr(PyObject *obj, unordered_map_type **val) { + int res = SWIG_ERROR; + if (PyDict_Check(obj)) { + SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); +%#if PY_VERSION_HEX >= 0x03000000 + /* In Python 3.x the ".items()" method return a dict_items object */ + items = PySequence_Fast(items, ".items() havn't returned a sequence!"); +%#endif + res = traits_asptr_stdseq<std::unordered_map<K,T>, std::pair<K, T> >::asptr(items, val); + } else { + unordered_map_type *p; + swig_type_info *descriptor = swig::type_info<unordered_map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + template <class K, class T > + struct traits_from<std::unordered_map<K,T> > { + typedef std::unordered_map<K,T> unordered_map_type; + typedef typename unordered_map_type::const_iterator const_iterator; + typedef typename unordered_map_type::size_type size_type; + + static PyObject *from(const unordered_map_type& unordered_map) { + swig_type_info *desc = swig::type_info<unordered_map_type>(); + if (desc && desc->clientdata) { + return SWIG_NewPointerObj(new unordered_map_type(unordered_map), desc, SWIG_POINTER_OWN); + } else { + size_type size = unordered_map.size(); + Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject *obj = PyDict_New(); + for (const_iterator i= unordered_map.begin(); i!= unordered_map.end(); ++i) { + swig::SwigVar_PyObject key = swig::from(i->first); + swig::SwigVar_PyObject val = swig::from(i->second); + PyDict_SetItem(obj, key, val); + } + return obj; + } + } + }; + + template <class ValueType> + struct from_key_oper + { + typedef const ValueType& argument_type; + typedef PyObject *result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.first); + } + }; + + template <class ValueType> + struct from_value_oper + { + typedef const ValueType& argument_type; + typedef PyObject *result_type; + result_type operator()(argument_type v) const + { + return swig::from(v.second); + } + }; + + template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type> + struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> + { + SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) + { + } + }; + + + template<class OutIterator, + class FromOper = from_key_oper<typename OutIterator::value_type> > + struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper> + { + SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + template<typename OutIter> + inline SwigPyIterator* + make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) + { + return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq); + } + + template<class OutIterator, + class FromOper = from_value_oper<typename OutIterator::value_type> > + struct SwigPyMapValueITerator_T : SwigPyMapIterator_T<OutIterator, FromOper> + { + SwigPyMapValueITerator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) + : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) + { + } + }; + + + template<typename OutIter> + inline SwigPyIterator* + make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) + { + return new SwigPyMapValueITerator_T<OutIter>(current, begin, end, seq); + } + } +} + +%define %swig_unordered_map_common(Map...) + %swig_sequence_iterator(Map); + %swig_container_methods(Map) + + %extend { + mapped_type __getitem__(const key_type& key) const throw (std::out_of_range) { + Map::const_iterator i = self->find(key); + if (i != self->end()) + return i->second; + else + throw std::out_of_range("key not found"); + } + + void __delitem__(const key_type& key) throw (std::out_of_range) { + Map::iterator i = self->find(key); + if (i != self->end()) + self->erase(i); + else + throw std::out_of_range("key not found"); + } + + bool has_key(const key_type& key) const { + Map::const_iterator i = self->find(key); + return i != self->end(); + } + + PyObject* keys() { + Map::size_type size = self->size(); + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* keyList = PyList_New(pysize); + Map::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(keyList, j, swig::from(i->first)); + } + return keyList; + } + + PyObject* values() { + Map::size_type size = self->size(); + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* valList = PyList_New(pysize); + Map::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(valList, j, swig::from(i->second)); + } + return valList; + } + + PyObject* items() { + Map::size_type size = self->size(); + Py_ssize_t pysize = (size <= (Map::size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(PyExc_OverflowError, "unordered_map size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject* itemList = PyList_New(pysize); + Map::const_iterator i = self->begin(); + for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { + PyList_SET_ITEM(itemList, j, swig::from(*i)); + } + return itemList; + } + + // Python 2.2 methods + bool __contains__(const key_type& key) { + return self->find(key) != self->end(); + } + + %newobject key_iterator(PyObject **PYTHON_SELF); + swig::SwigPyIterator* key_iterator(PyObject **PYTHON_SELF) { + return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } + + %newobject value_iterator(PyObject **PYTHON_SELF); + swig::SwigPyIterator* value_iterator(PyObject **PYTHON_SELF) { + return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); + } + + %pythoncode %{def __iter__(self): + return self.key_iterator()%} + %pythoncode %{def iterkeys(self): + return self.key_iterator()%} + %pythoncode %{def itervalues(self): + return self.value_iterator()%} + %pythoncode %{def iteritems(self): + return self.iterator()%} + } +%enddef + +%define %swig_unordered_map_methods(Map...) + %swig_unordered_map_common(Map) + %extend { + void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) { + (*self)[key] = x; + } + } +%enddef + + +%include <std/std_unordered_map.i>
diff --git a/share/swig/3.0.12/python/std_unordered_multimap.i b/share/swig/3.0.12/python/std_unordered_multimap.i new file mode 100644 index 0000000..2410aa5 --- /dev/null +++ b/share/swig/3.0.12/python/std_unordered_multimap.i
@@ -0,0 +1,86 @@ +/* + Unordered Multimaps +*/ +%include <std_unordered_map.i> + +%fragment("StdUnorderedMultimapTraits","header",fragment="StdSequenceTraits") +{ + namespace swig { + template <class SwigPySeq, class K, class T > + inline void + assign(const SwigPySeq& swigpyseq, std::unordered_multimap<K,T > *unordered_multimap) { + typedef typename std::unordered_multimap<K,T>::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + unordered_multimap->insert(value_type(it->first, it->second)); + } + } + + template <class K, class T> + struct traits_reserve<std::unordered_multimap<K,T> > { + static void reserve(std::unordered_multimap<K,T> &seq, typename std::unordered_multimap<K,T>::size_type n) { + seq.reserve(n); + } + }; + + template <class K, class T> + struct traits_asptr<std::unordered_multimap<K,T> > { + typedef std::unordered_multimap<K,T> unordered_multimap_type; + static int asptr(PyObject *obj, std::unordered_multimap<K,T> **val) { + int res = SWIG_ERROR; + if (PyDict_Check(obj)) { + SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); + return traits_asptr_stdseq<std::unordered_multimap<K,T>, std::pair<K, T> >::asptr(items, val); + } else { + unordered_multimap_type *p; + swig_type_info *descriptor = swig::type_info<unordered_multimap_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; + if (SWIG_IsOK(res) && val) *val = p; + } + return res; + } + }; + + template <class K, class T > + struct traits_from<std::unordered_multimap<K,T> > { + typedef std::unordered_multimap<K,T> unordered_multimap_type; + typedef typename unordered_multimap_type::const_iterator const_iterator; + typedef typename unordered_multimap_type::size_type size_type; + + static PyObject *from(const unordered_multimap_type& unordered_multimap) { + swig_type_info *desc = swig::type_info<unordered_multimap_type>(); + if (desc && desc->clientdata) { + return SWIG_NewPointerObj(new unordered_multimap_type(unordered_multimap), desc, SWIG_POINTER_OWN); + } else { + size_type size = unordered_multimap.size(); + Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; + if (pysize < 0) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(PyExc_OverflowError, "unordered_multimap size not valid in python"); + SWIG_PYTHON_THREAD_END_BLOCK; + return NULL; + } + PyObject *obj = PyDict_New(); + for (const_iterator i= unordered_multimap.begin(); i!= unordered_multimap.end(); ++i) { + swig::SwigVar_PyObject key = swig::from(i->first); + swig::SwigVar_PyObject val = swig::from(i->second); + PyDict_SetItem(obj, key, val); + } + return obj; + } + } + }; + } +} + +%define %swig_unordered_multimap_methods(Type...) + %swig_map_common(Type); + %extend { + void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) { + self->insert(Type::value_type(key,x)); + } + } +%enddef + +%include <std/std_unordered_multimap.i> +
diff --git a/share/swig/3.0.12/python/std_unordered_multiset.i b/share/swig/3.0.12/python/std_unordered_multiset.i new file mode 100644 index 0000000..0d9f3d9 --- /dev/null +++ b/share/swig/3.0.12/python/std_unordered_multiset.i
@@ -0,0 +1,48 @@ +/* + Unordered Multisets +*/ + +%include <std_unordered_set.i> + +%fragment("StdUnorderedMultisetTraits","header",fragment="StdSequenceTraits") +%{ + namespace swig { + template <class SwigPySeq, class T> + inline void + assign(const SwigPySeq& swigpyseq, std::unordered_multiset<T>* seq) { + // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented + typedef typename SwigPySeq::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + seq->insert(seq->end(),(value_type)(*it)); + } + } + + template <class T> + struct traits_reserve<std::unordered_multiset<T> > { + static void reserve(std::unordered_multiset<T> &seq, typename std::unordered_multiset<T>::size_type n) { + seq.reserve(n); + } + }; + + template <class T> + struct traits_asptr<std::unordered_multiset<T> > { + static int asptr(PyObject *obj, std::unordered_multiset<T> **m) { + return traits_asptr_stdseq<std::unordered_multiset<T> >::asptr(obj, m); + } + }; + + template <class T> + struct traits_from<std::unordered_multiset<T> > { + static PyObject *from(const std::unordered_multiset<T>& vec) { + return traits_from_stdseq<std::unordered_multiset<T> >::from(vec); + } + }; + } +%} + +#define %swig_unordered_multiset_methods(Set...) %swig_set_methods(Set) + + + +%include <std/std_unordered_multiset.i>
diff --git a/share/swig/3.0.12/python/std_unordered_set.i b/share/swig/3.0.12/python/std_unordered_set.i new file mode 100644 index 0000000..855a28d --- /dev/null +++ b/share/swig/3.0.12/python/std_unordered_set.i
@@ -0,0 +1,62 @@ +/* + Unordered Sets +*/ + +%fragment("StdUnorderedSetTraits","header",fragment="StdSequenceTraits") +%{ + namespace swig { + template <class SwigPySeq, class T> + inline void + assign(const SwigPySeq& swigpyseq, std::unordered_set<T>* seq) { + // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented + typedef typename SwigPySeq::value_type value_type; + typename SwigPySeq::const_iterator it = swigpyseq.begin(); + for (;it != swigpyseq.end(); ++it) { + seq->insert(seq->end(),(value_type)(*it)); + } + } + + template <class T> + struct traits_reserve<std::unordered_set<T> > { + static void reserve(std::unordered_set<T> &seq, typename std::unordered_set<T>::size_type n) { + seq.reserve(n); + } + }; + + template <class T> + struct traits_asptr<std::unordered_set<T> > { + static int asptr(PyObject *obj, std::unordered_set<T> **s) { + return traits_asptr_stdseq<std::unordered_set<T> >::asptr(obj, s); + } + }; + + template <class T> + struct traits_from<std::unordered_set<T> > { + static PyObject *from(const std::unordered_set<T>& vec) { + return traits_from_stdseq<std::unordered_set<T> >::from(vec); + } + }; + } +%} + +%define %swig_unordered_set_methods(unordered_set...) + %swig_sequence_iterator(unordered_set); + %swig_container_methods(unordered_set); + + %extend { + void append(value_type x) { + self->insert(x); + } + + bool __contains__(value_type x) { + return self->find(x) != self->end(); + } + + value_type __getitem__(difference_type i) const throw (std::out_of_range) { + return *(swig::cgetpos(self, i)); + } + + }; +%enddef + +%include <std/std_unordered_set.i>
diff --git a/share/swig/2.0.11/python/std_vector.i b/share/swig/3.0.12/python/std_vector.i similarity index 77% rename from share/swig/2.0.11/python/std_vector.i rename to share/swig/3.0.12/python/std_vector.i index 3f04a30..2ac41a5 100644 --- a/share/swig/2.0.11/python/std_vector.i +++ b/share/swig/3.0.12/python/std_vector.i
@@ -6,6 +6,13 @@ %{ namespace swig { template <class T> + struct traits_reserve<std::vector<T> > { + static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) { + seq.reserve(n); + } + }; + + template <class T> struct traits_asptr<std::vector<T> > { static int asptr(PyObject *obj, std::vector<T> **vec) { return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
diff --git a/share/swig/2.0.11/python/std_vectora.i b/share/swig/3.0.12/python/std_vectora.i similarity index 100% rename from share/swig/2.0.11/python/std_vectora.i rename to share/swig/3.0.12/python/std_vectora.i
diff --git a/share/swig/2.0.11/python/std_wios.i b/share/swig/3.0.12/python/std_wios.i similarity index 100% rename from share/swig/2.0.11/python/std_wios.i rename to share/swig/3.0.12/python/std_wios.i
diff --git a/share/swig/2.0.11/python/std_wiostream.i b/share/swig/3.0.12/python/std_wiostream.i similarity index 100% rename from share/swig/2.0.11/python/std_wiostream.i rename to share/swig/3.0.12/python/std_wiostream.i
diff --git a/share/swig/2.0.11/python/std_wsstream.i b/share/swig/3.0.12/python/std_wsstream.i similarity index 100% rename from share/swig/2.0.11/python/std_wsstream.i rename to share/swig/3.0.12/python/std_wsstream.i
diff --git a/share/swig/2.0.11/python/std_wstreambuf.i b/share/swig/3.0.12/python/std_wstreambuf.i similarity index 100% rename from share/swig/2.0.11/python/std_wstreambuf.i rename to share/swig/3.0.12/python/std_wstreambuf.i
diff --git a/share/swig/2.0.11/python/std_wstring.i b/share/swig/3.0.12/python/std_wstring.i similarity index 100% rename from share/swig/2.0.11/python/std_wstring.i rename to share/swig/3.0.12/python/std_wstring.i
diff --git a/share/swig/2.0.11/python/stl.i b/share/swig/3.0.12/python/stl.i similarity index 100% rename from share/swig/2.0.11/python/stl.i rename to share/swig/3.0.12/python/stl.i
diff --git a/share/swig/2.0.11/python/typemaps.i b/share/swig/3.0.12/python/typemaps.i similarity index 100% rename from share/swig/2.0.11/python/typemaps.i rename to share/swig/3.0.12/python/typemaps.i
diff --git a/share/swig/2.0.11/python/wchar.i b/share/swig/3.0.12/python/wchar.i similarity index 100% rename from share/swig/2.0.11/python/wchar.i rename to share/swig/3.0.12/python/wchar.i
diff --git a/share/swig/2.0.11/r/boost_shared_ptr.i b/share/swig/3.0.12/r/boost_shared_ptr.i similarity index 98% rename from share/swig/2.0.11/r/boost_shared_ptr.i rename to share/swig/3.0.12/r/boost_shared_ptr.i index 17e9cfe..8ef8d2e 100644 --- a/share/swig/2.0.11/r/boost_shared_ptr.i +++ b/share/swig/3.0.12/r/boost_shared_ptr.i
@@ -40,7 +40,7 @@ %variable_fail(res, "$type", "$name"); } if (!argp) { - %argument_nullref("$type", $symname, $argnum); + %variable_nullref("$type", "$name"); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); @@ -124,7 +124,9 @@ %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; - if (!argp) { %argument_nullref("$type", $symname, $argnum); } + if (!argp) { + %variable_nullref("$type", "$name"); + } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
diff --git a/share/swig/2.0.11/r/cdata.i b/share/swig/3.0.12/r/cdata.i similarity index 100% rename from share/swig/2.0.11/r/cdata.i rename to share/swig/3.0.12/r/cdata.i
diff --git a/share/swig/2.0.11/r/exception.i b/share/swig/3.0.12/r/exception.i similarity index 100% rename from share/swig/2.0.11/r/exception.i rename to share/swig/3.0.12/r/exception.i
diff --git a/share/swig/2.0.11/r/r.swg b/share/swig/3.0.12/r/r.swg similarity index 97% rename from share/swig/2.0.11/r/r.swg rename to share/swig/3.0.12/r/r.swg index 126611d..cf1cfc8 100644 --- a/share/swig/2.0.11/r/r.swg +++ b/share/swig/3.0.12/r/r.swg
@@ -264,8 +264,8 @@ setAs('ExternalReference', 'character', function(from) {if (!is.null(from$"__str__")) from$"__str__"()}) -setMethod('print', 'ExternalReference', -function(x) {print(as(x, "character"))}) +suppressMessages(suppressWarnings(setMethod('print', 'ExternalReference', +function(x) {print(as(x, "character"))}))) %}
diff --git a/share/swig/2.0.11/r/rcontainer.swg b/share/swig/3.0.12/r/rcontainer.swg similarity index 100% rename from share/swig/2.0.11/r/rcontainer.swg rename to share/swig/3.0.12/r/rcontainer.swg
diff --git a/share/swig/2.0.11/r/rfragments.swg b/share/swig/3.0.12/r/rfragments.swg similarity index 88% rename from share/swig/2.0.11/r/rfragments.swg rename to share/swig/3.0.12/r/rfragments.swg index afb75c3..b89212b 100644 --- a/share/swig/2.0.11/r/rfragments.swg +++ b/share/swig/3.0.12/r/rfragments.swg
@@ -44,21 +44,27 @@ } -%fragment(SWIG_From_frag(long long),"header") { +%fragment(SWIG_From_frag(long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE SEXP SWIG_From_dec(long long)(long long value) { return Rf_ScalarInteger((int)value); } +%#endif } -%fragment(SWIG_AsVal_frag(long long),"header") { +%fragment(SWIG_AsVal_frag(long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE int SWIG_AsVal_dec(long long)(SEXP obj, long long *val) { if (val) *val = Rf_asInteger(obj); return SWIG_OK; } +%#endif } %fragment(SWIG_From_frag(unsigned long),"header") { @@ -80,22 +86,28 @@ } -%fragment(SWIG_From_frag(unsigned long long),"header") { +%fragment(SWIG_From_frag(unsigned long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE SEXP SWIG_From_dec(unsigned long long)(unsigned long long value) { return Rf_ScalarInteger((int)value); } +%#endif } -%fragment(SWIG_AsVal_frag(unsigned long long),"header") { +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE int SWIG_AsVal_dec(unsigned long long)(SEXP obj, unsigned long long *val) { if (val) *val = Rf_asInteger(obj); return SWIG_OK; } +%#endif } %fragment(SWIG_From_frag(double),"header") { @@ -153,7 +165,7 @@ } } -# This is modified from the R header files +//# This is modified from the R header files %fragment("SWIG_FromCharPtrAndSize","header") {
diff --git a/share/swig/2.0.11/r/rkw.swg b/share/swig/3.0.12/r/rkw.swg similarity index 77% rename from share/swig/2.0.11/r/rkw.swg rename to share/swig/3.0.12/r/rkw.swg index 2c181fa..074d7df 100644 --- a/share/swig/2.0.11/r/rkw.swg +++ b/share/swig/3.0.12/r/rkw.swg
@@ -3,6 +3,7 @@ */ #define RKW(x) %keywordwarn("'" `x` "' is a R keyword, renaming to '_" `x`"'", rename="_%s") `x` +#define RSWIGKW(x) %keywordwarn("'" `x` "' is a SWIG R reserved parameter name, renaming to '_" `x`"'", rename="_%s") `x` /* Warnings for R reserved words taken from @@ -29,4 +30,7 @@ RKW(NA_complex_); RKW(NA_character_); +RSWIGKW(self); + #undef RKW +#undef RSWIGKW
diff --git a/share/swig/3.0.12/r/ropers.swg b/share/swig/3.0.12/r/ropers.swg new file mode 100644 index 0000000..acb9979 --- /dev/null +++ b/share/swig/3.0.12/r/ropers.swg
@@ -0,0 +1,32 @@ +#ifdef __cplusplus + +%rename(Equal) operator =; +%rename(PlusEqual) operator +=; +%rename(MinusEqual) operator -=; +%rename(MultiplyEqual) operator *=; +%rename(DivideEqual) operator /=; +%rename(PercentEqual) operator %=; +%rename(Plus) operator +; +%rename(Minus) operator -; +%rename(Multiply) operator *; +%rename(Divide) operator /; +%rename(Percent) operator %; +%rename(Not) operator !; +%rename(IndexIntoConst) operator[](unsigned idx) const; +%rename(IndexInto) operator[](unsigned idx); +%rename(Functor) operator (); +%rename(EqualEqual) operator ==; +%rename(NotEqual) operator !=; +%rename(LessThan) operator <; +%rename(LessThanEqual) operator <=; +%rename(GreaterThan) operator >; +%rename(GreaterThanEqual) operator >=; +%rename(And) operator &&; +%rename(Or) operator ||; +%rename(PlusPlusPrefix) operator++(); +%rename(PlusPlusPostfix) operator++(int); +%rename(MinusMinusPrefix) operator--(); +%rename(MinusMinusPostfix) operator--(int); + + +#endif
diff --git a/share/swig/2.0.11/r/rrun.swg b/share/swig/3.0.12/r/rrun.swg similarity index 98% rename from share/swig/2.0.11/r/rrun.swg rename to share/swig/3.0.12/r/rrun.swg index f8bc9f4..81f6461 100644 --- a/share/swig/2.0.11/r/rrun.swg +++ b/share/swig/3.0.12/r/rrun.swg
@@ -1,14 +1,4 @@ -#ifdef __cplusplus -extern "C" { -#endif - -/* for raw pointer */ -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags) - - /* Remove global namespace pollution */ #if !defined(SWIG_NO_R_NO_REMAP) # define R_NO_REMAP @@ -19,6 +9,18 @@ #include <Rdefines.h> #include <Rversion.h> + +#ifdef __cplusplus +#include <exception> +extern "C" { +#endif + +/* for raw pointer */ +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags) + +#include <stdio.h> #include <stdlib.h> #include <assert.h> @@ -217,10 +219,6 @@ SWIG_MakePtr(void *ptr, const char *typeName, R_SWIG_Owner owner) { SEXP external, r_obj; - const char *p = typeName; - - if(typeName[0] == '_') - p = typeName + 1; Rf_protect(external = R_MakeExternalPtr(ptr, Rf_install(typeName), R_NilValue)); Rf_protect(r_obj = NEW_OBJECT(MAKE_CLASS((char *) typeName))); @@ -369,7 +367,6 @@ } #ifdef __cplusplus -#include <exception> #define SWIG_exception_noreturn(code, msg) do { throw std::runtime_error(msg); } while(0) #else #define SWIG_exception_noreturn(code, msg) do { return result; } while(0)
diff --git a/share/swig/2.0.11/r/rstdcommon.swg b/share/swig/3.0.12/r/rstdcommon.swg similarity index 96% rename from share/swig/2.0.11/r/rstdcommon.swg rename to share/swig/3.0.12/r/rstdcommon.swg index b11cf67..e6c873a 100644 --- a/share/swig/2.0.11/r/rstdcommon.swg +++ b/share/swig/3.0.12/r/rstdcommon.swg
@@ -40,7 +40,8 @@ struct traits_asptr { static int asptr(SWIG_Object obj, Type **val) { Type *p; - int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = p; }
diff --git a/share/swig/2.0.11/r/rtype.swg b/share/swig/3.0.12/r/rtype.swg similarity index 89% rename from share/swig/2.0.11/r/rtype.swg rename to share/swig/3.0.12/r/rtype.swg index b86a618..22639f2 100644 --- a/share/swig/2.0.11/r/rtype.swg +++ b/share/swig/3.0.12/r/rtype.swg
@@ -16,9 +16,11 @@ %typemap("rtype") enum SWIGTYPE * "character"; %typemap("rtype") enum SWIGTYPE *const "character"; %typemap("rtype") enum SWIGTYPE & "character"; +%typemap("rtype") enum SWIGTYPE && "character"; %typemap("rtype") SWIGTYPE * "$R_class"; %typemap("rtype") SWIGTYPE *const "$R_class"; %typemap("rtype") SWIGTYPE & "$R_class"; +%typemap("rtype") SWIGTYPE && "$R_class"; %typemap("rtype") SWIGTYPE "$&R_class"; %typemap("rtypecheck") int, int &, long, long & @@ -85,12 +87,14 @@ %{ $input = enumToInteger($input, "$R_class"); %} %typemap(scoercein) enum SWIGTYPE & %{ $input = enumToInteger($input, "$R_class"); %} +%typemap(scoercein) enum SWIGTYPE && + %{ $input = enumToInteger($input, "$R_class"); %} %typemap(scoercein) enum SWIGTYPE * %{ $input = enumToInteger($input, "$R_class"); %} %typemap(scoercein) enum SWIGTYPE *const %{ $input = enumToInteger($input, "$R_class"); %} -%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE & +%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE && %{ if (inherits($input, "ExternalReference")) $input = slot($input,"ref") %} /* @@ -100,6 +104,9 @@ %typemap(scoercein) SWIGTYPE & %{ $input = coerceIfNotSubclass($input, "$R_class") %} +%typemap(scoercein) SWIGTYPE && + %{ $input = coerceIfNotSubclass($input, "$R_class") %} + %typemap(scoercein) SWIGTYPE %{ $input = coerceIfNotSubclass($input, "$&R_class") %} */ @@ -133,37 +140,31 @@ %typemap(scoerceout) enum SWIGTYPE & %{ $result = enumFromInteger($result, "$R_class"); %} +%typemap(scoerceout) enum SWIGTYPE && + %{ $result = enumFromInteger($result, "$R_class"); %} + %typemap(scoerceout) enum SWIGTYPE * %{ $result = enumToInteger($result, "$R_class"); %} %typemap(scoerceout) enum SWIGTYPE *const %{ $result = enumToInteger($result, "$R_class"); %} -#%typemap(scoerceout) SWIGTYPE -# %{ class($result) <- "$&R_class"; %} +%typemap(scoerceout) SEXP %{ %} -#%typemap(scoerceout) SWIGTYPE & -# %{ class($result) <- "$R_class"; %} - -#%typemap(scoerceout) SWIGTYPE * -# %{ class($result) <- "$R_class"; %} - -#%typemap(scoerceout) SWIGTYPE *const -# %{ class($result) <- "$R_class"; %} - - %typemap(scoerceout) SEXP %{ %} - - %typemap(scoerceout) SWIGTYPE - %{ $result <- new("$&R_class", ref=$result); %} +%typemap(scoerceout) SWIGTYPE + %{ $result <- new("$&R_class", ref=$result); %} - %typemap(scoerceout) SWIGTYPE & - %{ $result <- new("$R_class", ref=$result) ; %} +%typemap(scoerceout) SWIGTYPE & + %{ $result <- new("$R_class", ref=$result) ; %} - %typemap(scoerceout) SWIGTYPE * - %{ $result <- new("$R_class", ref=$result) ; %} +%typemap(scoerceout) SWIGTYPE && + %{ $result <- new("$R_class", ref=$result) ; %} - %typemap(scoerceout) SWIGTYPE *const - %{ $result <- new("$R_class", ref=$result) ; %} +%typemap(scoerceout) SWIGTYPE * + %{ $result <- new("$R_class", ref=$result) ; %} + +%typemap(scoerceout) SWIGTYPE *const + %{ $result <- new("$R_class", ref=$result) ; %} /* Override the SWIGTYPE * above. */
diff --git a/share/swig/2.0.11/r/srun.swg b/share/swig/3.0.12/r/srun.swg similarity index 97% rename from share/swig/2.0.11/r/srun.swg rename to share/swig/3.0.12/r/srun.swg index 71a508d..2045ab9 100644 --- a/share/swig/2.0.11/r/srun.swg +++ b/share/swig/3.0.12/r/srun.swg
@@ -62,7 +62,7 @@ if(!isGeneric("copyToC")) setGeneric("copyToC", - function(value, obj = RSWIG_createNewRef(class(value))) + function(value, obj = SWIG_createNewRef(class(value))) standardGeneric("copyToC" )) @@ -147,4 +147,4 @@ } -####################################################################### \ No newline at end of file +#######################################################################
diff --git a/share/swig/2.0.11/r/std_alloc.i b/share/swig/3.0.12/r/std_alloc.i similarity index 100% rename from share/swig/2.0.11/r/std_alloc.i rename to share/swig/3.0.12/r/std_alloc.i
diff --git a/share/swig/2.0.11/r/std_common.i b/share/swig/3.0.12/r/std_common.i similarity index 85% rename from share/swig/2.0.11/r/std_common.i rename to share/swig/3.0.12/r/std_common.i index 8e97521..cda2623 100644 --- a/share/swig/2.0.11/r/std_common.i +++ b/share/swig/3.0.12/r/std_common.i
@@ -12,17 +12,17 @@ fragment=SWIG_From_frag(Type), fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef value_category category; static const char* type_name() { return #Type; } - }; - template <> struct traits_asval<Type > { + }; + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(SEXP obj, value_type *val) { + static int asval(SEXP obj, value_type *val) { return SWIG_AsVal(Type)(obj, val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static SEXP from(const value_type& val) { return SWIG_From(Type)(val); @@ -45,13 +45,13 @@ fragment=SWIG_From_frag(int), fragment="StdTraits") { namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(SEXP obj, value_type *val) { + static int asval(SEXP obj, value_type *val) { return SWIG_AsVal(int)(obj, (int *)val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static SEXP from(const value_type& val) { return SWIG_From(int)((int)val);
diff --git a/share/swig/2.0.11/r/std_container.i b/share/swig/3.0.12/r/std_container.i similarity index 100% rename from share/swig/2.0.11/r/std_container.i rename to share/swig/3.0.12/r/std_container.i
diff --git a/share/swig/2.0.11/r/std_deque.i b/share/swig/3.0.12/r/std_deque.i similarity index 100% rename from share/swig/2.0.11/r/std_deque.i rename to share/swig/3.0.12/r/std_deque.i
diff --git a/share/swig/2.0.11/r/std_except.i b/share/swig/3.0.12/r/std_except.i similarity index 100% rename from share/swig/2.0.11/r/std_except.i rename to share/swig/3.0.12/r/std_except.i
diff --git a/share/swig/2.0.11/r/std_list.i b/share/swig/3.0.12/r/std_list.i similarity index 100% rename from share/swig/2.0.11/r/std_list.i rename to share/swig/3.0.12/r/std_list.i
diff --git a/share/swig/2.0.11/r/std_map.i b/share/swig/3.0.12/r/std_map.i similarity index 100% rename from share/swig/2.0.11/r/std_map.i rename to share/swig/3.0.12/r/std_map.i
diff --git a/share/swig/2.0.11/r/std_pair.i b/share/swig/3.0.12/r/std_pair.i similarity index 100% rename from share/swig/2.0.11/r/std_pair.i rename to share/swig/3.0.12/r/std_pair.i
diff --git a/share/swig/2.0.11/r/std_string.i b/share/swig/3.0.12/r/std_string.i similarity index 100% rename from share/swig/2.0.11/r/std_string.i rename to share/swig/3.0.12/r/std_string.i
diff --git a/share/swig/3.0.12/r/std_vector.i b/share/swig/3.0.12/r/std_vector.i new file mode 100644 index 0000000..4ec51dc --- /dev/null +++ b/share/swig/3.0.12/r/std_vector.i
@@ -0,0 +1,1073 @@ +// R specific swig components +/* + Vectors +*/ + +%fragment("StdVectorTraits","header",fragment="StdSequenceTraits") +%{ + namespace swig { + // vectors of doubles + template <> + struct traits_from_ptr<std::vector<double> > { + static SEXP from (std::vector<double > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(REALSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + NUMERIC_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of floats + template <> + struct traits_from_ptr<std::vector<float> > { + static SEXP from (std::vector<float > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(REALSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + NUMERIC_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of unsigned 8bit int + template <> + struct traits_from_ptr<std::vector<unsigned char> > { + static SEXP from (std::vector<unsigned char > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of 8bit int + template <> + struct traits_from_ptr<std::vector<signed char> > { + static SEXP from (std::vector<signed char > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of unsigned 16bit int + template <> + struct traits_from_ptr<std::vector<unsigned short int> > { + static SEXP from (std::vector<unsigned short int > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of 16bit int + template <> + struct traits_from_ptr<std::vector<short int> > { + static SEXP from (std::vector<short int > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of 32 bit unsigned int + template <> + struct traits_from_ptr<std::vector<unsigned int> > { + static SEXP from (std::vector<unsigned int> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of 32bit int + template <> + struct traits_from_ptr<std::vector<int> > { + static SEXP from (std::vector<int > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of 64 bit unsigned int +#if defined(SWIGWORDSIZE64) + template <> + struct traits_from_ptr<std::vector<unsigned long int> > { + static SEXP from (std::vector<unsigned long int> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of 64 bit int + template <> + struct traits_from_ptr<std::vector<long int> > { + static SEXP from (std::vector<long int> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; +#else + template <> + struct traits_from_ptr<std::vector<unsigned long long int> > { + static SEXP from (std::vector<unsigned long long int> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + // vectors of 64 bit int + template <> + struct traits_from_ptr<std::vector<long long int> > { + static SEXP from (std::vector<long long int> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(INTSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + INTEGER_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; +#endif + // vectors of bool + template <> + struct traits_from_ptr<std::vector<bool> > { + static SEXP from (std::vector<bool> *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(LGLSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + LOGICAL_POINTER(result)[pos] = ((*val)[pos]); + } + UNPROTECT(1); + return(result); + } + }; + + // vectors of strings + template <> + struct traits_from_ptr<std::vector<std::basic_string<char> > > { + static SEXP from (std::vector<std::basic_string<char> > *val, int owner = 0) { + SEXP result; + PROTECT(result = Rf_allocVector(STRSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + CHARACTER_POINTER(result)[pos] = Rf_mkChar(((*val)[pos]).c_str()); + } + UNPROTECT(1); + return(result); + } + }; + + // catch all that does everything with vectors + template <typename T> + struct traits_from_ptr< std::vector< T > > { + static SEXP from (std::vector< T > *val, int owner = 0) { + return SWIG_R_NewPointerObj(val, type_info< std::vector< T > >(), owner); + } + }; + ///////////////////////////////////////////////// + template <> + struct traits_asptr < std::vector<double> > { + static int asptr(SEXP obj, std::vector<double> **val) { + std::vector<double> *p; + // not sure how to check the size of the SEXP obj is correct + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<double>(sexpsz); + double *S = NUMERIC_POINTER(obj); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<double>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <> + struct traits_asptr < std::vector<float> > { + static int asptr(SEXP obj, std::vector<float> **val) { + std::vector<float> *p; + // not sure how to check the size of the SEXP obj is correct + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<float>(sexpsz); + double *S = NUMERIC_POINTER(obj); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<double>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + // 8 bit integer types + template <> + struct traits_asptr < std::vector<unsigned char> > { + static int asptr(SEXP obj, std::vector<unsigned char> **val) { + std::vector<unsigned char> *p; + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<unsigned char>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<unsigned char>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<signed char> > { + static int asptr(SEXP obj, std::vector<signed char> **val) { + std::vector<signed char> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<signed char>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<signed char>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + // 16 bit integer types + template <> + struct traits_asptr < std::vector<unsigned short int> > { + static int asptr(SEXP obj, std::vector<unsigned short int> **val) { + std::vector<unsigned short int> *p; + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<unsigned short int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<unsigned short int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<short int> > { + static int asptr(SEXP obj, std::vector<short int> **val) { + std::vector<short int> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<short int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<short int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + // 32 bit integer types + template <> + struct traits_asptr < std::vector<unsigned int> > { + static int asptr(SEXP obj, std::vector<unsigned int> **val) { + std::vector<unsigned int> *p; + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<unsigned int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<unsigned int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<int> > { + static int asptr(SEXP obj, std::vector<int> **val) { + std::vector<int> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + +#if defined(SWIGWORDSIZE64) + // 64 bit integer types + template <> + struct traits_asptr < std::vector<unsigned long int> > { + static int asptr(SEXP obj, std::vector<unsigned long int> **val) { + std::vector<unsigned long int> *p; + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<unsigned long int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<unsigned long int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<long int> > { + static int asptr(SEXP obj, std::vector<long int> **val) { + std::vector<long int> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<long int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<long int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + +#else + // 64 bit integer types + template <> + struct traits_asptr < std::vector<unsigned long long int> > { + static int asptr(SEXP obj, std::vector<unsigned long long int> **val) { + std::vector<unsigned long long int> *p; + unsigned int sexpsz = Rf_length(obj); + p = new std::vector<unsigned long long int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<unsigned long long int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<long long int> > { + static int asptr(SEXP obj, std::vector<long long int> **val) { + std::vector<long long int> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<long long int>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); + int *S = INTEGER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<long long int>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + +#endif + + template <> + struct traits_asptr < std::vector<bool> > { + static int asptr(SEXP obj, std::vector<bool> **val) { + std::vector<bool> *p; + // not sure how to check the size of the SEXP obj is correct + int sexpsz = Rf_length(obj); + p = new std::vector<bool>(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, LGLSXP)); + int *S = LOGICAL_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + (*p)[pos] = static_cast<bool>(S[pos]); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + template <> + struct traits_asptr < std::vector<std::basic_string<char> > > { + static int asptr(SEXP obj, std::vector<std::basic_string<char> > **val) { + std::vector<std::basic_string<char> > *p; + // R character vectors are STRSXP containing CHARSXP + // access a CHARSXP using STRING_ELT + int sexpsz = Rf_length(obj); + p = new std::vector<std::basic_string<char> >(sexpsz); + SEXP coerced; + PROTECT(coerced = Rf_coerceVector(obj, STRSXP)); + //SEXP *S = CHARACTER_POINTER(coerced); + for (unsigned pos = 0; pos < p->size(); pos++) + { + const char * thecstring = CHAR(STRING_ELT(coerced, pos)); + (*p)[pos] = std::basic_string<char>(thecstring); + } + int res = SWIG_OK; + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + UNPROTECT(1); + return res; + } + }; + + // catchall for R to vector conversion + template <typename T> + struct traits_asptr < std::vector<T> > { + static int asptr(SEXP obj, std::vector<T> **val) { + std::vector<T> *p; + int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0); + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + // now for vectors of vectors. These will be represented as lists of vectors on the + // catch all that does everything with vectors + template <> + struct traits_from_ptr<std::vector<std::vector<unsigned int> > > { + static SEXP from (std::vector< std::vector<unsigned int> > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); + } + } + UNPROTECT(1); + return(result); + } + }; + + + template <> + struct traits_from_ptr<std::vector<std::vector<int> > > { + static SEXP from (std::vector< std::vector<int > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); + } + } + UNPROTECT(1); + return(result); + } + }; + + template <> + struct traits_from_ptr<std::vector<std::vector<float> > > { + static SEXP from (std::vector< std::vector<float > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); + } + } + UNPROTECT(1); + return(result); + } + }; + + template <> + struct traits_from_ptr<std::vector<std::vector<double> > > { + static SEXP from (std::vector< std::vector<double > > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); + } + } + UNPROTECT(1); + return(result); + } + }; + + template <> + struct traits_from_ptr<std::vector<std::vector<bool> > > { + static SEXP from (std::vector< std::vector<bool> > *val, int owner = 0) { + SEXP result; + // allocate the R list + PROTECT(result = Rf_allocVector(VECSXP, val->size())); + for (unsigned pos = 0; pos < val->size(); pos++) + { + // allocate the R vector + SET_VECTOR_ELT(result, pos, Rf_allocVector(LGLSXP, val->at(pos).size())); + // Fill the R vector + for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) + { + LOGICAL_POINTER(VECTOR_ELT(result, pos))[vpos] = (val->at(pos).at(vpos)); + } + } + UNPROTECT(1); + return(result); + } + }; + + template <typename T> + struct traits_from_ptr< std::vector < std::vector< T > > > { + static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { + return SWIG_R_NewPointerObj(val, type_info< std::vector < std::vector< T > > >(), owner); + } + }; + + ///////////////////////////////////////////////////////////////// + + // R side + template <> + struct traits_asptr < std::vector< std::vector<unsigned int> > > { + static int asptr(SEXP obj, std::vector< std::vector<unsigned int> > **val) { + std::vector <std::vector<unsigned int> > *p; + // this is the length of the list + unsigned int sexpsz = Rf_length(obj); + p = new std::vector< std::vector<unsigned int> > (sexpsz); + + for (unsigned listpos = 0; listpos < sexpsz; ++listpos) + { + unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); + for (unsigned vpos = 0; vpos < vecsize; ++vpos) + { + (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); + } + } + + int res = SWIG_OK; + + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <> + struct traits_asptr < std::vector< std::vector< int> > > { + static int asptr(SEXP obj, std::vector< std::vector< int> > **val) { + std::vector <std::vector< int> > *p; + // this is the length of the list + unsigned int sexpsz = Rf_length(obj); + p = new std::vector< std::vector< int> > (sexpsz); + + for (unsigned listpos = 0; listpos < sexpsz; ++listpos) + { + unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); + for (unsigned vpos = 0; vpos < vecsize; ++vpos) + { + (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); + } + } + + int res = SWIG_OK; + + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <> + struct traits_asptr < std::vector< std::vector< float> > > { + static int asptr(SEXP obj, std::vector< std::vector< float> > **val) { + std::vector <std::vector< float> > *p; + // this is the length of the list + unsigned int sexpsz = Rf_length(obj); + p = new std::vector< std::vector< float> > (sexpsz); + + for (unsigned listpos = 0; listpos < sexpsz; ++listpos) + { + unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); + for (unsigned vpos = 0; vpos < vecsize; ++vpos) + { + (*p)[listpos].push_back(static_cast<float>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); + } + } + + int res = SWIG_OK; + + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <> + struct traits_asptr < std::vector< std::vector< double> > > { + static int asptr(SEXP obj, std::vector< std::vector< double> > **val) { + std::vector <std::vector< double> > *p; + // this is the length of the list + unsigned int sexpsz = Rf_length(obj); + p = new std::vector< std::vector< double> > (sexpsz); + + for (unsigned listpos = 0; listpos < sexpsz; ++listpos) + { + unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); + for (unsigned vpos = 0; vpos < vecsize; ++vpos) + { + (*p)[listpos].push_back(static_cast<double>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); + } + } + + int res = SWIG_OK; + + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + template <> + struct traits_asptr < std::vector< std::vector< bool > > > { + static int asptr(SEXP obj, std::vector< std::vector< bool> > **val) { + std::vector <std::vector< bool > > *p; + // this is the length of the list + unsigned int sexpsz = Rf_length(obj); + p = new std::vector< std::vector< bool > > (sexpsz); + + for (unsigned listpos = 0; listpos < sexpsz; ++listpos) + { + unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); + for (unsigned vpos = 0; vpos < vecsize; ++vpos) + { + (*p)[listpos].push_back(static_cast<bool>(LOGICAL_POINTER(VECTOR_ELT(obj, listpos))[vpos])); + } + } + + int res = SWIG_OK; + + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + // catchall + template <typename T> + struct traits_asptr < std::vector< std::vector<T> > > { + static int asptr(SEXP obj, std::vector< std::vector<T> > **val) { + std::vector< std::vector<T> > *p; + Rprintf("vector of vectors - unsupported content\n"); + int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0); + if (SWIG_IsOK(res)) { + if (val) *val = p; + } + return res; + } + }; + + } +%} + +#define %swig_vector_methods(Type...) %swig_sequence_methods(Type) +#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type); + +%define %traits_type_name(Type...) +%fragment(SWIG_Traits_frag(Type), "header", + fragment="StdTraits",fragment="StdVectorTraits") { + namespace swig { + template <> struct traits< Type > { + typedef pointer_category category; + static const char* type_name() { + return #Type; + } + }; + } + } +%enddef + +%include <std/std_vector.i> + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<double>) +%traits_type_name(std::vector<double>) +%typemap("rtypecheck") std::vector<double>, std::vector<double> *, std::vector<double> & + %{ is.numeric($arg) %} +%typemap("rtype") std::vector<double> "numeric" +%typemap("scoercein") std::vector<double>, std::vector<double> *, std::vector<double> & "$input = as.numeric($input);"; + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<float>) +%traits_type_name(std::vector<float>) + +// reuse these for float +%typemap("rtype") std::vector<float>, std::vector<float> *, std::vector<float> & = std::vector<double>; +%typemap("rtypecheck") std::vector<float>, std::vector<float> *, std::vector<float> & = std::vector<double>; +%typemap("scoercein") std::vector<float>, std::vector<float> *, std::vector<float> & = std::vector<double>; + + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<bool>); +%traits_type_name(std::vector<bool>); +%typemap("rtypecheck") std::vector<bool>, std::vector<bool> *, std::vector<bool> & + %{ is.logical($arg) %} +%typemap("rtype") std::vector<bool> "logical" +%typemap("scoercein") std::vector<bool> , std::vector<bool> & "$input = as.logical($input);"; + + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<int>); +%traits_type_name(std::vector<int>); +%typemap("rtypecheck") std::vector<int>, std::vector<int> *, std::vector<int> & + %{ is.integer($arg) || is.numeric($arg) %} + +%typemap("rtype") std::vector<int> "integer" +%typemap("scoercein") std::vector<int> , std::vector<int> *, std::vector<int> & "$input = as.integer($input);"; + +// strings +%typemap("rtype") std::vector< std::basic_string<char> >, +std::vector< std::basic_string<char> > *, + std::vector< std::basic_string<char> > & "character" + +%typemap("rtypecheck") std::vector< std::basic_string<char> >, +std::vector< std::basic_string<char> > *, + std::vector< std::basic_string<char> > & + %{ is.character($arg) %} + +%typemap("scoercein") std::vector< std::basic_string<char> >, +std::vector< std::basic_string<char> > *, + std::vector< std::basic_string<char> > & "$input = as.character($input);"; + +%typemap("scoerceout") std::vector< std::basic_string<char> >, +std::vector< std::basic_string<char> > *, + std::vector< std::basic_string<char> > & +%{ %} + +%apply std::vector< std::basic_string<char> > { std::vector< std::string> }; + +// all the related integer vectors +// signed +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<signed char>); +%traits_type_name(std::vector<signed char>); + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<signed short>); +%traits_type_name(std::vector<signed short>); + +#if defined(SWIGWORDSIZE64) +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<long int>); +%traits_type_name(std::vector<long int>); +#else +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<long long int>); +%traits_type_name(std::vector<long long int>); +#endif + +// unsigned +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned char>); +%traits_type_name(std::vector<unsigned char>); + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned short>); +%traits_type_name(std::vector<unsigned short>); + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned int>); +%traits_type_name(std::vector<unsigned int>); + +#if defined(SWIGWORDSIZE64) +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned long int>); +%traits_type_name(std::vector<unsigned long int>); +#else +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned long long int>); +%traits_type_name(std::vector<unsigned long long int>); +#endif + +// These R side typemaps are common for integer types +// but we can't use %apply as it will copy the C side ones too +// Also note that we don't seem to be able to use types like +// int_least8_t here. +%typemap("rtype") std::vector<signed char>, std::vector<signed char> *, std::vector<signed char> & = std::vector<int>; +%typemap("rtype") std::vector<signed short>, std::vector<signed short> *, std::vector<signed short> & = std::vector<int>; +%typemap("rtype") std::vector<unsigned char>, std::vector<unsigned char> *, std::vector<unsigned char> & = std::vector<int>; +%typemap("rtype") std::vector<unsigned int>, std::vector<unsigned int> *, std::vector<unsigned int> & = std::vector<int>; + +#if defined(SWIGWORDSIZE64) +%typemap("rtype") std::vector<long int>, std::vector<long int> *, std::vector<long int> & = std::vector<int>; +%typemap("rtype") std::vector<unsigned long int>, std::vector<unsigned long int> *, std::vector<unsigned long int> & = std::vector<int>; +#else +%typemap("rtype") std::vector<long long int>, std::vector<long long int> *, std::vector<long long int> & = std::vector<int>; +%typemap("rtype") std::vector<unsigned long long int>, std::vector<unsigned long long int> *, std::vector<unsigned long long int> & = std::vector<int>; +#endif + + +%typemap("scoercein") std::vector<signed char>, std::vector<signed char> *, std::vector<signed char> & = std::vector<int>; +%typemap("scoercein") std::vector<signed short>, std::vector<signed short> *, std::vector<signed short> & = std::vector<int>; +%typemap("scoercein") std::vector<unsigned char>, std::vector<unsigned char> *, std::vector<unsigned char> & = std::vector<int>; +%typemap("scoercein") std::vector<unsigned int>, std::vector<unsigned int> *, std::vector<unsigned int> & = std::vector<int>; + +#if defined(SWIGWORDSIZE64) +%typemap("scoercein") std::vector<long int>, std::vector<long int> *, std::vector<long int> & = std::vector<int>; +%typemap("scoercein") std::vector<unsigned long int>, std::vector<unsigned long int> *, std::vector<unsigned long int> & = std::vector<int>; +#else +%typemap("scoercein") std::vector<long long int>, std::vector<long long int> *, std::vector<long long int> & = std::vector<int>; +%typemap("scoercein") std::vector<unsigned long long int>, std::vector<unsigned long long int> *, std::vector<unsigned long long int> & = std::vector<int>; +#endif + +%typemap("rtypecheck") std::vector<signed char>, std::vector<signed char> *, std::vector<signed char> & = std::vector<int>; +%typemap("rtypecheck") std::vector<signed short>, std::vector<signed short> *, std::vector<signed short> & = std::vector<int>; +%typemap("rtypecheck") std::vector<unsigned char>, std::vector<unsigned char> *, std::vector<unsigned char> & = std::vector<int>; +%typemap("rtypecheck") std::vector<unsigned int>, std::vector<unsigned int> *, std::vector<unsigned int> & = std::vector<int>; + +#if defined(SWIGWORDSIZE64) +%typemap("rtypecheck") std::vector<long int>, std::vector<long int> *, std::vector<long int> & = std::vector<int>; +%typemap("rtypecheck") std::vector<unsigned long int>, std::vector<unsigned long int> *, std::vector<unsigned long int> & = std::vector<int>; +#else +%typemap("rtypecheck") std::vector<long long int>, std::vector<long long int> *, std::vector<long long int> & = std::vector<int>; +%typemap("rtypecheck") std::vector<unsigned long long int>, std::vector<unsigned long long int> *, std::vector<unsigned long long int> & = std::vector<int>; +#endif + +/////////////////////////////////////////////////////////////// + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<int> >); +%traits_type_name(std::vector< std::vector<int> >); +%typemap("rtypecheck") std::vector<std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & + %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} +%typemap("rtype") std::vector<std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & "list" +%typemap("scoercein") std::vector< std::vector<int> >, std::vector<std::vector<int> > *, std::vector<std::vector<int> > & "$input = lapply($input, as.integer);"; + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<unsigned int> >); +%traits_type_name(std::vector< std::vector<unsigned int> >); +%typemap("rtypecheck") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > *, std::vector<std::vector<unsigned int> > & + %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} +%typemap("rtype") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > *, std::vector<std::vector<unsigned int> > & "list" +%typemap("scoercein") std::vector< std::vector<unsigned int> >, std::vector<std::vector<int> > *, std::vector<std::vector<unsigned int> > & "$input = lapply($input, as.integer);"; + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<float> >); +%traits_type_name(std::vector< std::vector<float> >); +%typemap("rtypecheck") std::vector<std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > & + %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} +%typemap("rtype") std::vector<std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > "list" +%typemap("scoercein") std::vector< std::vector<float> >, std::vector<std::vector<float> > *, std::vector<std::vector<float> > & "$input = lapply($input, as.numeric);"; + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<double> >); +%traits_type_name(std::vector< std::vector<double> >); +%typemap("rtypecheck") std::vector<std::vector<double> >, std::vector<std::vector<double> > *, std::vector<std::vector<double> > & + %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} +%typemap("rtype") std::vector<std::vector<double> >, std::vector<std::vector<double> > *, std::vector<std::vector<double> > & "list" +%typemap("scoercein") std::vector< std::vector<double> >, std::vector<std::vector<double> > *, std::vector<std::vector<double> > & + "$input = lapply($input, as.numeric);"; + +%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<bool> >); +%traits_type_name(std::vector< std::vector<bool> >); +%typemap("rtypecheck") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & + %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} +%typemap("rtype") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "list" +%typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > *, std::vector<std::vector<bool> > & "$input = lapply($input, as.logical);"; + +// we don't want these to be given R classes as they +// have already been turned into R vectors. +%typemap(scoerceout) std::vector<double>, + std::vector<double>*, + std::vector<double>&, + std::vector<float> , + std::vector<float>*, + std::vector<float> , + std::vector<signed char>, + std::vector<signed char>*, + std::vector<signed char>&, + std::vector<signed short>, + std::vector<signed short>*, + std::vector<signed short>&, + std::vector<int>, + std::vector<int>*, + std::vector<int>&, + std::vector<unsigned char>, + std::vector<unsigned char>*, + std::vector<unsigned char>&, + std::vector<unsigned short>, + std::vector<unsigned short>*, + std::vector<unsigned short>&, + std::vector<unsigned int>, + std::vector<unsigned int>*, + std::vector<unsigned int>&, + std::vector<bool>, + std::vector<bool>*, + std::vector<bool>&, + // vectors of vectors + std::vector< std::vector<unsigned int> >, + std::vector< std::vector<unsigned int> >*, + std::vector< std::vector<unsigned int> >&, + std::vector< std::vector<int> >, + std::vector< std::vector<int> >*, + std::vector< std::vector<int> >&, + std::vector< std::vector<float> >, + std::vector< std::vector<float> >*, + std::vector< std::vector<float> >&, + std::vector< std::vector<double> >, + std::vector< std::vector<double> >*, + std::vector< std::vector<double> >&, + std::vector< std::vector<bool> >, + std::vector< std::vector<bool> >*, + std::vector< std::vector<bool> >& + %{ %} + +#if defined(SWIGWORDSIZE64) +%typemap(scoerceout) std::vector<long int>, + std::vector<long int>*, + std::vector<long int>&, + std::vector<unsigned long int>, + std::vector<unsigned long int>*, + std::vector<unsigned long int>& + %{ %} +#else + +%typemap(scoerceout) std::vector<long long int>, + std::vector<long long int>*, + std::vector<long long int>&, + std::vector<unsigned long long int>, + std::vector<unsigned long long int>*, + std::vector<unsigned long long int>& + %{ %} + +#endif
diff --git a/share/swig/2.0.11/r/stl.i b/share/swig/3.0.12/r/stl.i similarity index 100% rename from share/swig/2.0.11/r/stl.i rename to share/swig/3.0.12/r/stl.i
diff --git a/share/swig/2.0.11/r/typemaps.i b/share/swig/3.0.12/r/typemaps.i similarity index 100% rename from share/swig/2.0.11/r/typemaps.i rename to share/swig/3.0.12/r/typemaps.i
diff --git a/share/swig/2.0.11/ruby/Makefile.swig b/share/swig/3.0.12/ruby/Makefile.swig similarity index 99% rename from share/swig/2.0.11/ruby/Makefile.swig rename to share/swig/3.0.12/ruby/Makefile.swig index a7f3ae3..648b321 100644 --- a/share/swig/2.0.11/ruby/Makefile.swig +++ b/share/swig/3.0.12/ruby/Makefile.swig
@@ -7,7 +7,7 @@ # 3. Type 'make -f Makefile.swig' to generate wrapper code and Makefile. # 4. Type 'make' to build your extension. # 5. Type 'make install' to install your extension. -# +# MODULE = yourmodule FEATURE = $(MODULE)
diff --git a/share/swig/2.0.11/ruby/argcargv.i b/share/swig/3.0.12/ruby/argcargv.i similarity index 100% rename from share/swig/2.0.11/ruby/argcargv.i rename to share/swig/3.0.12/ruby/argcargv.i
diff --git a/share/swig/2.0.11/ruby/attribute.i b/share/swig/3.0.12/ruby/attribute.i similarity index 100% rename from share/swig/2.0.11/ruby/attribute.i rename to share/swig/3.0.12/ruby/attribute.i
diff --git a/share/swig/2.0.11/python/boost_shared_ptr.i b/share/swig/3.0.12/ruby/boost_shared_ptr.i similarity index 87% copy from share/swig/2.0.11/python/boost_shared_ptr.i copy to share/swig/3.0.12/ruby/boost_shared_ptr.i index 100ed3e..938074d 100644 --- a/share/swig/2.0.11/python/boost_shared_ptr.i +++ b/share/swig/3.0.12/ruby/boost_shared_ptr.i
@@ -18,24 +18,24 @@ %naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; // destructor wrapper customisation -%feature("unref") TYPE -//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n" - "(void)arg1; delete smartarg1;" +%feature("unref") TYPE + %{(void)arg1; + delete reinterpret_cast< SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > * >(self);%} // Typemap customisations... // plain value %typemap(in) CONST TYPE (void *argp, int res = 0) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); - if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); + if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); } } %typemap(out) CONST TYPE { @@ -45,16 +45,16 @@ %typemap(varin) CONST TYPE { void *argp = 0; - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; int res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } if (!argp) { - %argument_nullref("$type", $symname, $argnum); + %variable_nullref("$type", "$name"); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); - if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); + if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); } } %typemap(varout) CONST TYPE { @@ -65,12 +65,12 @@ // plain pointer // Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance %typemap(in) CONST TYPE * (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); $1 = %const_cast(tempshared.get(), $1_ltype); @@ -87,14 +87,14 @@ %typemap(varin) CONST TYPE * { void *argp = 0; - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; int res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0; - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); $1 = %const_cast(tempshared.get(), $1_ltype); @@ -110,13 +110,13 @@ // plain reference %typemap(in) CONST TYPE & (void *argp = 0, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } if (!argp) { %argument_nullref("$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); $1 = %const_cast(tempshared.get(), $1_ltype); @@ -131,14 +131,16 @@ %typemap(varin) CONST TYPE & { void *argp = 0; - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; int res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; - if (!argp) { %argument_nullref("$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (!argp) { + %variable_nullref("$type", "$name"); + } + if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); $1 = *%const_cast(tempshared.get(), $1_ltype); @@ -154,12 +156,12 @@ // plain pointer by reference // Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance %typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); temp = %const_cast(tempshared.get(), $*1_ltype); @@ -182,13 +184,13 @@ // shared_ptr by value %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (void *argp, int res = 0) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } if (argp) $1 = *(%reinterpret_cast(argp, $<ype)); - if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype); + if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype); } %typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; @@ -196,14 +198,14 @@ } %typemap(varin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; void *argp = 0; int res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { %variable_fail(res, "$type", "$name"); } $1 = argp ? *(%reinterpret_cast(argp, $<ype)) : SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE >(); - if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype); + if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $<ype); } %typemap(varout) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > { SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1) : 0; @@ -212,12 +214,12 @@ // shared_ptr by reference %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & (void *argp, int res = 0, $*1_ltype tempshared) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { if (argp) tempshared = *%reinterpret_cast(argp, $ltype); delete %reinterpret_cast(argp, $ltype); $1 = &tempshared; @@ -239,12 +241,12 @@ // shared_ptr by pointer %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * (void *argp, int res = 0, $*1_ltype tempshared) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } - if (newmem & SWIG_CAST_NEW_MEMORY) { + if (newmem.own & SWIG_CAST_NEW_MEMORY) { if (argp) tempshared = *%reinterpret_cast(argp, $ltype); delete %reinterpret_cast(argp, $ltype); $1 = &tempshared; @@ -267,13 +269,13 @@ // shared_ptr by pointer reference %typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (void *argp, int res = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared, $*1_ltype temp = 0) { - int newmem = 0; + swig_ruby_owntype newmem = {0, 0}; res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem); if (!SWIG_IsOK(res)) { - %argument_fail(res, "$type", $symname, $argnum); + %argument_fail(res, "$type", $symname, $argnum); } if (argp) tempshared = *%reinterpret_cast(argp, $*ltype); - if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype); + if (newmem.own & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, $*ltype); temp = &tempshared; $1 = &temp; } @@ -290,9 +292,9 @@ %} // Typecheck typemaps -// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting +// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting // function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain. -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) TYPE CONST, TYPE CONST &, TYPE CONST *, @@ -319,4 +321,3 @@ %enddef -
diff --git a/share/swig/2.0.11/ruby/carrays.i b/share/swig/3.0.12/ruby/carrays.i similarity index 100% rename from share/swig/2.0.11/ruby/carrays.i rename to share/swig/3.0.12/ruby/carrays.i
diff --git a/share/swig/2.0.11/ruby/cdata.i b/share/swig/3.0.12/ruby/cdata.i similarity index 100% rename from share/swig/2.0.11/ruby/cdata.i rename to share/swig/3.0.12/ruby/cdata.i
diff --git a/share/swig/2.0.11/ruby/cmalloc.i b/share/swig/3.0.12/ruby/cmalloc.i similarity index 100% rename from share/swig/2.0.11/ruby/cmalloc.i rename to share/swig/3.0.12/ruby/cmalloc.i
diff --git a/share/swig/2.0.11/ruby/cni.i b/share/swig/3.0.12/ruby/cni.i similarity index 100% rename from share/swig/2.0.11/ruby/cni.i rename to share/swig/3.0.12/ruby/cni.i
diff --git a/share/swig/2.0.11/ruby/cpointer.i b/share/swig/3.0.12/ruby/cpointer.i similarity index 100% rename from share/swig/2.0.11/ruby/cpointer.i rename to share/swig/3.0.12/ruby/cpointer.i
diff --git a/share/swig/2.0.11/ruby/cstring.i b/share/swig/3.0.12/ruby/cstring.i similarity index 100% rename from share/swig/2.0.11/ruby/cstring.i rename to share/swig/3.0.12/ruby/cstring.i
diff --git a/share/swig/2.0.11/ruby/director.swg b/share/swig/3.0.12/ruby/director.swg similarity index 62% rename from share/swig/2.0.11/ruby/director.swg rename to share/swig/3.0.12/ruby/director.swg index a5daf21..c6c53a3 100644 --- a/share/swig/2.0.11/ruby/director.swg +++ b/share/swig/3.0.12/ruby/director.swg
@@ -1,8 +1,8 @@ /* ----------------------------------------------------------------------------- * director.swg * - * This file contains support for director classes that proxy - * method calls from C++ to Ruby extensions. + * This file contains support for director classes so that Ruby proxy + * methods can be called from C++. * ----------------------------------------------------------------------------- */ /* @@ -15,105 +15,87 @@ #endif #endif -#ifdef __cplusplus - #include <string> #include <iostream> +#include <exception> #include <map> # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) namespace Swig { + /* memory handler */ - struct GCItem - { - virtual ~GCItem() - { + struct GCItem { + virtual ~GCItem() { } - virtual ruby_owntype get_own() const - { - return 0; + virtual swig_ruby_owntype get_own() const { + swig_ruby_owntype own = {0, 0}; + return own; } }; - - struct GCItem_var - { - GCItem_var(GCItem *item = 0) : _item(item) - { + + struct GCItem_var { + GCItem_var(GCItem *item = 0) : _item(item) { } - GCItem_var& operator=(GCItem *item) - { + GCItem_var& operator=(GCItem *item) { GCItem *tmp = _item; _item = item; delete tmp; return *this; } - - ~GCItem_var() - { + + ~GCItem_var() { delete _item; } - - GCItem * operator->() const - { + + GCItem *operator->() const { return _item; } - + private: GCItem *_item; }; template <typename Type> - struct GCItem_T : GCItem - { - GCItem_T(Type *ptr) : _ptr(ptr) - { + struct GCItem_T : GCItem { + GCItem_T(Type *ptr) : _ptr(ptr) { } - - virtual ~GCItem_T() - { + + virtual ~GCItem_T() { delete _ptr; } - + private: Type *_ptr; }; - struct GCItem_Object : GCItem - { - GCItem_Object(ruby_owntype own) : _own(own) - { - } - - virtual ~GCItem_Object() - { + struct GCItem_Object : GCItem { + GCItem_Object(swig_ruby_owntype own) : _own(own) { } - ruby_owntype get_own() const - { + virtual ~GCItem_Object() { + } + + swig_ruby_owntype get_own() const { return _own; } - + private: - ruby_owntype _own; + swig_ruby_owntype _own; }; - template <typename Type> - struct GCArray_T : GCItem - { - GCArray_T(Type *ptr) : _ptr(ptr) - { + struct GCArray_T : GCItem { + GCArray_T(Type *ptr) : _ptr(ptr) { } - - virtual ~GCArray_T() - { + + virtual ~GCArray_T() { delete[] _ptr; } - + private: Type *_ptr; }; @@ -126,21 +108,18 @@ int argc; VALUE *argv; }; - + /* Base class for director exceptions */ - class DirectorException { + class DirectorException : public std::exception { protected: VALUE swig_error; std::string swig_msg; protected: - DirectorException(VALUE error) - : swig_error(error) - { + DirectorException(VALUE error) : swig_error(error) { } - - DirectorException(VALUE error, const char* hdr, const char* msg ="") - : swig_error(error), swig_msg(hdr) { - if (strlen(msg)) { + + DirectorException(VALUE error, const char *hdr, const char *msg ="") : swig_error(error), swig_msg(hdr) { + if (msg[0]) { swig_msg += " "; swig_msg += msg; } @@ -151,56 +130,60 @@ swig_error = error; } } + public: - VALUE getType() const { - return CLASS_OF(swig_error); + virtual ~DirectorException() throw() { } + + VALUE getType() const { + return CLASS_OF(swig_error); + } + VALUE getError() const { return swig_error; } - const std::string& getMessage() const - { + + /* Deprecated, use what() instead */ + const std::string& getMessage() const { return swig_msg; } - - virtual ~DirectorException() {} - }; - - /* unknown exception handler */ - class UnknownExceptionHandler - { + const char *what() const throw() { + return swig_msg.c_str(); + } + }; + + /* unknown exception handler */ + class UnknownExceptionHandler { #ifdef SWIG_DIRECTOR_UEH static void handler() { try { throw; } catch (DirectorException& e) { std::cerr << "SWIG Director exception caught:" << std::endl - << e.getMessage() << std::endl; + << e.what() << std::endl; } catch (std::exception& e) { std::cerr << "std::exception caught: "<< e.what() << std::endl; } catch (...) { std::cerr << "Unknown exception caught." << std::endl; - } + } std::cerr << std::endl << "Ruby interpreter traceback:" << std::endl; - std::cerr << std::endl; + std::cerr << std::endl; std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl << std::endl << "Exception is being re-thrown, program will like abort/terminate." << std::endl; throw; } - - public: + + public: std::unexpected_handler old; - UnknownExceptionHandler(std::unexpected_handler nh = handler) - { + UnknownExceptionHandler(std::unexpected_handler nh = handler) { old = std::set_unexpected(nh); } - ~UnknownExceptionHandler() - { + ~UnknownExceptionHandler() { std::set_unexpected(old); } #endif @@ -208,16 +191,14 @@ /* Type mismatch in the return value from a Ruby method call */ - class DirectorTypeMismatchException : public Swig::DirectorException { + class DirectorTypeMismatchException : public DirectorException { public: DirectorTypeMismatchException(VALUE error, const char *msg="") - : Swig::DirectorException(error, "SWIG director type mismatch", msg) - { + : DirectorException(error, "SWIG director type mismatch", msg) { } DirectorTypeMismatchException(const char *msg="") - : Swig::DirectorException(rb_eTypeError, "SWIG director type mismatch", msg) - { + : DirectorException(rb_eTypeError, "SWIG director type mismatch", msg) { } static void raise(VALUE error, const char *msg) { @@ -230,33 +211,30 @@ }; /* Any Ruby exception that occurs during a director method call */ - class DirectorMethodException : public Swig::DirectorException { + class DirectorMethodException : public DirectorException { public: - DirectorMethodException(VALUE error) - : Swig::DirectorException(error) { + DirectorMethodException(VALUE error) + : DirectorException(error) { } - DirectorMethodException(const char* msg = "") - : Swig::DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) { + DirectorMethodException(const char *msg = "") + : DirectorException(rb_eRuntimeError, "SWIG director method error.", msg) { } - - static void raise(VALUE error) - { + + static void raise(VALUE error) { throw DirectorMethodException(error); - } + } }; /* Attempted to call a pure virtual method via a director method */ - class DirectorPureVirtualException : public Swig::DirectorException + class DirectorPureVirtualException : public DirectorException { public: - DirectorPureVirtualException(const char* msg = "") - : DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg) - { + DirectorPureVirtualException(const char *msg = "") + : DirectorException(rb_eRuntimeError, "SWIG director pure virtual method called", msg) { } - static void raise(const char *msg) - { + static void raise(const char *msg) { throw DirectorPureVirtualException(msg); } }; @@ -271,28 +249,25 @@ # define SWIG_MUTEX_INIT(var) var # else # include <pthread.h> -# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER +# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER # endif #endif #ifdef __PTHREAD__ - struct Guard - { + struct Guard { pthread_mutex_t *_mutex; - - Guard(pthread_mutex_t &mutex) : _mutex(&mutex) - { + + Guard(pthread_mutex_t &mutex) : _mutex(&mutex) { pthread_mutex_lock(_mutex); } - - ~Guard() - { + + ~Guard() { pthread_mutex_unlock(_mutex); } }; # define SWIG_GUARD(mutex) Guard _guard(mutex) #else -# define SWIG_GUARD(mutex) +# define SWIG_GUARD(mutex) #endif /* director base class */ @@ -304,7 +279,7 @@ mutable bool swig_disown_flag; public: - /* wrap a Ruby object, optionally taking ownership */ + /* wrap a Ruby object. */ Director(VALUE self) : swig_self(self), swig_disown_flag(false) { } @@ -313,21 +288,20 @@ } /* return a pointer to the wrapped Ruby object */ - VALUE swig_get_self() const { - return swig_self; + VALUE swig_get_self() const { + return swig_self; } - /* acquire ownership of the wrapped Ruby object (the sense of "disown" - * is from Ruby) */ - void swig_disown() const { - if (!swig_disown_flag) { + /* acquire ownership of the wrapped Ruby object (the sense of "disown" is from Ruby) */ + void swig_disown() const { + if (!swig_disown_flag) { swig_disown_flag = true; - } + } } /* ownership management */ private: - typedef std::map<void*, GCItem_var> swig_ownership_map; + typedef std::map<void *, GCItem_var> swig_ownership_map; mutable swig_ownership_map swig_owner; #ifdef __PTHREAD__ static pthread_mutex_t swig_mutex_own; @@ -335,39 +309,35 @@ public: template <typename Type> - void swig_acquire_ownership_array(Type *vptr) const - { + void swig_acquire_ownership_array(Type *vptr) const { if (vptr) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCArray_T<Type>(vptr); } } - + template <typename Type> - void swig_acquire_ownership(Type *vptr) const - { + void swig_acquire_ownership(Type *vptr) const { if (vptr) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCItem_T<Type>(vptr); } } - void swig_acquire_ownership_obj(void *vptr, ruby_owntype own) const - { - if (vptr && own) { + void swig_acquire_ownership_obj(void *vptr, swig_ruby_owntype own) const { + if (vptr && own.datafree) { SWIG_GUARD(swig_mutex_own); swig_owner[vptr] = new GCItem_Object(own); } } - - ruby_owntype swig_release_ownership(void *vptr) const - { - ruby_owntype own = 0; + + swig_ruby_owntype swig_release_ownership(void *vptr) const { + swig_ruby_owntype own = {0, 0}; if (vptr) { SWIG_GUARD(swig_mutex_own); swig_ownership_map::iterator iter = swig_owner.find(vptr); if (iter != swig_owner.end()) { - own = iter->second->get_own(); + own.datafree = iter->second->get_own().datafree; swig_owner.erase(iter); } } @@ -376,6 +346,3 @@ }; } -#endif /* __cplusplus */ - -
diff --git a/share/swig/2.0.11/ruby/embed.i b/share/swig/3.0.12/ruby/embed.i similarity index 100% rename from share/swig/2.0.11/ruby/embed.i rename to share/swig/3.0.12/ruby/embed.i
diff --git a/share/swig/2.0.11/ruby/exception.i b/share/swig/3.0.12/ruby/exception.i similarity index 100% rename from share/swig/2.0.11/ruby/exception.i rename to share/swig/3.0.12/ruby/exception.i
diff --git a/share/swig/2.0.11/ruby/extconf.rb b/share/swig/3.0.12/ruby/extconf.rb similarity index 100% rename from share/swig/2.0.11/ruby/extconf.rb rename to share/swig/3.0.12/ruby/extconf.rb
diff --git a/share/swig/2.0.11/ruby/factory.i b/share/swig/3.0.12/ruby/factory.i similarity index 100% rename from share/swig/2.0.11/ruby/factory.i rename to share/swig/3.0.12/ruby/factory.i
diff --git a/share/swig/2.0.11/ruby/file.i b/share/swig/3.0.12/ruby/file.i similarity index 91% rename from share/swig/2.0.11/ruby/file.i rename to share/swig/3.0.12/ruby/file.i index d64937e..f9aaa27 100644 --- a/share/swig/2.0.11/ruby/file.i +++ b/share/swig/3.0.12/ruby/file.i
@@ -4,7 +4,7 @@ extern "C" { #endif -// Ruby 1.9 changed the file name of this header +/* Ruby 1.9 changed the file name of this header */ #ifdef HAVE_RUBY_IO_H #include "ruby/io.h" #else
diff --git a/share/swig/2.0.11/ruby/jstring.i b/share/swig/3.0.12/ruby/jstring.i similarity index 100% rename from share/swig/2.0.11/ruby/jstring.i rename to share/swig/3.0.12/ruby/jstring.i
diff --git a/share/swig/2.0.11/ruby/progargcargv.i b/share/swig/3.0.12/ruby/progargcargv.i similarity index 100% rename from share/swig/2.0.11/ruby/progargcargv.i rename to share/swig/3.0.12/ruby/progargcargv.i
diff --git a/share/swig/2.0.11/ruby/ruby.swg b/share/swig/3.0.12/ruby/ruby.swg similarity index 100% rename from share/swig/2.0.11/ruby/ruby.swg rename to share/swig/3.0.12/ruby/ruby.swg
diff --git a/share/swig/2.0.11/ruby/rubyapi.swg b/share/swig/3.0.12/ruby/rubyapi.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyapi.swg rename to share/swig/3.0.12/ruby/rubyapi.swg
diff --git a/share/swig/2.0.11/ruby/rubyautodoc.swg b/share/swig/3.0.12/ruby/rubyautodoc.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyautodoc.swg rename to share/swig/3.0.12/ruby/rubyautodoc.swg
diff --git a/share/swig/2.0.11/ruby/rubyclasses.swg b/share/swig/3.0.12/ruby/rubyclasses.swg similarity index 96% rename from share/swig/2.0.11/ruby/rubyclasses.swg rename to share/swig/3.0.12/ruby/rubyclasses.swg index 5537136..f7b51bd 100644 --- a/share/swig/2.0.11/ruby/rubyclasses.swg +++ b/share/swig/3.0.12/ruby/rubyclasses.swg
@@ -37,9 +37,6 @@ %fragment("GC_VALUE_definition","header") { namespace swig { class SwigGCReferences { - // Hash of all GC_VALUE's currently in use - static SwigGCReferences s_references; - VALUE _hash; SwigGCReferences() : _hash(Qnil) { @@ -50,13 +47,18 @@ } static void EndProcHandler(VALUE) { // Ruby interpreter ending - _hash can no longer be accessed. + SwigGCReferences &s_references = instance(); s_references._hash = Qnil; } public: static SwigGCReferences& instance() { + // Hash of all GC_VALUE's currently in use + static SwigGCReferences s_references; + return s_references; } static void initialize() { + SwigGCReferences &s_references = instance(); if (s_references._hash == Qnil) { rb_set_end_proc(&EndProcHandler, Qnil); s_references._hash = rb_hash_new(); @@ -81,13 +83,13 @@ if (BUILTIN_TYPE(obj) == T_NONE) return; if (_hash != Qnil) { - VALUE val = rb_hash_aref(s_references._hash, obj); + VALUE val = rb_hash_aref(_hash, obj); unsigned n = FIXNUM_P(val) ? NUM2UINT(val) : 1; --n; if (n) - rb_hash_aset(s_references._hash, obj, INT2NUM(n)); + rb_hash_aset(_hash, obj, INT2NUM(n)); else - rb_hash_delete(s_references._hash, obj); + rb_hash_delete(_hash, obj); } } }; @@ -302,8 +304,6 @@ ID GC_VALUE::lshift_id = rb_intern("<<"); ID GC_VALUE::rshift_id = rb_intern(">>"); - SwigGCReferences SwigGCReferences::s_references; - typedef GC_VALUE LANGUAGE_OBJ; } // namespace swig
diff --git a/share/swig/2.0.11/ruby/rubycomplex.swg b/share/swig/3.0.12/ruby/rubycomplex.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubycomplex.swg rename to share/swig/3.0.12/ruby/rubycomplex.swg
diff --git a/share/swig/2.0.11/ruby/rubycontainer.swg b/share/swig/3.0.12/ruby/rubycontainer.swg similarity index 85% rename from share/swig/2.0.11/ruby/rubycontainer.swg rename to share/swig/3.0.12/ruby/rubycontainer.swg index d4eaa5f..4f1c6f5 100644 --- a/share/swig/2.0.11/ruby/rubycontainer.swg +++ b/share/swig/3.0.12/ruby/rubycontainer.swg
@@ -26,9 +26,7 @@ /**** The RubySequence C++ Wrap ***/ -%insert(header) %{ -#include <stdexcept> -%} +%fragment("<stdexcept>"); %include <std_except.i> @@ -40,7 +38,7 @@ namespace swig { template < class T > - struct yield : public std::unary_function< T, bool > + struct yield { bool operator()( const T& v ) const @@ -93,11 +91,17 @@ return pos; } + template <class Sequence> + inline void + resize(Sequence *seq, typename Sequence::size_type n, typename Sequence::value_type x) { + seq->resize(n, x); + } + template <class Sequence, class Difference> inline Sequence* getslice(const Sequence* self, Difference i, Difference j) { typename Sequence::size_type size = self->size(); - typename Sequence::size_type ii = swig::check_index(i, size); + typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size)); typename Sequence::size_type jj = swig::slice_index(j, size); if (jj > ii) { @@ -166,7 +170,6 @@ * of an element of a Ruby Array of stuff. * It can be used by RubySequence_InputIterator to make it work with STL * algorithms. - * */ template <class T> struct RubySequence_Ref @@ -212,7 +215,6 @@ * RubySequence_Ref. * It can be used by RubySequence_InputIterator to make it work with STL * algorithms. - * */ template <class T> struct RubySequence_ArrowProxy @@ -227,7 +229,6 @@ /** * Input Iterator. This adapator class is a random access iterator that * allows you to use STL algorithms with a Ruby class (a Ruby Array by default). - * */ template <class T, class Reference = RubySequence_Ref< T > > struct RubySequence_InputIterator @@ -328,7 +329,6 @@ /** * This adaptor class allows you to use a Ruby Array as if it was an STL * container, giving it begin(), end(), and iterators. - * */ template <class T> struct RubySequence_Cont @@ -421,7 +421,6 @@ /** * Macros used to typemap an STL iterator -> SWIGIterator conversion. - * */ %define %swig_sequence_iterator(Sequence...) #if defined(SWIG_EXPORT_ITERATOR_METHODS) @@ -465,8 +464,7 @@ %typemap(in,noblock=1,fragment="RubySequence_Cont") const_iterator(swig::ConstIterator *iter = 0, int res), const_reverse_iterator(swig::ConstIterator *iter = 0, int res) { - res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), - swig::ConstIterator::descriptor(), 0); + res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::ConstIterator::descriptor(), 0); if (!SWIG_IsOK(res) || !iter) { %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); } else { @@ -498,16 +496,14 @@ %typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont") const_iterator, const_reverse_iterator { swig::ConstIterator *iter = 0; - int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), - swig::ConstIterator::descriptor(), 0); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::ConstIterator::descriptor(), 0); $1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::ConstIterator_T<$type > *>(iter) != 0)); } %typecheck(%checkcode(ITERATOR),noblock=1,fragment="RubySequence_Cont") iterator, reverse_iterator { swig::ConstIterator *iter = 0; - int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), - swig::Iterator::descriptor(), 0); + int res = SWIG_ConvertPtr($input, %as_voidptrptr(&iter), swig::Iterator::descriptor(), 0); $1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::Iterator_T<$type > *>(iter) != 0)); } @@ -551,7 +547,6 @@ /** * Macro used to define common Ruby printing methods for STL container - * */ %define %swig_sequence_printing_methods(Sequence...) @@ -611,9 +606,8 @@ /** * Macro used to add common methods to all STL sequence-type containers - * */ -%define %swig_sequence_methods_common(Sequence...) +%define %swig_sequence_methods_non_resizable_common(Sequence...) %swig_container_methods(%arg(Sequence)) %swig_sequence_iterator(%arg(Sequence)) %swig_sequence_printing_methods(%arg(Sequence)) @@ -622,24 +616,28 @@ %extend { - - VALUE slice( difference_type i, difference_type j ) - { - if ( j <= 0 ) return Qnil; - std::size_t len = $self->size(); - if ( i < 0 ) i = len - i; - j += i; - if ( static_cast<std::size_t>(j) >= len ) j = len-1; - - VALUE r = Qnil; - try { - r = swig::from< const Sequence* >( swig::getslice(self, i, j) ); - } - catch( std::out_of_range ) - { - } - return r; + VALUE slice( difference_type i, difference_type length ) throw (std::invalid_argument) { + if ( length < 0 ) + return Qnil; + std::size_t len = $self->size(); + if ( i < 0 ) { + if ( i + static_cast<Sequence::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; } + Sequence::difference_type j = length + i; + if ( j > static_cast<Sequence::difference_type>(len) ) + j = len; + + VALUE r = Qnil; + try { + r = swig::from< const Sequence* >( swig::getslice(self, i, j) ); + } + catch( std::out_of_range ) { + } + return r; + } Sequence* each() @@ -659,12 +657,23 @@ return self; } + VALUE __delete2__(const value_type& i) { + VALUE r = Qnil; + return r; + } + + } +%enddef + +%define %swig_sequence_methods_resizable_common(Sequence...) + %extend { + %newobject select; Sequence* select() { if ( !rb_block_given_p() ) rb_raise( rb_eArgError, "no block given" ); - Sequence* r = new Sequence; + Sequence* r = new Sequence(); Sequence::const_iterator i = $self->begin(); Sequence::const_iterator e = $self->end(); for ( ; i != e; ++i ) @@ -689,21 +698,17 @@ } return r; } - - - VALUE __delete2__(const value_type& i) { - VALUE r = Qnil; - return r; - } - } %enddef +%define %swig_sequence_methods_common(Sequence...) + %swig_sequence_methods_non_resizable_common(%arg(Sequence)) + %swig_sequence_methods_resizable_common(%arg(Sequence)) +%enddef /** * Macro used to add functions for back insertion of values in - * STL Sequence containers - * + * STL sequence containers */ %define %swig_sequence_back_inserters( Sequence... ) %extend { @@ -726,7 +731,7 @@ if ( !rb_block_given_p() ) rb_raise( rb_eArgError, "no block given" ); - Sequence* r = new Sequence; + Sequence* r = new Sequence(); std::remove_copy_if( $self->begin(), $self->end(), std::back_inserter(*r), swig::yield< Sequence::value_type >() ); @@ -750,15 +755,7 @@ } %enddef -/** - * Macro used to add functions for Sequences - * - */ -%define %swig_sequence_methods(Sequence...) - %swig_sequence_methods_common(%arg(Sequence)); - %swig_sequence_methods_extra(%arg(Sequence)); - %swig_sequence_back_inserters(%arg(Sequence)); - +%define %swig_sequence_methods_non_resizable_accessors(Sequence...) %extend { VALUE at(difference_type i) const { @@ -766,25 +763,31 @@ try { r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) ); } - catch( std::out_of_range ) - { - } + catch( std::out_of_range ) { + } return r; } - VALUE __getitem__(difference_type i, difference_type j) const { - if ( j <= 0 ) return Qnil; + VALUE __getitem__(difference_type i, difference_type length) const throw (std::invalid_argument) { + if ( length < 0 ) + return Qnil; std::size_t len = $self->size(); - if ( i < 0 ) i = len - i; - j += i; if ( static_cast<std::size_t>(j) >= len ) j = len-1; + if ( i < 0 ) { + if ( i + static_cast<Sequence::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + Sequence::difference_type j = length + i; + if ( j > static_cast<Sequence::difference_type>(len) ) + j = len; VALUE r = Qnil; try { r = swig::from< const Sequence* >( swig::getslice(self, i, j) ); } - catch( std::out_of_range ) - { - } + catch( std::out_of_range ) { + } return r; } @@ -793,19 +796,16 @@ try { r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) ); } - catch( std::out_of_range ) - { - } + catch( std::out_of_range ) { + } return r; } - VALUE __getitem__(VALUE i) const { - if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) - { - rb_raise( rb_eTypeError, "not a valid index or range" ); - } + VALUE __getitem__(VALUE i) const throw (std::invalid_argument) { + if ( rb_obj_is_kind_of( i, rb_cRange ) == Qfalse ) { + rb_raise( rb_eTypeError, "not a valid index or range" ); + } - VALUE r = Qnil; static ID id_end = rb_intern("end"); static ID id_start = rb_intern("begin"); static ID id_noend = rb_intern("exclude_end?"); @@ -817,53 +817,81 @@ int len = $self->size(); int s = NUM2INT( start ); - if ( s < 0 ) s = len + s; - else if ( s >= len ) return Qnil; + if ( s < 0 ) { + s = len + s; + if ( s < 0 ) + return Qnil; + } else if ( s > len ) + return Qnil; int e = NUM2INT( end ); if ( e < 0 ) e = len + e; - - if ( e < s ) return Qnil; //std::swap( s, e ); - if ( noend ) e -= 1; + if ( e < 0 ) e = -1; if ( e >= len ) e = len - 1; + if ( s == len ) e = len - 1; return swig::from< Sequence* >( swig::getslice(self, s, e+1) ); } - VALUE __setitem__(difference_type i, const value_type& x) + VALUE __setitem__(difference_type i, const value_type& x) throw (std::invalid_argument, std::out_of_range) { - std::size_t len = $self->size(); - if ( i < 0 ) i = len - i; - else if ( static_cast<std::size_t>(i) >= len ) - $self->resize( i+1, x ); - else - *(swig::getpos(self,i)) = x; + if ( i >= static_cast<Sequence::difference_type>( $self->size()) ) + swig::resize( $self, i+1, x ); + else + *(swig::getpos($self, i)) = x; return swig::from< Sequence::value_type >( x ); } - VALUE __setitem__(difference_type i, difference_type j, const Sequence& v) - throw (std::invalid_argument) { + VALUE __setitem__(difference_type i, difference_type length, const Sequence& v) throw (std::invalid_argument) { - if ( j <= 0 ) return Qnil; + if ( length < 0 ) + return Qnil; std::size_t len = $self->size(); - if ( i < 0 ) i = len - i; - j += i; - if ( static_cast<std::size_t>(j) >= len ) { - $self->resize( j+1, *(v.begin()) ); - j = len-1; + if ( i < 0 ) { + if ( i + static_cast<Sequence::difference_type>(len) < 0 ) + return Qnil; + else + i = len + i; + } + Sequence::difference_type j = length + i; + if ( j > static_cast<Sequence::difference_type>(len) ) { + swig::resize( $self, j, *(v.begin()) ); } VALUE r = Qnil; - swig::setslice(self, i, j, v); + swig::setslice($self, i, j, v); r = swig::from< const Sequence* >( &v ); return r; } - } %enddef +/** + * Macro used to add functions for non resizable sequences + */ +%define %swig_sequence_methods_non_resizable(Sequence...) + %swig_sequence_methods_non_resizable_common(%arg(Sequence)) + %swig_sequence_methods_non_resizable_accessors(%arg(Sequence)) +%enddef + + +/** + * Macro used to add functions for sequences + */ +%define %swig_sequence_methods(Sequence...) + %swig_sequence_methods_non_resizable_common(%arg(Sequence)) + %swig_sequence_methods_resizable_common(%arg(Sequence)) + %swig_sequence_methods_non_resizable_accessors(%arg(Sequence)) + %swig_sequence_methods_extra(%arg(Sequence)); + %swig_sequence_back_inserters(%arg(Sequence)); +%enddef + +%define %swig_sequence_methods_non_resizable_val(Sequence...) + %swig_sequence_methods_non_resizable(%arg(Sequence)) +%enddef + %define %swig_sequence_methods_val(Sequence...) %swig_sequence_methods(%arg(Sequence)) %enddef @@ -872,10 +900,8 @@ /** * Macro used to add functions for front insertion of * elements in STL sequence containers that support it. - * */ %define %swig_sequence_front_inserters( Sequence... ) - %extend { VALUE shift() @@ -955,7 +981,6 @@ return $self; } - } %enddef @@ -1009,8 +1034,8 @@ } } else { sequence *p; - if (SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<sequence>(),0) == SWIG_OK) { + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { if (seq) *seq = p; return SWIG_OLDOBJ; } @@ -1049,8 +1074,8 @@ } } else { sequence *p; - if (SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<sequence>(),0) == SWIG_OK) { + swig_type_info *descriptor = swig::type_info<sequence>(); + if (descriptor && SWIG_IsOK(SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { if (seq) *seq = p; return SWIG_OLDOBJ; }
diff --git a/share/swig/2.0.11/ruby/rubycontainer_extended.swg b/share/swig/3.0.12/ruby/rubycontainer_extended.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubycontainer_extended.swg rename to share/swig/3.0.12/ruby/rubycontainer_extended.swg
diff --git a/share/swig/2.0.11/ruby/rubydef.swg b/share/swig/3.0.12/ruby/rubydef.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubydef.swg rename to share/swig/3.0.12/ruby/rubydef.swg
diff --git a/share/swig/2.0.11/ruby/rubyerrors.swg b/share/swig/3.0.12/ruby/rubyerrors.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyerrors.swg rename to share/swig/3.0.12/ruby/rubyerrors.swg
diff --git a/share/swig/2.0.11/ruby/rubyfragments.swg b/share/swig/3.0.12/ruby/rubyfragments.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyfragments.swg rename to share/swig/3.0.12/ruby/rubyfragments.swg
diff --git a/share/swig/2.0.11/ruby/rubyhead.swg b/share/swig/3.0.12/ruby/rubyhead.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyhead.swg rename to share/swig/3.0.12/ruby/rubyhead.swg
diff --git a/share/swig/2.0.11/ruby/rubyinit.swg b/share/swig/3.0.12/ruby/rubyinit.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyinit.swg rename to share/swig/3.0.12/ruby/rubyinit.swg
diff --git a/share/swig/2.0.11/ruby/rubyiterators.swg b/share/swig/3.0.12/ruby/rubyiterators.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyiterators.swg rename to share/swig/3.0.12/ruby/rubyiterators.swg
diff --git a/share/swig/2.0.11/ruby/rubykw.swg b/share/swig/3.0.12/ruby/rubykw.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubykw.swg rename to share/swig/3.0.12/ruby/rubykw.swg
diff --git a/share/swig/2.0.11/ruby/rubymacros.swg b/share/swig/3.0.12/ruby/rubymacros.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubymacros.swg rename to share/swig/3.0.12/ruby/rubymacros.swg
diff --git a/share/swig/2.0.11/ruby/rubyopers.swg b/share/swig/3.0.12/ruby/rubyopers.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyopers.swg rename to share/swig/3.0.12/ruby/rubyopers.swg
diff --git a/share/swig/2.0.11/ruby/rubyprimtypes.swg b/share/swig/3.0.12/ruby/rubyprimtypes.swg similarity index 89% rename from share/swig/2.0.11/ruby/rubyprimtypes.swg rename to share/swig/3.0.12/ruby/rubyprimtypes.swg index df72e97..3a84819 100644 --- a/share/swig/2.0.11/ruby/rubyprimtypes.swg +++ b/share/swig/3.0.12/ruby/rubyprimtypes.swg
@@ -124,15 +124,20 @@ %fragment(SWIG_From_frag(long long),"header", fragment=SWIG_From_frag(long), - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE VALUE SWIG_From_dec(long long)(long long value) { return LL2NUM(value); } +%#endif } -%fragment(SWIG_AsVal_frag(long long),"header",fragment="SWIG_ruby_failed") { +%fragment(SWIG_AsVal_frag(long long),"header", + fragment="SWIG_ruby_failed", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE %ruby_aux_method(long long, NUM2LL, type == T_FIXNUM ? NUM2LL(obj) : rb_big2ll(obj)) SWIGINTERN int @@ -151,21 +156,26 @@ } return SWIG_TypeError; } +%#endif } /* unsigned long long */ %fragment(SWIG_From_frag(unsigned long long),"header", - fragment=SWIG_From_frag(long long), - fragment="<limits.h>") { + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE VALUE SWIG_From_dec(unsigned long long)(unsigned long long value) { return ULL2NUM(value); } +%#endif } -%fragment(SWIG_AsVal_frag(unsigned long long),"header",fragment="SWIG_ruby_failed") { +%fragment(SWIG_AsVal_frag(unsigned long long),"header", + fragment="SWIG_ruby_failed", + fragment="SWIG_LongLongAvailable") { +%#ifdef SWIG_LONG_LONG_AVAILABLE %ruby_aux_method(long long, NUM2ULL, type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj)) SWIGINTERN int @@ -184,6 +194,7 @@ } return SWIG_TypeError; } +%#endif } /* double */ @@ -193,7 +204,7 @@ } %fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") { -%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj)) +%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj); (void)type) SWIGINTERN int SWIG_AsVal_dec(double)(VALUE obj, double *val)
diff --git a/share/swig/2.0.11/ruby/rubyrun.swg b/share/swig/3.0.12/ruby/rubyrun.swg similarity index 92% rename from share/swig/2.0.11/ruby/rubyrun.swg rename to share/swig/3.0.12/ruby/rubyrun.swg index e851b18..249494a 100644 --- a/share/swig/2.0.11/ruby/rubyrun.swg +++ b/share/swig/3.0.12/ruby/rubyrun.swg
@@ -14,7 +14,7 @@ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags) #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own) -#define swig_owntype ruby_owntype +#define swig_owntype swig_ruby_owntype /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags) @@ -151,14 +151,13 @@ SWIGRUNTIME void SWIG_Ruby_define_class(swig_type_info *type) { - VALUE klass; char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); sprintf(klass_name, "TYPE%s", type->name); if (NIL_P(_cSWIG_Pointer)) { _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); free((void *) klass_name); } @@ -239,22 +238,24 @@ } /* Acquire a pointer value */ -typedef void (*ruby_owntype)(void*); +typedef struct { + void (*datafree)(void *); + int own; +} swig_ruby_owntype; -SWIGRUNTIME ruby_owntype -SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) { +SWIGRUNTIME swig_ruby_owntype +SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) { + swig_ruby_owntype oldown = {0, 0}; if (obj) { - ruby_owntype oldown = RDATA(obj)->dfree; - RDATA(obj)->dfree = own; - return oldown; - } else { - return 0; + oldown.datafree = RDATA(obj)->dfree; + RDATA(obj)->dfree = own.datafree; } + return oldown; } /* Convert a pointer value */ SWIGRUNTIME int -SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own) +SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own) { char *c; swig_cast_info *tc; @@ -262,7 +263,8 @@ /* Grab the pointer */ if (NIL_P(obj)) { - *ptr = 0; + if (ptr) + *ptr = 0; return SWIG_OK; } else { if (TYPE(obj) != T_DATA) { @@ -271,7 +273,10 @@ Data_Get_Struct(obj, void, vptr); } - if (own) *own = RDATA(obj)->dfree; + if (own) { + own->datafree = RDATA(obj)->dfree; + own->own = 0; + } /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we @@ -306,8 +311,6 @@ /* The object has already been deleted */ return SWIG_ObjectPreviouslyDeletedError; } - *ptr = vptr; - return SWIG_OK; } } if ((c = SWIG_MangleStr(obj)) == NULL) { @@ -317,12 +320,23 @@ if (!tc) { return SWIG_ERROR; } else { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc, vptr, &newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ + if (ptr) { + if (tc->type == ty) { + *ptr = vptr; + } else { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, vptr, &newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + own->own = own->own | SWIG_CAST_NEW_MEMORY; + } + } + } } } else { - *ptr = vptr; + if (ptr) + *ptr = vptr; } return SWIG_OK;
diff --git a/share/swig/2.0.11/ruby/rubyruntime.swg b/share/swig/3.0.12/ruby/rubyruntime.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyruntime.swg rename to share/swig/3.0.12/ruby/rubyruntime.swg
diff --git a/share/swig/2.0.11/ruby/rubystdautodoc.swg b/share/swig/3.0.12/ruby/rubystdautodoc.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubystdautodoc.swg rename to share/swig/3.0.12/ruby/rubystdautodoc.swg
diff --git a/share/swig/2.0.11/ruby/rubystdcommon.swg b/share/swig/3.0.12/ruby/rubystdcommon.swg similarity index 96% rename from share/swig/2.0.11/ruby/rubystdcommon.swg rename to share/swig/3.0.12/ruby/rubystdcommon.swg index b4ae3a3..f72745b 100644 --- a/share/swig/2.0.11/ruby/rubystdcommon.swg +++ b/share/swig/3.0.12/ruby/rubystdcommon.swg
@@ -53,7 +53,8 @@ struct traits_asptr { static int asptr(VALUE obj, Type **val) { Type *p; - int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = p; }
diff --git a/share/swig/2.0.11/ruby/rubystdfunctors.swg b/share/swig/3.0.12/ruby/rubystdfunctors.swg similarity index 93% rename from share/swig/2.0.11/ruby/rubystdfunctors.swg rename to share/swig/3.0.12/ruby/rubystdfunctors.swg index f2050b6..5150333 100644 --- a/share/swig/2.0.11/ruby/rubystdfunctors.swg +++ b/share/swig/3.0.12/ruby/rubystdfunctors.swg
@@ -90,7 +90,7 @@ static ID call_id = rb_intern("call"); template <class _T = GC_VALUE, class _DefaultFunc = std::less<GC_VALUE> > - struct BinaryPredicate : GC_VALUE, std::binary_function< _T, _T, bool > + struct BinaryPredicate : GC_VALUE { BinaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { } bool operator()(_T a, _T b) const @@ -109,7 +109,7 @@ }; template <class _T = GC_VALUE, class _DefaultFunc = std::less< _T > > - struct BinaryFunction : GC_VALUE, std::binary_function< _T, _T, _T > + struct BinaryFunction : GC_VALUE { BinaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { } _T operator()(_T a, _T b) const @@ -128,7 +128,7 @@ }; template< class _T = GC_VALUE > - struct UnaryPredicate : GC_VALUE, std::unary_function< _T, bool > + struct UnaryPredicate : GC_VALUE { UnaryPredicate(VALUE obj = Qnil) : GC_VALUE(obj) { } bool operator()(_T a) const @@ -142,7 +142,7 @@ }; template< class _T = GC_VALUE > - struct UnaryFunction : GC_VALUE, std::unary_function< _T, _T > + struct UnaryFunction : GC_VALUE { UnaryFunction(VALUE obj = Qnil) : GC_VALUE(obj) { } _T operator()(_T a) const
diff --git a/share/swig/2.0.11/ruby/rubystrings.swg b/share/swig/3.0.12/ruby/rubystrings.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubystrings.swg rename to share/swig/3.0.12/ruby/rubystrings.swg
diff --git a/share/swig/3.0.12/ruby/rubytracking.swg b/share/swig/3.0.12/ruby/rubytracking.swg new file mode 100644 index 0000000..8f9f01b --- /dev/null +++ b/share/swig/3.0.12/ruby/rubytracking.swg
@@ -0,0 +1,131 @@ +/* ----------------------------------------------------------------------------- + * rubytracking.swg + * + * This file contains support for tracking mappings from + * Ruby objects to C++ objects. This functionality is needed + * to implement mark functions for Ruby's mark and sweep + * garbage collector. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(ST_DATA_T_DEFINED) +/* Needs to be explicitly included for Ruby 1.8 and earlier */ +#include <st.h> +#endif + +/* Ruby 1.8 actually assumes the first case. */ +#if SIZEOF_VOIDP == SIZEOF_LONG +# define SWIG2NUM(v) LONG2NUM((unsigned long)v) +# define NUM2SWIG(x) (unsigned long)NUM2LONG(x) +#elif SIZEOF_VOIDP == SIZEOF_LONG_LONG +# define SWIG2NUM(v) LL2NUM((unsigned long long)v) +# define NUM2SWIG(x) (unsigned long long)NUM2LL(x) +#else +# error sizeof(void*) is not the same as long or long long +#endif + +/* Global hash table to store Trackings from C/C++ + structs to Ruby Objects. +*/ +static st_table* swig_ruby_trackings = NULL; + +static VALUE swig_ruby_trackings_count(ANYARGS) { + return SWIG2NUM(swig_ruby_trackings->num_entries); +} + + +/* Setup a hash table to store Trackings */ +SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { + /* Create a hash table to store Trackings from C++ + objects to Ruby objects. */ + + /* Try to see if some other .so has already created a + tracking hash table, which we keep hidden in an instance var + in the SWIG module. + This is done to allow multiple DSOs to share the same + tracking table. + */ + VALUE trackings_value = Qnil; + /* change the variable name so that we can mix modules + compiled with older SWIG's - this used to be called "@__trackings__" */ + ID trackings_id = rb_intern( "@__safetrackings__" ); + VALUE verbose = rb_gv_get("VERBOSE"); + rb_gv_set("VERBOSE", Qfalse); + trackings_value = rb_ivar_get( _mSWIG, trackings_id ); + rb_gv_set("VERBOSE", verbose); + + /* The trick here is that we have to store the hash table + pointer in a Ruby variable. We do not want Ruby's GC to + treat this pointer as a Ruby object, so we convert it to + a Ruby numeric value. */ + if (trackings_value == Qnil) { + /* No, it hasn't. Create one ourselves */ + swig_ruby_trackings = st_init_numtable(); + rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) ); + } else { + swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value); + } + + rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL); +} + +/* Add a Tracking from a C/C++ struct to a Ruby object */ +SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { + /* Store the mapping to the global hash table. */ + st_insert(swig_ruby_trackings, (st_data_t)ptr, object); +} + +/* Get the Ruby object that owns the specified C/C++ struct */ +SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { + /* Now lookup the value stored in the global hash table */ + VALUE value; + + if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) { + return value; + } else { + return Qnil; + } +} + +/* Remove a Tracking from a C/C++ struct to a Ruby object. It + is very important to remove objects once they are destroyed + since the same memory address may be reused later to create + a new object. */ +SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { + /* Delete the object from the hash table */ + st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL); +} + +/* This is a helper method that unlinks a Ruby object from its + underlying C++ object. This is needed if the lifetime of the + Ruby object is longer than the C++ object */ +SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { + VALUE object = SWIG_RubyInstanceFor(ptr); + + if (object != Qnil) { + if (TYPE(object) != T_DATA) + abort(); + DATA_PTR(object) = 0; + } +} + +/* This is a helper method that iterates over all the trackings + passing the C++ object pointer and its related Ruby object + to the passed callback function. */ + +/* Proxy method to abstract the internal trackings datatype */ +static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) { + (*meth)(ptr, obj); + return ST_CONTINUE; +} + +SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) { + st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth); +} + +#ifdef __cplusplus +} +#endif
diff --git a/share/swig/2.0.11/ruby/rubytypemaps.swg b/share/swig/3.0.12/ruby/rubytypemaps.swg similarity index 97% rename from share/swig/2.0.11/ruby/rubytypemaps.swg rename to share/swig/3.0.12/ruby/rubytypemaps.swg index 336ee97..3837df0 100644 --- a/share/swig/2.0.11/ruby/rubytypemaps.swg +++ b/share/swig/3.0.12/ruby/rubytypemaps.swg
@@ -8,7 +8,7 @@ #undef SWIG_TYPECHECK_BOOL %define SWIG_TYPECHECK_BOOL 10000 %enddef -/* Include fundamental fragemt definitions */ +/* Include fundamental fragment definitions */ %include <typemaps/fragments.swg> /* Look for user fragments file. */
diff --git a/share/swig/2.0.11/ruby/rubyuserdir.swg b/share/swig/3.0.12/ruby/rubyuserdir.swg similarity index 100% rename from share/swig/2.0.11/ruby/rubyuserdir.swg rename to share/swig/3.0.12/ruby/rubyuserdir.swg
diff --git a/share/swig/2.0.11/ruby/rubywstrings.swg b/share/swig/3.0.12/ruby/rubywstrings.swg similarity index 93% rename from share/swig/2.0.11/ruby/rubywstrings.swg rename to share/swig/3.0.12/ruby/rubywstrings.swg index bb44fbc..b6dd937 100644 --- a/share/swig/2.0.11/ruby/rubywstrings.swg +++ b/share/swig/3.0.12/ruby/rubywstrings.swg
@@ -11,7 +11,7 @@ * utility methods for wchar_t strings * ------------------------------------------------------------ */ -%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor") { +%fragment("SWIG_AsWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_AsCharPtrAndSize") { SWIGINTERN int SWIG_AsWCharPtrAndSize(VALUE obj, wchar_t **cptr, size_t *psize, int *alloc) { @@ -50,7 +50,7 @@ } } -%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor") { +%fragment("SWIG_FromWCharPtrAndSize","header",fragment="<wchar.h>",fragment="SWIG_pwchar_descriptor",fragment="SWIG_FromCharPtrAndSize") { SWIGINTERNINLINE VALUE SWIG_FromWCharPtrAndSize(const wchar_t * carray, size_t size) {
diff --git a/share/swig/2.0.11/ruby/std_alloc.i b/share/swig/3.0.12/ruby/std_alloc.i similarity index 100% rename from share/swig/2.0.11/ruby/std_alloc.i rename to share/swig/3.0.12/ruby/std_alloc.i
diff --git a/share/swig/3.0.12/ruby/std_array.i b/share/swig/3.0.12/ruby/std_array.i new file mode 100644 index 0000000..a4d3ef5 --- /dev/null +++ b/share/swig/3.0.12/ruby/std_array.i
@@ -0,0 +1,102 @@ +/* + std::array +*/ + +%fragment("StdArrayTraits","header",fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T, size_t N> + struct traits_asptr<std::array<T, N> > { + static int asptr(VALUE obj, std::array<T, N> **vec) { + return traits_asptr_stdseq<std::array<T, N> >::asptr(obj, vec); + } + }; + + template <class T, size_t N> + struct traits_from<std::array<T, N> > { + static VALUE from(const std::array<T, N>& vec) { + return traits_from_stdseq<std::array<T, N> >::from(vec); + } + }; + + template <class RubySeq, class T, size_t N> + inline void + assign(const RubySeq& rubyseq, std::array<T, N>* seq) { + if (rubyseq.size() < seq->size()) + throw std::invalid_argument("std::array cannot be expanded in size"); + else if (rubyseq.size() > seq->size()) + throw std::invalid_argument("std::array cannot be reduced in size"); + std::copy(rubyseq.begin(), rubyseq.end(), seq->begin()); + } + + template <class T, size_t N> + inline void + resize(std::array<T, N> *seq, typename std::array<T, N>::size_type n, typename std::array<T, N>::value_type x) { + throw std::invalid_argument("std::array is a fixed size container and does not support resizing"); + } + + // Only limited slicing is supported as std::array is fixed in size + template <class T, size_t N, class Difference> + inline std::array<T, N>* + getslice(const std::array<T, N>* self, Difference i, Difference j) { + typedef std::array<T, N> Sequence; + typename Sequence::size_type size = self->size(); + typename Sequence::size_type ii = swig::check_index(i, size, (i == size && j == size)); + typename Sequence::size_type jj = swig::slice_index(j, size); + + if (ii == 0 && jj == size) { + Sequence *sequence = new Sequence(); + std::copy(self->begin(), self->end(), sequence->begin()); + return sequence; + } else { + throw std::invalid_argument("std::array object only supports getting a slice that is the size of the array"); + } + } + + template <class T, size_t N, class Difference, class InputSeq> + inline void + setslice(std::array<T, N>* self, Difference i, Difference j, const InputSeq& v) { + typedef std::array<T, N> Sequence; + typename Sequence::size_type size = self->size(); + typename Sequence::size_type ii = swig::check_index(i, size, true); + typename Sequence::size_type jj = swig::slice_index(j, size); + + if (ii == 0 && jj == size) { + std::copy(v.begin(), v.end(), self->begin()); + } else { + throw std::invalid_argument("std::array object only supports setting a slice that is the size of the array"); + } + } + + template <class T, size_t N, class Difference> + inline void + delslice(std::array<T, N>* self, Difference i, Difference j) { + throw std::invalid_argument("std::array object does not support item deletion"); + } + } +%} + + +%define %swig_array_methods(Type...) + %swig_sequence_methods_non_resizable(Type) +%enddef + +%define %swig_array_methods_val(Type...) + %swig_sequence_methods_non_resizable_val(Type); +%enddef + + +%mixin std::array "Enumerable"; +%ignore std::array::push_back; +%ignore std::array::pop_back; + + +%rename("delete") std::array::__delete__; +%rename("reject!") std::array::reject_bang; +%rename("map!") std::array::map_bang; +%rename("empty?") std::array::empty; +%rename("include?" ) std::array::__contains__ const; +%rename("has_key?" ) std::array::has_key const; + +%include <std/std_array.i> +
diff --git a/share/swig/2.0.11/ruby/std_basic_string.i b/share/swig/3.0.12/ruby/std_basic_string.i similarity index 100% rename from share/swig/2.0.11/ruby/std_basic_string.i rename to share/swig/3.0.12/ruby/std_basic_string.i
diff --git a/share/swig/2.0.11/ruby/std_char_traits.i b/share/swig/3.0.12/ruby/std_char_traits.i similarity index 100% rename from share/swig/2.0.11/ruby/std_char_traits.i rename to share/swig/3.0.12/ruby/std_char_traits.i
diff --git a/share/swig/2.0.11/ruby/std_common.i b/share/swig/3.0.12/ruby/std_common.i similarity index 85% rename from share/swig/2.0.11/ruby/std_common.i rename to share/swig/3.0.12/ruby/std_common.i index 14fba0d..0cf9ce1 100644 --- a/share/swig/2.0.11/ruby/std_common.i +++ b/share/swig/3.0.12/ruby/std_common.i
@@ -14,17 +14,17 @@ fragment=SWIG_From_frag(Type), fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef value_category category; static const char* type_name() { return #Type; } - }; - template <> struct traits_asval<Type > { + }; + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(VALUE obj, value_type *val) { + static int asval(VALUE obj, value_type *val) { return SWIG_AsVal(Type)(obj, val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static VALUE from(const value_type& val) { return SWIG_From(Type)(val); @@ -47,13 +47,13 @@ fragment=SWIG_From_frag(int), fragment="StdTraits") { namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(VALUE obj, value_type *val) { + static int asval(VALUE obj, value_type *val) { return SWIG_AsVal(int)(obj, (int *)val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; static VALUE from(const value_type& val) { return SWIG_From(int)((int)val);
diff --git a/share/swig/2.0.11/ruby/std_complex.i b/share/swig/3.0.12/ruby/std_complex.i similarity index 100% rename from share/swig/2.0.11/ruby/std_complex.i rename to share/swig/3.0.12/ruby/std_complex.i
diff --git a/share/swig/2.0.11/ruby/std_container.i b/share/swig/3.0.12/ruby/std_container.i similarity index 100% rename from share/swig/2.0.11/ruby/std_container.i rename to share/swig/3.0.12/ruby/std_container.i
diff --git a/share/swig/2.0.11/ruby/std_deque.i b/share/swig/3.0.12/ruby/std_deque.i similarity index 100% rename from share/swig/2.0.11/ruby/std_deque.i rename to share/swig/3.0.12/ruby/std_deque.i
diff --git a/share/swig/2.0.11/ruby/std_except.i b/share/swig/3.0.12/ruby/std_except.i similarity index 100% rename from share/swig/2.0.11/ruby/std_except.i rename to share/swig/3.0.12/ruby/std_except.i
diff --git a/share/swig/2.0.11/ruby/std_functors.i b/share/swig/3.0.12/ruby/std_functors.i similarity index 100% rename from share/swig/2.0.11/ruby/std_functors.i rename to share/swig/3.0.12/ruby/std_functors.i
diff --git a/share/swig/2.0.11/ruby/std_ios.i b/share/swig/3.0.12/ruby/std_ios.i similarity index 100% rename from share/swig/2.0.11/ruby/std_ios.i rename to share/swig/3.0.12/ruby/std_ios.i
diff --git a/share/swig/2.0.11/ruby/std_iostream.i b/share/swig/3.0.12/ruby/std_iostream.i similarity index 100% rename from share/swig/2.0.11/ruby/std_iostream.i rename to share/swig/3.0.12/ruby/std_iostream.i
diff --git a/share/swig/2.0.11/ruby/std_list.i b/share/swig/3.0.12/ruby/std_list.i similarity index 100% rename from share/swig/2.0.11/ruby/std_list.i rename to share/swig/3.0.12/ruby/std_list.i
diff --git a/share/swig/2.0.11/ruby/std_map.i b/share/swig/3.0.12/ruby/std_map.i similarity index 98% rename from share/swig/2.0.11/ruby/std_map.i rename to share/swig/3.0.12/ruby/std_map.i index f706ca8..7077fa1 100644 --- a/share/swig/2.0.11/ruby/std_map.i +++ b/share/swig/3.0.12/ruby/std_map.i
@@ -100,7 +100,8 @@ res = traits_asptr_stdseq<std::map<K,T>, std::pair<K, T> >::asptr(items, val); } else { map_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0); + swig_type_info *descriptor = swig::type_info<map_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } return res;
diff --git a/share/swig/2.0.11/ruby/std_multimap.i b/share/swig/3.0.12/ruby/std_multimap.i similarity index 100% rename from share/swig/2.0.11/ruby/std_multimap.i rename to share/swig/3.0.12/ruby/std_multimap.i
diff --git a/share/swig/2.0.11/ruby/std_multiset.i b/share/swig/3.0.12/ruby/std_multiset.i similarity index 100% rename from share/swig/2.0.11/ruby/std_multiset.i rename to share/swig/3.0.12/ruby/std_multiset.i
diff --git a/share/swig/2.0.11/ruby/std_pair.i b/share/swig/3.0.12/ruby/std_pair.i similarity index 91% rename from share/swig/2.0.11/ruby/std_pair.i rename to share/swig/3.0.12/ruby/std_pair.i index 5b4c8ba..38a4ffb 100644 --- a/share/swig/2.0.11/ruby/std_pair.i +++ b/share/swig/3.0.12/ruby/std_pair.i
@@ -31,7 +31,7 @@ int res2 = swig::asval((VALUE)second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; - } + } } static int asval(VALUE obj, std::pair<T,U> *val) { @@ -44,8 +44,8 @@ } } else { value_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = *p; } return res; @@ -63,10 +63,16 @@ value_type *vp = %new_instance(std::pair<T,U>); T *pfirst = &(vp->first); int res1 = swig::asval((VALUE)first, pfirst); - if (!SWIG_IsOK(res1)) return res1; + if (!SWIG_IsOK(res1)) { + %delete(vp); + return res1; + } U *psecond = &(vp->second); int res2 = swig::asval((VALUE)second, psecond); - if (!SWIG_IsOK(res2)) return res2; + if (!SWIG_IsOK(res2)) { + %delete(vp); + return res2; + } *val = vp; return SWIG_AddNewMask(res1 > res2 ? res1 : res2); } else { @@ -77,7 +83,7 @@ int res2 = swig::asval((VALUE)second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; - } + } } static int asptr(VALUE obj, std::pair<T,U> **val) { @@ -90,8 +96,8 @@ } } else { value_type *p; - res = SWIG_ConvertPtr(obj,(void**)&p, - swig::type_info<value_type>(),0); + swig_type_info *descriptor = swig::type_info<value_type>(); + res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; } return res;
diff --git a/share/swig/2.0.11/ruby/std_queue.i b/share/swig/3.0.12/ruby/std_queue.i similarity index 100% rename from share/swig/2.0.11/ruby/std_queue.i rename to share/swig/3.0.12/ruby/std_queue.i
diff --git a/share/swig/2.0.11/ruby/std_set.i b/share/swig/3.0.12/ruby/std_set.i similarity index 100% rename from share/swig/2.0.11/ruby/std_set.i rename to share/swig/3.0.12/ruby/std_set.i
diff --git a/share/swig/2.0.11/csharp/std_shared_ptr.i b/share/swig/3.0.12/ruby/std_shared_ptr.i similarity index 100% copy from share/swig/2.0.11/csharp/std_shared_ptr.i copy to share/swig/3.0.12/ruby/std_shared_ptr.i
diff --git a/share/swig/2.0.11/ruby/std_sstream.i b/share/swig/3.0.12/ruby/std_sstream.i similarity index 100% rename from share/swig/2.0.11/ruby/std_sstream.i rename to share/swig/3.0.12/ruby/std_sstream.i
diff --git a/share/swig/2.0.11/ruby/std_stack.i b/share/swig/3.0.12/ruby/std_stack.i similarity index 100% rename from share/swig/2.0.11/ruby/std_stack.i rename to share/swig/3.0.12/ruby/std_stack.i
diff --git a/share/swig/2.0.11/ruby/std_streambuf.i b/share/swig/3.0.12/ruby/std_streambuf.i similarity index 100% rename from share/swig/2.0.11/ruby/std_streambuf.i rename to share/swig/3.0.12/ruby/std_streambuf.i
diff --git a/share/swig/2.0.11/ruby/std_string.i b/share/swig/3.0.12/ruby/std_string.i similarity index 100% rename from share/swig/2.0.11/ruby/std_string.i rename to share/swig/3.0.12/ruby/std_string.i
diff --git a/share/swig/2.0.11/ruby/std_vector.i b/share/swig/3.0.12/ruby/std_vector.i similarity index 100% rename from share/swig/2.0.11/ruby/std_vector.i rename to share/swig/3.0.12/ruby/std_vector.i
diff --git a/share/swig/2.0.11/ruby/std_vectora.i b/share/swig/3.0.12/ruby/std_vectora.i similarity index 100% rename from share/swig/2.0.11/ruby/std_vectora.i rename to share/swig/3.0.12/ruby/std_vectora.i
diff --git a/share/swig/2.0.11/ruby/std_wstring.i b/share/swig/3.0.12/ruby/std_wstring.i similarity index 100% rename from share/swig/2.0.11/ruby/std_wstring.i rename to share/swig/3.0.12/ruby/std_wstring.i
diff --git a/share/swig/2.0.11/ruby/stl.i b/share/swig/3.0.12/ruby/stl.i similarity index 100% rename from share/swig/2.0.11/ruby/stl.i rename to share/swig/3.0.12/ruby/stl.i
diff --git a/share/swig/2.0.11/ruby/timeval.i b/share/swig/3.0.12/ruby/timeval.i similarity index 100% rename from share/swig/2.0.11/ruby/timeval.i rename to share/swig/3.0.12/ruby/timeval.i
diff --git a/share/swig/2.0.11/ruby/typemaps.i b/share/swig/3.0.12/ruby/typemaps.i similarity index 100% rename from share/swig/2.0.11/ruby/typemaps.i rename to share/swig/3.0.12/ruby/typemaps.i
diff --git a/share/swig/2.0.11/runtime.swg b/share/swig/3.0.12/runtime.swg similarity index 100% rename from share/swig/2.0.11/runtime.swg rename to share/swig/3.0.12/runtime.swg
diff --git a/share/swig/2.0.11/python/boost_shared_ptr.i b/share/swig/3.0.12/scilab/boost_shared_ptr.i similarity index 98% copy from share/swig/2.0.11/python/boost_shared_ptr.i copy to share/swig/3.0.12/scilab/boost_shared_ptr.i index 100ed3e..b90422a 100644 --- a/share/swig/2.0.11/python/boost_shared_ptr.i +++ b/share/swig/3.0.12/scilab/boost_shared_ptr.i
@@ -6,10 +6,6 @@ #define SHARED_PTR_DISOWN 0 #endif -%fragment("SWIG_null_deleter_python", "header", fragment="SWIG_null_deleter") { -%#define SWIG_NO_NULL_DELETER_SWIG_BUILTIN_INIT -} - // Language specific macro implementing all the customisations for handling the smart pointer %define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...) @@ -51,7 +47,7 @@ %variable_fail(res, "$type", "$name"); } if (!argp) { - %argument_nullref("$type", $symname, $argnum); + %variable_nullref("$type", "$name"); } else { $1 = *(%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)->get()); if (newmem & SWIG_CAST_NEW_MEMORY) delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); @@ -137,7 +133,9 @@ %variable_fail(res, "$type", "$name"); } SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared; - if (!argp) { %argument_nullref("$type", $symname, $argnum); } + if (!argp) { + %variable_nullref("$type", "$name"); + } if (newmem & SWIG_CAST_NEW_MEMORY) { tempshared = *%reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *); delete %reinterpret_cast(argp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *);
diff --git a/share/swig/2.0.11/octave/carrays.i b/share/swig/3.0.12/scilab/carrays.i similarity index 100% copy from share/swig/2.0.11/octave/carrays.i copy to share/swig/3.0.12/scilab/carrays.i
diff --git a/share/swig/2.0.11/octave/cmalloc.i b/share/swig/3.0.12/scilab/cmalloc.i similarity index 100% copy from share/swig/2.0.11/octave/cmalloc.i copy to share/swig/3.0.12/scilab/cmalloc.i
diff --git a/share/swig/2.0.11/perl5/cpointer.i b/share/swig/3.0.12/scilab/cpointer.i similarity index 100% copy from share/swig/2.0.11/perl5/cpointer.i copy to share/swig/3.0.12/scilab/cpointer.i
diff --git a/share/swig/3.0.12/scilab/exception.i b/share/swig/3.0.12/scilab/exception.i new file mode 100644 index 0000000..17f4175 --- /dev/null +++ b/share/swig/3.0.12/scilab/exception.i
@@ -0,0 +1,6 @@ +%include <typemaps/exception.swg> + + +%insert("runtime") { + %define_as(SWIG_exception(code, msg), SWIG_Scilab_Error(code, msg);) +}
diff --git a/share/swig/3.0.12/scilab/matrix.i b/share/swig/3.0.12/scilab/matrix.i new file mode 100644 index 0000000..0936d93 --- /dev/null +++ b/share/swig/3.0.12/scilab/matrix.i
@@ -0,0 +1,11 @@ +/* + * Matrix typemaps + * + */ + +%include <scimatrixdouble.swg> +%include <scimatrixint.swg> +%include <scimatrixchar.swg> +%include <scimatrixbool.swg> + +
diff --git a/share/swig/3.0.12/scilab/sciarray.swg b/share/swig/3.0.12/scilab/sciarray.swg new file mode 100644 index 0000000..c00e383 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciarray.swg
@@ -0,0 +1,115 @@ +/* -------------------------------------------------------------------------- + * + * Arrays typemaps + * + * --------------------------------------------------------------------------*/ + +%{ +#include <stdio.h> +%} + +%define %scilab_asarray_withallocatecopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) +%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { + size_t i = 0; + int iRows = 0; + int iCols = 0; + TEMPDATATYPE *pTempData = NULL; + if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { + return SWIG_ERROR; + } + $1 = ($1_ltype)MALLOC(sizeof($*1_ltype) * iRows * iCols); + for (i = 0; i < iRows * iCols; i++) { + $1[i] = ($*1_ltype) pTempData[i]; + } +} +%enddef + +%define %scilab_asarrayandsize_withcopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) +%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { + int iRows = 0; + int iCols = 0; + TEMPDATATYPE *pTempData = NULL; + if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { + return SWIG_ERROR; + } + if (iRows*iCols <= $1_dim0) { + size_t i; + for (i = 0; i < $1_dim0; i++) { + $1[i] = ($*1_ltype) pTempData[i]; + } + } + else { + char errmsg[100]; + sprintf(errmsg, "Size of input data (%d) is too big (maximum is %d)", + iRows*iCols, $1_dim0); + SWIG_exception_fail(SWIG_OverflowError, errmsg); + } +} +%enddef + +%define %scilab_fromarrayandsize(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + %set_output(FRAGMENTNAME(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%enddef + +%define %scilab_array_typemaps(CTYPE, ASARRAY_FRAGMENT, FROMARRAY_FRAGMENT, TEMPDATATYPE) + %scilab_asarrayandsize_withcopy(varin, ASARRAY_FRAGMENT, CTYPE[ANY], TEMPDATATYPE); + %scilab_asarray_withallocatecopy(in, ASARRAY_FRAGMENT, CTYPE[ANY], TEMPDATATYPE); + %scilab_fromarrayandsize(varout, FROMARRAY_FRAGMENT, CTYPE[ANY]); + %scilab_fromarrayandsize(out, FROMARRAY_FRAGMENT, CTYPE[ANY]); + + %apply SWIGTYPE[] { CTYPE[] }; + %scilab_asarray_withallocatecopy(in, ASARRAY_FRAGMENT, CTYPE[], TEMPDATATYPE); +%enddef + + +// Double +%scilab_array_typemaps(double, SWIG_SciDouble_AsDoubleArrayAndSize, + SWIG_SciDouble_FromDoubleArrayAndSize, double); + +// Signed char + +%scilab_array_typemaps(signed char, SWIG_SciDoubleOrInt8_AsSignedCharArrayAndSize, + SWIG_SciDouble_FromSignedCharArrayAndSize, signed char); + +// Unsigned char +%scilab_array_typemaps(unsigned char, SWIG_SciDoubleOrUint8_AsUnsignedCharArrayAndSize, + SWIG_SciDouble_FromUnsignedCharArrayAndSize, unsigned char); + +// Short +%scilab_array_typemaps(short, SWIG_SciDoubleOrInt16_AsShortArrayAndSize, + SWIG_SciDouble_FromShortArrayAndSize, short); + +// Unsigned short +%scilab_array_typemaps(unsigned short, SWIG_SciDoubleOrUint16_AsUnsignedShortArrayAndSize, + SWIG_SciDouble_FromUnsignedShortArrayAndSize, unsigned short); + +// Int +%scilab_array_typemaps(int, SWIG_SciDoubleOrInt32_AsIntArrayAndSize, + SWIG_SciDouble_FromIntArrayAndSize, int); + +// Unsigned int +%scilab_array_typemaps(unsigned int, SWIG_SciDoubleOrUint32_AsUnsignedIntArrayAndSize, + SWIG_SciDouble_FromUnsignedIntArrayAndSize, unsigned int); + +// Long +%scilab_array_typemaps(long, SWIG_SciDoubleOrInt32_AsIntArrayAndSize, + SWIG_SciDouble_FromLongArrayAndSize, int); + +// Unsigned long +%scilab_array_typemaps(unsigned long, SWIG_SciDoubleOrUint32_AsUnsignedIntArrayAndSize, + SWIG_SciDouble_FromUnsignedLongArrayAndSize, unsigned int); + +// Float +%scilab_array_typemaps(float, SWIG_SciDouble_AsFloatArrayAndSize, + SWIG_SciDouble_FromFloatArrayAndSize, float); + +// Bool +%scilab_array_typemaps(bool, SWIG_SciBoolean_AsIntArrayAndSize, + SWIG_SciBoolean_FromBoolArrayAndSize, int); + +// Char * +%scilab_array_typemaps(char *, SWIG_SciString_AsCharPtrArrayAndSize, + SWIG_SciString_FromCharPtrArrayAndSize, char *); +
diff --git a/share/swig/3.0.12/scilab/scibool.swg b/share/swig/3.0.12/scilab/scibool.swg new file mode 100644 index 0000000..9aed88e --- /dev/null +++ b/share/swig/3.0.12/scilab/scibool.swg
@@ -0,0 +1,156 @@ +/* + * C-type: bool + * Scilab type: boolean scalar + */ +%fragment(SWIG_AsVal_frag(bool), "header") { +SWIGINTERN int +SWIG_AsVal_dec(bool)(SwigSciObject iVar, bool *pbValue) { + SciErr sciErr; + int iRet = 0; + int *piAddrVar = NULL; + int iTempValue = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (!isBooleanType(pvApiCtx, piAddrVar)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A boolean expected.\n"), SWIG_Scilab_GetFuncName(), iVar); + return SWIG_ERROR; + } + + if (!isScalar(pvApiCtx, piAddrVar)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A boolean expected.\n"), SWIG_Scilab_GetFuncName(), iVar); + return SWIG_ERROR; + } + + iRet = getScalarBoolean(pvApiCtx, piAddrVar, &iTempValue); + if (iRet) { + return SWIG_ERROR; + } + + *pbValue = iTempValue; + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(bool), "header") { +SWIGINTERN int +SWIG_From_dec(bool)(bool bValue) { + if (createScalarBoolean(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + + SWIG_Scilab_GetOutputPosition(), bValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: bool[] + * Scilab type: boolean matrix + */ +%fragment("SWIG_SciBoolean_AsBoolArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciBoolean_AsBoolArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, bool **pbValue, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + int *piValue = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isBooleanType(pvApiCtx, piAddrVar)) { + int i; + sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVar, iRows, iCols, &piValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + *pbValue = (bool*) malloc((*iRows) * (*iCols) * sizeof(bool)); + for (i = 0; i < (*iRows) * (*iCols); i++) + (*pbValue)[i] = piValue[i] != 0; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A boolean matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciBoolean_FromBoolArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciBoolean_FromBoolArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, bool *pbValue) { + SciErr sciErr; + int *piValue = NULL; + int i; + + piValue = (int*) malloc(iRows * iCols * sizeof(int)); + for (i = 0; i < iRows * iCols; i++) + piValue[i] = pbValue[i]; + + sciErr = createMatrixOfBoolean(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, piValue); + if(sciErr.iErr) { + printError(&sciErr, 0); + free(piValue); + return SWIG_ERROR; + } + + free(piValue); + return SWIG_OK; +} +} + +/* + * C-type: int[] + * Scilab type: boolean matrix + */ +%fragment("SWIG_SciBoolean_AsIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciBoolean_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, int **piValue, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isBooleanType(pvApiCtx, piAddrVar)) { + sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVar, iRows, iCols, piValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A boolean matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciBoolean_FromIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciBoolean_FromIntArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, int *piValue) { + SciErr sciErr; + + sciErr = createMatrixOfBoolean(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, piValue); + if(sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scichar.swg b/share/swig/3.0.12/scilab/scichar.swg new file mode 100644 index 0000000..5edbf5b --- /dev/null +++ b/share/swig/3.0.12/scilab/scichar.swg
@@ -0,0 +1,292 @@ +/* + * C-type: char or char* + * Scilab type: string + */ + +/* + * CHAR + */ + +%fragment(SWIG_AsVal_frag(char), "header", fragment="SWIG_SciString_AsChar") { +#define SWIG_AsVal_char(scilabValue, valuePointer) SWIG_SciString_AsChar(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciString_AsChar", "header") { +SWIGINTERN int +SWIG_SciString_AsChar(void *pvApiCtx, int iVar, char *pcValue, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + char *pstValue = NULL; + int iRet; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isStringType(pvApiCtx, piAddrVar) == 0) + { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + iRet = getAllocatedSingleString(pvApiCtx, piAddrVar, &pstValue); + if (iRet) { + return SWIG_ERROR; + } + + if (pcValue != NULL) { + *pcValue = pstValue[0]; + } + + freeAllocatedSingleString(pstValue); + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(char), "header", fragment="SWIG_SciString_FromChar") { +#define SWIG_From_char(value) SWIG_SciString_FromChar(pvApiCtx, SWIG_Scilab_GetOutputPosition(), value) +} +%fragment("SWIG_SciString_FromChar", "header") { +SWIGINTERN int +SWIG_SciString_FromChar(void *pvApiCtx, int iVarOut, char chValue) { + char *pchValue = (char*)malloc(sizeof(char) * 2); + pchValue[0] = chValue; + pchValue[1] = '\0'; + + if (createSingleString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, pchValue)) + return SWIG_ERROR; + + free(pchValue); + return SWIG_OK; +} +} + +/* + * CHAR * +*/ + +%fragment("SWIG_AsCharArray", "header", fragment = "SWIG_SciString_AsCharPtr") { +#define SWIG_AsCharArray(scilabValue, charPtrPointer, charPtrLength) SWIG_SciString_AsCharPtr(pvApiCtx, scilabValue, charPtrPointer, charPtrLength, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciString_AsCharPtr", "header") { +SWIGINTERN int +SWIG_SciString_AsCharPtr(void *pvApiCtx, int iVar, char *pcValue, int iLength, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + char* pcTmpValue = NULL; + int iRet; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + iRet = getAllocatedSingleString(pvApiCtx, piAddrVar, &pcTmpValue); + if (iRet) { + return SWIG_ERROR; + } + + if (pcValue != NULL) { + strncpy(pcValue, pcTmpValue, iLength); + } + + freeAllocatedSingleString(pcTmpValue); + return SWIG_OK; +} +} + +%fragment("SWIG_AsCharPtrAndSize", "header", fragment = "SWIG_SciString_AsCharPtrAndSize") { +#define SWIG_AsCharPtrAndSize(scilabValue, charPtrPointer, charPtrLength, allocMemory) SWIG_SciString_AsCharPtrAndSize(pvApiCtx, scilabValue, charPtrPointer, charPtrLength, allocMemory, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciString_AsCharPtrAndSize", "header") { +SWIGINTERN int +SWIG_SciString_AsCharPtrAndSize(void *pvApiCtx, int iVar, char **pcValue, size_t *piLength, int *alloc, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + char *pstString = NULL; + int iRows = 0; + int iCols = 0; + int iLen = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isScalar(pvApiCtx, piAddrVar) == 0 || isStringType(pvApiCtx, piAddrVar) == 0) + { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, NULL); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + pstString = %new_array(iLen + 1, char); + + sciErr = getMatrixOfString(pvApiCtx, piAddrVar, &iRows, &iCols, &iLen, &pstString); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + // TODO: return SWIG_ERROR if pcValue NULL (now returning SWIG_ERROR fails some typechecks) + if (pcValue) { + *pcValue = pstString; + } + + if (alloc != NULL) { + *alloc = SWIG_NEWOBJ; + } + + if (piLength != NULL) { + *piLength = strlen(pstString); + } + + return SWIG_OK; +} +} + +%fragment("SWIG_FromCharPtr", "header", fragment = "SWIG_SciString_FromCharPtr") { +#define SWIG_FromCharPtr(charPtr) SWIG_SciString_FromCharPtr(pvApiCtx, SWIG_Scilab_GetOutputPosition(), charPtr) +} +%fragment("SWIG_SciString_FromCharPtr", "header") { +SWIGINTERN int +SWIG_SciString_FromCharPtr(void *pvApiCtx, int iVarOut, const char *pchValue) { + if (pchValue) { + SciErr sciErr; + const char* pstStrings[1]; + pstStrings[0] = pchValue; + + sciErr = createMatrixOfString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 1, 1, pstStrings); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + int iRet = createEmptyMatrix(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut); + if (iRet) { + return SWIG_ERROR; + } + } + + return SWIG_OK; +} +} + +/* + * CHAR * ARRAY + */ + +%fragment("SWIG_SciString_AsCharPtrArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciString_AsCharPtrArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, char ***charPtrArray, char *fname) { + SciErr sciErr; + int i = 0; + int *piAddrVar = NULL; + int* piLength = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getMatrixOfString(pvApiCtx, piAddrVar, iRows, iCols, NULL, NULL); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + piLength = (int*) malloc((*iRows) * (*iCols) * sizeof(int)); + + sciErr = getMatrixOfString(pvApiCtx, piAddrVar, iRows, iCols, piLength, NULL); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + *charPtrArray = (char**) malloc((*iRows) * (*iCols) * sizeof(char*)); + for(i = 0 ; i < (*iRows) * (*iCols); i++) { + (*charPtrArray)[i] = (char*) malloc(sizeof(char) * (piLength[i] + 1)); + } + + sciErr = getMatrixOfString(pvApiCtx, piAddrVar, iRows, iCols, piLength, *charPtrArray); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + free(piLength); + return SWIG_OK; +} +} + +%fragment("SWIG_SciString_FromCharPtrArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciString_FromCharPtrArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, char **charPtrArray) { + SciErr sciErr; + + sciErr = createMatrixOfString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, (const char* const*) charPtrArray); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_FromCharPtrAndSize", "header", fragment = "SWIG_SciString_FromCharPtr") { +#define SWIG_FromCharPtrAndSize(charPtr, charPtrLength) SWIG_SciString_FromCharPtr(pvApiCtx, SWIG_Scilab_GetOutputPosition(), charPtr) +} + + +/* + * Char* Scilab variable + */ + +%fragment(SWIG_CreateScilabVariable_frag(char), "wrapper") { +SWIGINTERN int +SWIG_CreateScilabVariable_dec(char)(void *pvApiCtx, const char* psVariableName, const char cVariableValue) { + SciErr sciErr; + char sValue[2]; + const char* psStrings[1]; + + sValue[0] = cVariableValue; + sValue[1] = '\0'; + psStrings[0] = sValue; + + sciErr = createNamedMatrixOfString(pvApiCtx, psVariableName, 1, 1, psStrings); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + return SWIG_OK; +} +} + +%fragment(SWIG_CreateScilabVariable_frag(charptr), "wrapper") { +SWIGINTERN int +SWIG_CreateScilabVariable_dec(charptr)(void *pvApiCtx, const char* psVariableName, const char* psVariableValue) { + SciErr sciErr; + const char* psStrings[1]; + psStrings[0] = psVariableValue; + + sciErr = createNamedMatrixOfString(pvApiCtx, psVariableName, 1, 1, psStrings); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scicontainer.swg b/share/swig/3.0.12/scilab/scicontainer.swg new file mode 100644 index 0000000..2cc44b8 --- /dev/null +++ b/share/swig/3.0.12/scilab/scicontainer.swg
@@ -0,0 +1,444 @@ +/* ----------------------------------------------------------------------------- + * scicontainer.swg + * + * Scilab list <-> C++ container wrapper + * + * This wrapper, and its iterator, allows a general use (and reuse) of + * the mapping between C++ and Scilab, thanks to the C++ templates. + * + * Of course, it needs the C++ compiler to support templates, but + * since we will use this wrapper with the STL containers, that should + * be the case. + * ----------------------------------------------------------------------------- */ + +%{ +#include <iostream> +%} + +#if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS) +# if !defined(SWIG_EXPORT_ITERATOR_METHODS) +# define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS +# endif +#endif + + +// #define (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS) +// if defined: sequences in return are converted from/to Scilab lists or matrices +// if not defined: sequences are passed from/to Scilab as pointers + +%{ +#define SWIG_STD_NOASSIGN_STL +%} + +%include <sciiterators.swg> +%include <scisequence.swg> + +%{ +#include <stdexcept> +%} + +%include <exception.i> +%include <std_except.i> + +%fragment("SciSequence_Cont", "header", + fragment="StdTraits", + fragment="SwigSciIterator_T") +{ +namespace swig +{ + template <class T> + struct SciSequence_Ref + { + SciSequence_Ref(const SwigSciObject& seq, int index) + : _seq(seq), _index(index) + { + if (traits_as_sequence<T>::get(_seq, &piSeqAddr) != SWIG_OK) + { + throw std::invalid_argument("Cannot get sequence data."); + } + } + + operator T () const + { + return traits_asval_sequenceitem<T>::asval(_seq, piSeqAddr, _index); + } + + SciSequence_Ref& operator=(const T& v) + { + // TODO + return *this; + } + + private: + SwigSciObject _seq; + int _index; + void *piSeqAddr; + }; + + + template <class T> + struct SciSequence_ArrowProxy + { + SciSequence_ArrowProxy(const T& x): m_value(x) {} + const T* operator->() const { return &m_value; } + operator const T*() const { return &m_value; } + T m_value; + }; + + template <class T, class Reference > + struct SwigSciSequence_InputIterator + { + typedef SwigSciSequence_InputIterator<T, Reference > self; + + typedef std::random_access_iterator_tag iterator_category; + typedef Reference reference; + typedef T value_type; + typedef T* pointer; + typedef int difference_type; + + SwigSciSequence_InputIterator() + { + } + + SwigSciSequence_InputIterator(const SwigSciObject& seq, int index) + : _seq(seq), _index(index) + { + } + + reference operator*() const + { + return reference(_seq, _index); + } + + SciSequence_ArrowProxy<T> + operator->() const { + return SciSequence_ArrowProxy<T>(operator*()); + } + + bool operator==(const self& ri) const + { + return (_index == ri._index); + } + + bool operator!=(const self& ri) const + { + return !(operator==(ri)); + } + + self& operator ++ () + { + ++_index; + return *this; + } + + self& operator -- () + { + --_index; + return *this; + } + + self& operator += (difference_type n) + { + _index += n; + return *this; + } + + self operator +(difference_type n) const + { + return self(_seq, _index + n); + } + + self& operator -= (difference_type n) + { + _index -= n; + return *this; + } + + self operator -(difference_type n) const + { + return self(_seq, _index - n); + } + + difference_type operator - (const self& ri) const + { + return _index - ri._index; + } + + bool operator < (const self& ri) const + { + return _index < ri._index; + } + + reference + operator[](difference_type n) const + { + return reference(_seq, _index + n); + } + + private: + SwigSciObject _seq; + difference_type _index; + }; + + template <class T> + struct SciSequence_Cont + { + typedef SciSequence_Ref<T> reference; + typedef const SciSequence_Ref<T> const_reference; + typedef T value_type; + typedef T* pointer; + typedef int difference_type; + typedef int size_type; + typedef const pointer const_pointer; + typedef SwigSciSequence_InputIterator<T, reference> iterator; + typedef SwigSciSequence_InputIterator<T, const_reference> const_iterator; + + SciSequence_Cont(const SwigSciObject& seq) : _seq(seq) + { + } + + ~SciSequence_Cont() + { + } + + size_type size() const + { + int iSeqSize; + if (traits_as_sequence<value_type>::size(_seq, &iSeqSize) == SWIG_OK) + { + return iSeqSize; + } + else + { + return SWIG_ERROR; + } + } + + bool empty() const + { + return size() == 0; + } + + iterator begin() + { + return iterator(_seq, 0); + } + + const_iterator begin() const + { + return const_iterator(_seq, 0); + } + + iterator end() + { + return iterator(_seq, size()); + } + + const_iterator end() const + { + return const_iterator(_seq, size()); + } + + reference operator[](difference_type n) + { + return reference(_seq, n); + } + + const_reference operator[](difference_type n) const + { + return const_reference(_seq, n); + } + + private: + SwigSciObject _seq; + }; +} +} + +%define %swig_sequence_iterator(Sequence...) +#if defined(SWIG_EXPORT_ITERATOR_METHODS) + class iterator; + class reverse_iterator; + class const_iterator; + class const_reverse_iterator; + + %typemap(out,noblock=1,fragment="SciSequence_Cont") + iterator, reverse_iterator, const_iterator, const_reverse_iterator { + %set_output(SWIG_NewPointerObj(swig::make_output_iterator(%static_cast($1,const $type &)), + swig::SciSwigIterator::descriptor(),SWIG_POINTER_OWN)); + } + %typemap(out,fragment="SciSequence_Cont") + std::pair<iterator, iterator>, std::pair<const_iterator, const_iterator> { + // TODO: return a Scilab list from the pair (see code for Octave) + } + + %fragment("SciSwigPairBoolOutputIterator", "header", + fragment=SWIG_From_frag(bool), fragment="SciSequence_Cont") {} + + %typemap(out,fragment="SciSwigPairBoolOutputIterator") + std::pair<iterator, bool>, std::pair<const_iterator, bool> { + // TODO: return a Scilab list from the pair (see code for Octave) + } + + %typemap(in,noblock=1,fragment="SciSequence_Cont") + iterator(swig::SciSwigIterator *iter = 0, int res), + reverse_iterator(swig::SciSwigIterator *iter = 0, int res), + const_iterator(swig::SciSwigIterator *iter = 0, int res), + const_reverse_iterator(swig::SciSwigIterator *iter = 0, int res) { + res = SWIG_ConvertPtr((SwigSciObject)$input, %as_voidptrptr(&iter), swig::SciSwigIterator::descriptor(), 0); + if (!SWIG_IsOK(res) || !iter) { + %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); + } else { + swig::SwigSciIterator_T<$type > *iter_t = dynamic_cast<swig::SwigSciIterator_T<$type > *>(iter); + if (iter_t) { + $1 = iter_t->get_current(); + } else { + %argument_fail(SWIG_TypeError, "$type", $symname, $argnum); + } + } + } + + %typecheck(%checkcode(ITERATOR),noblock=1,fragment="SciSequence_Cont") + iterator, reverse_iterator, const_iterator, const_reverse_iterator { + swig::SciSwigIterator *iter = 0; + int res = SWIG_ConvertPtr((SwigSciObject)$input, %as_voidptrptr(&iter), swig::SciSwigIterator::descriptor(), 0); + $1 = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigSciIterator_T<$type > *>(iter) != 0)); + } + + %fragment("SciSequence_Cont"); +#endif //SWIG_EXPORT_ITERATOR_METHODS +%enddef + +// The Scilab container methods + +%define %swig_container_methods(Container...) +%enddef + +%define %swig_sequence_methods_common(Sequence...) + %swig_sequence_iterator(%arg(Sequence)) + %swig_container_methods(%arg(Sequence)) + +%enddef + +%define %swig_sequence_methods(Sequence...) + %swig_sequence_methods_common(%arg(Sequence)) +%enddef + +%define %swig_sequence_methods_val(Sequence...) + %swig_sequence_methods_common(%arg(Sequence)) +%enddef + +// +// Common fragments +// + +%fragment("StdSequenceTraits","header", + fragment="StdTraits", + fragment="SciSequence_Cont", + fragment=SWIG_Traits_SequenceItem_frag(ptr)) +{ +namespace swig { + template <class SciSeq, class Seq> + inline void + assign(const SciSeq& sciSeq, Seq* seq) { +%#ifdef SWIG_STD_NOASSIGN_STL + typedef typename SciSeq::value_type value_type; + typename SciSeq::const_iterator it = sciSeq.begin(); + for (;it != sciSeq.end(); ++it) { + seq->insert(seq->end(),(value_type)(*it)); + } +%#else + seq->assign(sciSeq.begin(), sciSeq.end()); +%#endif + } + + template <class Seq, class T = typename Seq::value_type > + struct traits_asptr_stdseq { + typedef Seq sequence; + typedef T value_type; + + static int asptr(const SwigSciObject& obj, sequence **seq) + { + swig_type_info *typeInfo = swig::type_info<sequence>(); + if (typeInfo) + { + sequence *p; + if (SWIG_ConvertPtr(obj, (void**)&p, typeInfo, 0) == SWIG_OK) + { + if (seq) + *seq = p; + return SWIG_OLDOBJ; + } + } + + if (traits_as_sequence<value_type>::check(obj) == SWIG_OK) + { + try + { + SciSequence_Cont<value_type> sciSeq(obj); + if (seq) + { + *seq = new sequence(); + assign(sciSeq, *seq); + return SWIG_NEWOBJ; + } + else + { + return SWIG_ERROR; + } + } + catch (std::exception& e) + { + SWIG_exception(SWIG_RuntimeError, e.what()); + return SWIG_ERROR; + } + } + else + { + return SWIG_ERROR; + } + } + }; + + template <class Seq, class T = typename Seq::value_type > + struct traits_from_stdseq { + typedef Seq sequence; + typedef T value_type; + typedef typename Seq::size_type size_type; + typedef typename sequence::const_iterator const_iterator; + + static SwigSciObject from(const sequence& seq) + { + %#ifdef SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS + swig_type_info *typeInfo = swig::type_info<sequence>(); + if (typeInfo) + { + return SWIG_NewPointerObj(new sequence(seq), typeInfo, SWIG_POINTER_OWN); + } + %#endif + + try + { + void *data; + size_type size = seq.size(); + if (traits_from_sequence<value_type>::create(size, &data) == SWIG_OK) { + const_iterator it; + int index = 0; + for (it = seq.begin(); it != seq.end(); ++it) + { + traits_from_sequenceitem<value_type>::from(data, index, *it); + index++; + } + return traits_from_sequence<value_type>::set(size, data); + } + return SWIG_OK; + } + catch (std::exception& e) + { + SWIG_exception(SWIG_RuntimeError, e.what()); + return SWIG_ERROR; + } + } + }; +} +}
diff --git a/share/swig/3.0.12/scilab/scidouble.swg b/share/swig/3.0.12/scilab/scidouble.swg new file mode 100644 index 0000000..1b82633 --- /dev/null +++ b/share/swig/3.0.12/scilab/scidouble.swg
@@ -0,0 +1,108 @@ +/* + * DOUBLE SCALAR + */ +%fragment(SWIG_AsVal_frag(double), "header", fragment="SWIG_SciDouble_AsDouble") { +%#define SWIG_AsVal_double(scilabValue, valuePointer) SWIG_SciDouble_AsDouble(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_AsDouble", "header") { +SWIGINTERN int +SWIG_SciDouble_AsDouble(void *pvApiCtx, SwigSciObject iVar, double *pdblValue, char *fname) { + SciErr sciErr; + int iRet = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (!isDoubleType(pvApiCtx, piAddrVar) || isVarComplex(pvApiCtx, piAddrVar)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + if (!isScalar(pvApiCtx, piAddrVar)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + iRet = getScalarDouble(pvApiCtx, piAddrVar, pdblValue); + if (iRet) { + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(double), "header", fragment="SWIG_SciDouble_FromDouble") { +%#define SWIG_From_double(scilabValue) SWIG_SciDouble_FromDouble(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromDouble", "header") { +SWIGINTERN int +SWIG_SciDouble_FromDouble(void *pvApiCtx, int iVarOut, double dblValue, char *fname) { + if (createScalarDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, dblValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * DOUBLE ARRAY + */ + +%fragment("SWIG_SciDouble_AsDoubleArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, double **pdValue, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isDoubleType(pvApiCtx, piAddrVar) && !isVarComplex(pvApiCtx, piAddrVar)) { + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, pdValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromDoubleArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromDoubleArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, double *pdblValue) { + SciErr sciErr; + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdblValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_CreateScilabVariable_frag(double), "wrapper") { +SWIGINTERN int +SWIG_CreateScilabVariable_dec(double)(void *pvApiCtx, const char* psVariableName, const double dVariableValue) { + SciErr sciErr; + sciErr = createNamedMatrixOfDouble(pvApiCtx, psVariableName, 1, 1, &dVariableValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scienum.swg b/share/swig/3.0.12/scilab/scienum.swg new file mode 100644 index 0000000..54ec1f8 --- /dev/null +++ b/share/swig/3.0.12/scilab/scienum.swg
@@ -0,0 +1,31 @@ +/* + * C-type: enum + * Scilab type: double or int32 + */ + +%fragment(SWIG_AsVal_frag(Enum), "header", fragment="SWIG_Int_AsEnum") { +%#define SWIG_AsVal_Enum(scilabValue, valuePointer) SWIG_Int_AsEnum(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_AsEnum", "header", fragment="SWIG_SciDoubleOrInt32_AsInt") { +SWIGINTERN int +SWIG_Int_AsEnum(void *pvApiCtx, int iVar, int *enumValue, char *fname) { + int iValue = 0; + if (SWIG_SciDoubleOrInt32_AsInt(pvApiCtx, iVar, &iValue, fname) != SWIG_OK) + return SWIG_ERROR; + *enumValue = iValue; + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(Enum), "header", fragment="SWIG_Int_FromEnum") { +%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_FromEnum", "header", fragment="SWIG_SciDouble_FromInt") { +SWIGINTERN int +SWIG_Int_FromEnum(void *pvApiCtx, int iVarOut, int enumValue, char *fname) { + if (SWIG_SciDouble_FromInt(pvApiCtx, iVarOut, enumValue, fname) != SWIG_OK) + return SWIG_ERROR; + SWIG_Scilab_SetOutput(pvApiCtx, iVarOut); + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/sciexception.swg b/share/swig/3.0.12/scilab/sciexception.swg new file mode 100644 index 0000000..a5eb4c0 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciexception.swg
@@ -0,0 +1,60 @@ +/* + * Exception typemaps (throws) + */ + +%include <exception.i> + +%typemap(throws, noblock=1) int, unsigned int, signed int, + int&,unsigned int&, signed int&, + long, unsigned long, signed long, + short, unsigned short,signed short, + long long, unsigned long long, + unsigned char, signed char, + long&, unsigned long&, signed long&, + short&, unsigned short&, signed short&, + long long&, unsigned long long&, + unsigned char&, signed char&, + size_t, size_t&, + ptrdiff_t, ptrdiff_t& { + char obj[20]; + sprintf(obj, "%d", (int)$1); + SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); +} + +%typemap(throws, noblock=1) enum SWIGTYPE { + char obj[20]; + sprintf(obj, "%d", (int)$1); + SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); +} + +%typemap(throws, noblock=1) float, double, + float&, double& { + char obj[20]; + sprintf(obj, "%5.3f", (double)$1); + SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); +} + +%typemap(throws, noblock=1) bool, bool& { + SWIG_Scilab_Raise_Ex($1 ? "true" : "false", "$type", $descriptor); +} + +%typemap(throws, noblock=1) char*, char[ANY] { + SWIG_Scilab_Raise_Ex($1, "$type", $descriptor); +} + +%typemap(throws, noblock=1) char, char& { + char obj[1]; + sprintf(obj, "%c", (char)$1); + SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor); +} + +%typemap(throws, noblock=1) SWIGTYPE, + SWIGTYPE*, + SWIGTYPE [ANY], + SWIGTYPE & { + SWIG_Scilab_Raise_Ex((char*)NULL, "$type", $descriptor); +} + +%typemap(throws, noblock=1) (...) { + SWIG_exception(SWIG_RuntimeError, "unknown exception"); +}
diff --git a/share/swig/3.0.12/scilab/scifloat.swg b/share/swig/3.0.12/scilab/scifloat.swg new file mode 100644 index 0000000..f0af17c --- /dev/null +++ b/share/swig/3.0.12/scilab/scifloat.swg
@@ -0,0 +1,83 @@ +/* + * FLOAT SCALAR + */ + +%fragment(SWIG_AsVal_frag(float), "header", fragment=SWIG_AsVal_frag(double)) { +SWIGINTERN int +SWIG_AsVal_dec(float)(SwigSciObject iVar, float *pfValue) { + double dblValue = 0.0; + if(SWIG_AsVal_dec(double)(iVar, &dblValue) != SWIG_OK) { + return SWIG_ERROR; + } + if (pfValue) + *pfValue = (float) dblValue; + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(float), "header") { +SWIGINTERN int +SWIG_From_dec(float)(float flValue) { + if (createScalarDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + + SWIG_Scilab_GetOutputPosition(), (double)flValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_AsFloatArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_AsFloatArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, float **pfValue, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + double *pdValue = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isDoubleType(pvApiCtx, piAddrVar) && !isVarComplex(pvApiCtx, piAddrVar)) { + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + *pfValue = (float *) malloc((*iRows) * (*iCols) * sizeof(float)); + for (i=0; i < (*iRows) * (*iCols); i++) + (*pfValue)[i] = (float) pdValue[i]; + + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } +} +} + +%fragment("SWIG_SciDouble_FromFloatArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromFloatArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, float *pfValue) { + SciErr sciErr; + double *pdValue; + int i; + + pdValue = (double *) malloc(iRows * iCols * sizeof(double)); + for (i = 0; i < iRows * iCols; i++) + pdValue[i] = pfValue[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + free(pdValue); + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/sciint.swg b/share/swig/3.0.12/scilab/sciint.swg new file mode 100644 index 0000000..2d69935 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciint.swg
@@ -0,0 +1,202 @@ +/* + * C-type: int + * Scilab type: double or int32 + */ + +%fragment(SWIG_AsVal_frag(int), "header", fragment="SWIG_SciDoubleOrInt32_AsInt", fragment="<limits.h>") { +%#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDoubleOrInt32_AsInt(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrInt32_AsInt", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt32_AsInt(void *pvApiCtx, SwigSciObject iVar, int *piValue, char *fname) +{ + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + if (piValue) { + int iPrec = 0; + int *piData = NULL; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT32) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + sciErr = getMatrixOfInteger32(pvApiCtx, piAddrVar, &iRows, &iCols, &piData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + *piValue = *piData; + } + } + else if (iType == sci_matrix) { + if (piValue) { + double *pdData = NULL; + double dValue = 0.0f; + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 32-bit signed integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < INT_MIN) || (dValue > INT_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 32-bit signed integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *piValue = (int) dValue; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(int), "header", fragment="SWIG_SciDouble_FromInt") { +%#define SWIG_From_int(scilabValue) SWIG_SciDouble_FromInt(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromInt", "header") { +SWIGINTERN int +SWIG_SciDouble_FromInt(void *pvApiCtx, int iVarOut, int iValue, char *fname){ + if (createScalarDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + + iVarOut, (double) iValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: int[] + * Scilab type: double or int32 matrix + */ +%fragment("SWIG_SciDoubleOrInt32_AsIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt32_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, int **piValue, char *fname) { + SciErr sciErr; + int iType = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *piValue = (int*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*piValue)[i] = (int) pdData[i]; + } + else if (iType == sci_ints) { + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT32) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + sciErr = getMatrixOfInteger32(pvApiCtx, piAddrVar, iRows, iCols, piValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromIntArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, const int *piData) { + SciErr sciErr; + double *pdValues = NULL; + int i; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = piData[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +} + +%fragment(SWIG_CreateScilabVariable_frag(int), "wrapper") { +SWIGINTERN int +SWIG_CreateScilabVariable_dec(int)(void *pvApiCtx, const char* psVariableName, const int iVariableValue) { + SciErr sciErr; + sciErr = createNamedMatrixOfInteger32(pvApiCtx, psVariableName, 1, 1, &iVariableValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/sciiterators.swg b/share/swig/3.0.12/scilab/sciiterators.swg new file mode 100644 index 0000000..1c7ce43 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciiterators.swg
@@ -0,0 +1,363 @@ +/* ----------------------------------------------------------------------------- + * sciiterators.swg + * + * Users can derive form the SciSwigIterator to implemet their + * own iterators. As an example (real one since we use it for STL/STD + * containers), the template SwigSciIterator_T does the + * implementation for generic C++ iterators. + * ----------------------------------------------------------------------------- */ + +%include <std_common.i> + +%fragment("SciSwigIterator","header",fragment="<stddef.h>") { +namespace swig { + struct stop_iteration { + }; + + struct SciSwigIterator { + private: + SwigSciObject _seq; + + protected: + SciSwigIterator(SwigSciObject seq) : _seq(seq) + { + } + + public: + virtual ~SciSwigIterator() {} + + virtual SwigSciObject value() const = 0; + + virtual SciSwigIterator *incr(size_t n = 1) = 0; + + virtual SciSwigIterator *decr(size_t n = 1) + { + throw stop_iteration(); + } + + virtual ptrdiff_t distance(const SciSwigIterator &x) const + { + throw std::invalid_argument("operation not supported"); + } + + virtual bool equal (const SciSwigIterator &x) const + { + throw std::invalid_argument("operation not supported"); + } + + virtual SciSwigIterator *copy() const = 0; + + SwigSciObject next() + { + SwigSciObject obj = value(); + incr(); + return obj; + } + + SwigSciObject previous() + { + decr(); + return value(); + } + + SciSwigIterator *advance(ptrdiff_t n) + { + return (n > 0) ? incr(n) : decr(-n); + } + + bool operator == (const SciSwigIterator& x) const + { + return equal(x); + } + + bool operator != (const SciSwigIterator& x) const + { + return ! operator==(x); + } + + SciSwigIterator* operator ++ () { + incr(); + return this; + } + + SciSwigIterator* operator -- () { + decr(); + return this; + } + + SciSwigIterator* operator + (ptrdiff_t n) const + { + return copy()->advance(n); + } + + SciSwigIterator* operator - (ptrdiff_t n) const + { + return copy()->advance(-n); + } + + ptrdiff_t operator - (const SciSwigIterator& x) const + { + return x.distance(*this); + } + + static swig_type_info* descriptor() { + static int init = 0; + static swig_type_info* desc = 0; + if (!init) { + desc = SWIG_TypeQuery("swig::SciSwigIterator *"); + init = 1; + } + return desc; + } + }; +} +} + +%fragment("SwigSciIterator_T","header",fragment="<stddef.h>",fragment="SciSwigIterator",fragment="StdTraits",fragment="StdIteratorTraits") { +namespace swig { + template<typename OutIterator> + class SwigSciIterator_T : public SciSwigIterator + { + public: + typedef OutIterator out_iterator; + typedef typename std::iterator_traits<out_iterator>::value_type value_type; + typedef SwigSciIterator_T<out_iterator> self_type; + + SwigSciIterator_T(out_iterator curr, SwigSciObject seq) + : SciSwigIterator(seq), current(curr) + { + } + + const out_iterator& get_current() const + { + return current; + } + + + bool equal (const SciSwigIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return (current == iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + ptrdiff_t distance(const SciSwigIterator &iter) const + { + const self_type *iters = dynamic_cast<const self_type *>(&iter); + if (iters) { + return std::distance(current, iters->get_current()); + } else { + throw std::invalid_argument("bad iterator type"); + } + } + + protected: + out_iterator current; + }; + + template <class ValueType> + struct from_oper + { + typedef const ValueType& argument_type; + typedef SwigSciObject result_type; + result_type operator()(argument_type v) const + { + return swig::from(v); + } + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SciSwigIteratorOpen_T : public SwigSciIterator_T<OutIterator> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigSciIterator_T<out_iterator> base; + typedef SciSwigIteratorOpen_T<OutIterator, ValueType, FromOper> self_type; + + SciSwigIteratorOpen_T(out_iterator curr, SwigSciObject seq) + : SwigSciIterator_T<OutIterator>(curr, seq) + { + } + + SwigSciObject value() const { + return from(static_cast<const value_type&>(*(base::current))); + } + + SciSwigIterator *copy() const + { + return new self_type(*this); + } + + SciSwigIterator *incr(size_t n = 1) + { + while (n--) { + ++base::current; + } + return this; + } + + SciSwigIterator *decr(size_t n = 1) + { + while (n--) { + --base::current; + } + return this; + } + }; + + template<typename OutIterator, + typename ValueType = typename std::iterator_traits<OutIterator>::value_type, + typename FromOper = from_oper<ValueType> > + class SciSwigIteratorClosed_T : public SwigSciIterator_T<OutIterator> + { + public: + FromOper from; + typedef OutIterator out_iterator; + typedef ValueType value_type; + typedef SwigSciIterator_T<out_iterator> base; + typedef SciSwigIteratorClosed_T<OutIterator, ValueType, FromOper> self_type; + + SciSwigIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, SwigSciObject seq) + : SwigSciIterator_T<OutIterator>(curr, seq), begin(first), end(last) + { + } + + SwigSciObject value() const { + if (base::current == end) { + throw stop_iteration(); + } else { + return from(static_cast<const value_type&>(*(base::current))); + } + } + + SciSwigIterator *copy() const + { + return new self_type(*this); + } + + SciSwigIterator *incr(size_t n = 1) + { + while (n--) { + if (base::current == end) { + throw stop_iteration(); + } else { + ++base::current; + } + } + return this; + } + + SciSwigIterator *decr(size_t n = 1) + { + while (n--) { + if (base::current == begin) { + throw stop_iteration(); + } else { + --base::current; + } + } + return this; + } + + private: + out_iterator begin; + out_iterator end; + }; + + template<typename OutIter> + inline SciSwigIterator* + make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, SwigSciObject seq = SwigSciObject()) + { + return new SciSwigIteratorClosed_T<OutIter>(current, begin, end, seq); + } + + template<typename OutIter> + inline SciSwigIterator* + make_output_iterator(const OutIter& current, SwigSciObject seq = SwigSciObject()) + { + return new SciSwigIteratorOpen_T<OutIter>(current, seq); + } +} +} + + +%fragment("SciSwigIterator"); +namespace swig +{ +// Throw a StopIteration exception + %ignore stop_iteration; + struct stop_iteration {}; + + %typemap(throws, noblock=1) stop_iteration + { + SWIG_Scilab_Raise(0, "stop_iteration", NULL); + return SWIG_ERROR; + } + +// Mark methods that return new objects + %newobject SciSwigIterator::copy; + %newobject SciSwigIterator::operator + (ptrdiff_t n) const; + %newobject SciSwigIterator::operator - (ptrdiff_t n) const; + + %nodirector SciSwigIterator; + + %catches(swig::stop_iteration) SciSwigIterator::value() const; + %catches(swig::stop_iteration) SciSwigIterator::incr(size_t n = 1); + %catches(swig::stop_iteration) SciSwigIterator::decr(size_t n = 1); + %catches(std::invalid_argument) SciSwigIterator::distance(const SciSwigIterator &x) const; + %catches(std::invalid_argument) SciSwigIterator::equal (const SciSwigIterator &x) const; + %catches(swig::stop_iteration) SciSwigIterator::next(); + %catches(swig::stop_iteration) SciSwigIterator::previous(); + %catches(swig::stop_iteration) SciSwigIterator::advance(ptrdiff_t n); + %catches(swig::stop_iteration) SciSwigIterator::operator += (ptrdiff_t n); + %catches(swig::stop_iteration) SciSwigIterator::operator -= (ptrdiff_t n); + %catches(swig::stop_iteration) SciSwigIterator::operator + (ptrdiff_t n) const; + %catches(swig::stop_iteration) SciSwigIterator::operator - (ptrdiff_t n) const; + + %ignore SciSwigIterator::operator==; + %ignore SciSwigIterator::operator!=; + %ignore SciSwigIterator::operator++; + %ignore SciSwigIterator::operator--; + %ignore SciSwigIterator::operator+; + %ignore SciSwigIterator::operator-; + + struct SciSwigIterator + { + protected: + SciSwigIterator(SwigSciObject seq); + + public: + virtual ~SciSwigIterator(); + + virtual SwigSciObject value() const = 0; + + virtual SciSwigIterator *incr(size_t n = 1) = 0; + + virtual SciSwigIterator *decr(size_t n = 1); + + virtual ptrdiff_t distance(const SciSwigIterator &x) const; + + virtual bool equal (const SciSwigIterator &x) const; + + virtual SciSwigIterator *copy() const = 0; + + SwigSciObject next(); + SwigSciObject previous(); + SciSwigIterator *advance(ptrdiff_t n); + + bool operator == (const SciSwigIterator& x) const; + bool operator != (const SciSwigIterator& x) const; + SciSwigIterator* operator ++ (); + SciSwigIterator* operator -- (); + SciSwigIterator* operator + (ptrdiff_t n) const; + SciSwigIterator* operator - (ptrdiff_t n) const; + ptrdiff_t operator - (const SciSwigIterator& x) const; + }; +}
diff --git a/share/swig/3.0.12/scilab/scilab.swg b/share/swig/3.0.12/scilab/scilab.swg new file mode 100644 index 0000000..3b5f6e8 --- /dev/null +++ b/share/swig/3.0.12/scilab/scilab.swg
@@ -0,0 +1,6 @@ +%include <typemaps/swigmacros.swg> +%include <typemaps/fragments.swg> +%include <scimacros.swg> +%include <sciruntime.swg> +%include <scitypemaps.swg> +
diff --git a/share/swig/3.0.12/scilab/scilist.swg b/share/swig/3.0.12/scilab/scilist.swg new file mode 100644 index 0000000..513f40b --- /dev/null +++ b/share/swig/3.0.12/scilab/scilist.swg
@@ -0,0 +1,91 @@ +/* + * Scilab list related functions + * + */ + +%fragment("SWIG_ScilabList", "header") +{ +SWIGINTERN int +SWIG_GetScilabList(SwigSciObject obj, int **piListAddr) +{ + SciErr sciErr; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, piListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} + +SWIGINTERN int +SWIG_GetScilabListSize(SwigSciObject obj, int *piListSize) +{ + SciErr sciErr; + int *piListAddr; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getListItemNumber(pvApiCtx, piListAddr, piListSize); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} + +SWIGINTERN int +SWIG_GetScilabListAndSize(SwigSciObject obj, int **piListAddr, int *piListSize) +{ + SciErr sciErr; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, piListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getListItemNumber(pvApiCtx, *piListAddr, piListSize); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + return SWIG_OK; +} + +SWIGINTERN int +SWIG_CheckScilabList(SwigSciObject obj) +{ + SciErr sciErr; + int *piListAddr; + int iType; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piListAddr, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if ((iType != sci_list) && (iType != sci_tlist) && (iType != sci_mlist)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A list is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } + + return SWIG_OK; +} + +} +
diff --git a/share/swig/3.0.12/scilab/scilong.swg b/share/swig/3.0.12/scilab/scilong.swg new file mode 100644 index 0000000..4e55be5 --- /dev/null +++ b/share/swig/3.0.12/scilab/scilong.swg
@@ -0,0 +1,123 @@ +/* + * C-type: long + * Scilab type: double or int32 + */ + +%fragment(SWIG_AsVal_frag(long), "header", fragment="SWIG_SciDoubleOrInt32_AsLong", fragment="<limits.h>") { +%#define SWIG_AsVal_long(scilabValue, valuePointer) SWIG_SciDoubleOrInt32_AsLong(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()); +} +%fragment("SWIG_SciDoubleOrInt32_AsLong", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt32_AsLong(void *pvApiCtx, SwigSciObject iVar, long *plValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + int iPrec = 0; + int *piData = NULL; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT32) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + sciErr = getMatrixOfInteger32(pvApiCtx, piAddrVar, &iRows, &iCols, &piData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + *plValue = (long) *piData; + } + else if (iType == sci_matrix) { + double *pdData = NULL; + double dValue = 0.0f; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 32-bit signed integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < LONG_MIN) || (dValue > LONG_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 32-bit signed integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *plValue = (long) dValue; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(long), "header", fragment="SWIG_SciDouble_FromLong") { +%#define SWIG_From_long(scilabValue) SWIG_SciDouble_FromLong(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromLong", "header") { +SWIGINTERN int +SWIG_SciDouble_FromLong(void *pvApiCtx, int iVarOut, long lValue, char *fname) { + if (createScalarDouble(pvApiCtx, + SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) lValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + + +%fragment("SWIG_SciDouble_FromLongArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromLongArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, const long *plData) { + SciErr sciErr; + int i; + double *pdValues = NULL; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) { + pdValues[i] = plData[i]; + } + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + free(pdValues); + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/scilonglong.swg b/share/swig/3.0.12/scilab/scilonglong.swg new file mode 100644 index 0000000..02d9b2f --- /dev/null +++ b/share/swig/3.0.12/scilab/scilonglong.swg
@@ -0,0 +1,54 @@ +/* + * C-type: long long + * Scilab 5 type: NONE + * Scilab 6 type: int64 + */ +%fragment(SWIG_AsVal_frag(long long), "header", fragment="SWIG_SciInt64_ToLongLong") { +%#define SWIG_AsVal_long_SS_long(scilabValue, valuePointer) SWIG_SciInt64_ToLongLong(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciInt64_ToLongLong", "header") { +SWIGINTERN int +SWIG_SciInt64_ToLongLong(void *pvApiCtx, int iVar, long long *pllValue, char *fname) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciInt64_ToLongLong", "int64"); + return SWIG_ERROR; +} +} + +%fragment(SWIG_From_frag(long long), "header", fragment="SWIG_SciInt64_FromLongLong") { +#define SWIG_From_long_SS_long(value) SWIG_SciInt64_FromLongLong(pvApiCtx, $result, value) +} +%fragment("SWIG_SciInt64_FromLongLong", "header") { +SWIGINTERN int +SWIG_SciInt64_FromLongLong(void *pvApiCtx, int iVarOut, long long llValue) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciInt64_ToLongLong", "int64"); + return SWIG_ERROR; +} +} + +/* + * C-type: unsigned long long + * Scilab 5 type: NONE + * Scilab 6 type: uint64 + */ +%fragment(SWIG_AsVal_frag(unsigned long long), "header", fragment="SWIG_SciUint64_ToUnsignedLongLong") { +#define SWIG_AsVal_unsigned_SS_long_SS_long(scilabValue, valuePointer) SWIG_SciUint64_ToUnsignedLongLong(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciUint64_ToUnsignedLongLong", "header") { +SWIGINTERN int +SWIG_SciUint64_ToUnsignedLongLong(void *pvApiCtx, int iVar, unsigned long long *pullValue, char *fname) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciUint64_ToLongLong", "uint64"); + return SWIG_ERROR; +} +} + +%fragment(SWIG_From_frag(unsigned long long), "header", fragment="SWIG_SciUint64_FromUnsignedLongLong") { +#define SWIG_From_unsigned_SS_long_SS_long(value) SWIG_SciUint64_FromUnsignedLongLong(pvApiCtx, $result, value) +} +%fragment("SWIG_SciUint64_FromUnsignedLongLong", "header") { +SWIGINTERN int +SWIG_SciUint64_FromUnsignedLongLong(void *pvApiCtx, int iVarOut, unsigned long long llValue) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Scilab 5.X does not manage '%s' data type.\n"), "SWIG_SciUint64_ToLongLong", "uint64"); + return SWIG_ERROR; +} +} +
diff --git a/share/swig/3.0.12/scilab/scimacros.swg b/share/swig/3.0.12/scilab/scimacros.swg new file mode 100644 index 0000000..669ca89 --- /dev/null +++ b/share/swig/3.0.12/scilab/scimacros.swg
@@ -0,0 +1,5 @@ + #define %scilabconst(flag) %feature("scilab:const","flag") + +// Create Scilab variable +#define SWIG_CreateScilabVariable_frag(Type...) %fragment_name(CreateScilabVariable, Type) +#define SWIG_CreateScilabVariable_dec(Type...) %symbol_name(CreateScilabVariable, Type)
diff --git a/share/swig/3.0.12/scilab/scimatrixbool.swg b/share/swig/3.0.12/scilab/scimatrixbool.swg new file mode 100644 index 0000000..a43886b --- /dev/null +++ b/share/swig/3.0.12/scilab/scimatrixbool.swg
@@ -0,0 +1,170 @@ +/* + * C-type: bool array + * Scilab type: bool matrix + */ + +%include <scibool.swg> + +// in (bool *IN, int IN_ROWCOUNT, int IN_COLCOUNT) + +%typemap(in, noblock=1, fragment="SWIG_SciBoolean_AsBoolArrayAndSize") (bool *IN, int IN_ROWCOUNT, int IN_COLCOUNT) +{ + if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &$2, &$3, &$1, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (int IN_ROWCOUNT, int IN_COLCOUNT, bool *IN) + +%typemap(in, noblock=1, fragment="SWIG_SciBoolean_AsBoolArrayAndSize") (int IN_ROWCOUNT, int IN_COLCOUNT, bool *IN) +{ + if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (bool *IN, int IN_SIZE) + +%typemap(in, noblock=1, fragment="SWIG_SciBoolean_AsBoolArrayAndSize") (bool *IN, int IN_SIZE) (int rowCount, int colCount) +{ + if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { + $2 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// in (int IN_SIZE, bool *IN) + +%typemap(in, noblock=1) (int IN_SIZE, bool *IN) (int rowCount, int colCount) +{ + if (SWIG_SciBoolean_AsBoolArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { + $1 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// out (bool **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) + +%typemap(in, noblock=1, numinputs=0) (bool **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ +} + +%typemap(arginit, noblock=1) (bool **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + $1 = (bool**) malloc(sizeof(bool*)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int*) malloc(sizeof(int)); +} + +%typemap(freearg, noblock=1) (bool **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + free(*$1); + free($1); + free($2); + free($3); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciBoolean_FromBoolArrayAndSize") (bool **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + if (SWIG_SciBoolean_FromBoolArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +// out (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, bool **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, bool **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, bool **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (int*) malloc(sizeof(int)); + $3 = (bool**) malloc(sizeof(bool*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciBoolean_FromBoolArrayAndSize") (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, bool **OUT) +{ + if (SWIG_SciBoolean_FromBoolArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, bool **OUT) +{ + free($1); + free($2); + free(*$3); + free($3); +} + + +// out (bool **OUT, int *OUT_SIZE) + +%typemap(in, noblock=1, numinputs=0) (bool **OUT, int *OUT_SIZE) +{ +} + +%typemap(arginit, noblock=1) (bool **OUT, int *OUT_SIZE) +{ + $1 = (bool**) malloc(sizeof(bool*)); + $2 = (int*) malloc(sizeof(int)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciBoolean_FromBoolArrayAndSize") (bool **OUT, int *OUT_SIZE) +{ + if (SWIG_SciBoolean_FromBoolArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (bool **OUT, int *OUT_SIZE) +{ + free(*$1); + free($1); + free($2); +} + + +// out (int *OUT_SIZE, bool **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_SIZE, bool **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_SIZE, bool **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (bool**) malloc(sizeof(bool*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciBoolean_FromBoolArrayAndSize") (int *OUT_SIZE, bool **OUT) +{ + if (SWIG_SciBoolean_FromBoolArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_SIZE, bool **OUT) +{ + free($1); + free(*$2); + free($2); +}
diff --git a/share/swig/3.0.12/scilab/scimatrixchar.swg b/share/swig/3.0.12/scilab/scimatrixchar.swg new file mode 100644 index 0000000..37f6833 --- /dev/null +++ b/share/swig/3.0.12/scilab/scimatrixchar.swg
@@ -0,0 +1,199 @@ +/* + * C-type: char* + * Scilab type: string matrix + */ + +%include <scichar.swg> + +// in (char **IN, int IN_ROWCOUNT, int IN_COLCOUNT) + +%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (char **IN, int IN_ROWCOUNT, int IN_COLCOUNT) +{ + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &$2, &$3, &$1, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (int IN_ROWCOUNT, int IN_COLCOUNT, char **IN) + +%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_ROWCOUNT, int IN_COLCOUNT, char **IN) +{ + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (char **IN, int IN_SIZE) + +%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (char **IN, int IN_SIZE) (int rowCount, int colCount) +{ + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { + $2 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// in (int IN_SIZE, char **IN) + +%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_SIZE, char **IN) (int rowCount, int colCount) +{ + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { + $1 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// out (char ***OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) + +%typemap(in, noblock=1, numinputs=0) (char ***OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ +} + +%typemap(arginit, noblock=1) (char ***OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + $1 = (char***) malloc(sizeof(char**)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int*) malloc(sizeof(int)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciString_FromCharPtrArrayAndSize") (char ***OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + if (SWIG_SciString_FromCharPtrArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (char ***OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + { + int i; + for (i = 0; i < (*$2) * (*$3); i++) + free((*$1)[i]); + } + free(*$1); + free($1); + free($2); + free($3); +} + +// out (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, char ***OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, char ***OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, char ***OUT) +{ + $1 = (char***) malloc(sizeof(char**)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int**) malloc(sizeof(int*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciString_FromCharPtrArrayAndSize") (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, char ***OUT) +{ + if (SWIG_SciString_FromCharPtrArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, char ***OUT) +{ + free($1); + free($2); + { + int i; + for (i = 0; i < (*$1) * (*$2); i++) + free((*$3)[i]); + } + free(*$3); + free($3); +} + + +// out (char ***OUT, int *OUT_SIZE) + +%typemap(in, noblock=1, numinputs=0) (char ***OUT, int *OUT_SIZE) +{ +} + +%typemap(arginit, noblock=1) (char ***OUT, int *OUT_SIZE) +{ + $1 = (char***) malloc(sizeof(char**)); + $2 = (int*) malloc(sizeof(int)); +} + +%typemap(freearg, noblock=1) (char ***OUT, int *OUT_SIZE) +{ + { + int i; + for (i = 0; i < *$2; i++) + free((*$1)[i]); + } + free(*$1); + free($1); + free($2); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciString_FromCharPtrArrayAndSize") (char ***OUT, int *OUT_SIZE) +{ + if (SWIG_SciString_FromCharPtrArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +// in (int IN_SIZE, char **IN) + +%typemap(in, noblock=1, fragment="SWIG_SciString_AsCharPtrArrayAndSize") (int IN_SIZE, char **IN) +{ + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, $input, 1, &$1, &$2, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// out (int *OUT_SIZE, char ***OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_SIZE, char ***OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_SIZE, char ***OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (char***) malloc(sizeof(char**)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciString_FromCharPtrArrayAndSize") (int *OUT_SIZE, char ***OUT) +{ + if (SWIG_SciString_FromCharPtrArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_SIZE, char ***OUT) +{ + free($1); + { + int i; + for (i = 0; i < *$1; i++) + free((*$2)[i]); + } + free(*$2); + free($2); +} +
diff --git a/share/swig/3.0.12/scilab/scimatrixdouble.swg b/share/swig/3.0.12/scilab/scimatrixdouble.swg new file mode 100644 index 0000000..9444a80 --- /dev/null +++ b/share/swig/3.0.12/scilab/scimatrixdouble.swg
@@ -0,0 +1,170 @@ +/* + * C-type: double array + * Scilab type: double matrix + */ + +%include <scidouble.swg> + +// in (double *IN, int IN_ROWCOUNT, int IN_COLCOUNT) + +%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_ROWCOUNT, int IN_COLCOUNT) +{ + if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &$2, &$3, &$1, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (int IN_ROWCOUNT, int IN_COLCOUNT, double *IN) + +%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_ROWCOUNT, int IN_COLCOUNT, double *IN) +{ + if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + +// in (double *IN, int IN_SIZE) + +%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE) (int rowCount, int colCount) +{ + if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { + $2 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// in (int IN_SIZE, double *IN) + +%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN) (int rowCount, int colCount) +{ + if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { + $1 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// out (double **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) + +%typemap(in, noblock=1, numinputs=0) (double **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ +} + +%typemap(arginit, noblock=1) (double **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + $1 = (double**) malloc(sizeof(double*)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int*) malloc(sizeof(int)); +} + +%typemap(freearg, noblock=1) (double **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + free(*$1); + free($1); + free($2); + free($3); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") (double **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +// out (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, double **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, double **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, double **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (int*) malloc(sizeof(int)); + $3 = (double**) malloc(sizeof(double*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") (int *IN_ROWCOUNT, int *IN_COLCOUNT, double **OUT) +{ + if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, double **OUT) +{ + free($1); + free($2); + free(*$3); + free($3); +} + + +// out (double **OUT, int *OUT_SIZE) + +%typemap(in, noblock=1, numinputs=0) (double **OUT, int *OUT_SIZE) +{ +} + +%typemap(arginit, noblock=1) (double **OUT, int *OUT_SIZE) +{ + $1 = (double**) malloc(sizeof(double*)); + $2 = (int*) malloc(sizeof(int)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") (double **OUT, int *OUT_SIZE) +{ + if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (double **OUT, int *OUT_SIZE) +{ + free(*$1); + free($1); + free($2); +} + + +// out (int *OUT_SIZE, double **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_SIZE, double **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_SIZE, double **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (double**) malloc(sizeof(double*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") (int *OUT_SIZE, double **OUT) +{ + if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_SIZE, double **OUT) +{ + free($1); + free(*$2); + free($2); +}
diff --git a/share/swig/3.0.12/scilab/scimatrixint.swg b/share/swig/3.0.12/scilab/scimatrixint.swg new file mode 100644 index 0000000..e304d4f --- /dev/null +++ b/share/swig/3.0.12/scilab/scimatrixint.swg
@@ -0,0 +1,175 @@ +/* + * C-type: int array + * Scilab type: 32-bit integer matrix + */ + +%include <sciint.swg> + +// in (int *IN, int IN_ROWCOUNT, int IN_COLCOUNT) + +%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_ROWCOUNT, int IN_COLCOUNT) +{ + if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &$2, &$3, &$1, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + + +// in (int IN_ROWCOUNT, int IN_COLCOUNT, int *IN) + +%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_ROWCOUNT, int IN_COLCOUNT, int *IN) +{ + if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &$1, &$2, &$3, fname) != SWIG_OK) { + return SWIG_ERROR; + } +} + + +// in (int *IN, int IN_SIZE) + +%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE) (int rowCount, int colCount) +{ + if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) { + $2 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + + +// in (int IN_SIZE, int *IN) + +%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN) (int rowCount, int colCount) +{ + if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) { + $1 = rowCount * colCount; + } + else { + return SWIG_ERROR; + } +} + +// out (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) + +%typemap(in, noblock=1, numinputs=0) (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ +} + +%typemap(arginit, noblock=1) (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + $1 = (int**) malloc(sizeof(int*)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int*) malloc(sizeof(int)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromIntArrayAndSize") (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + if (SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int **OUT, int *OUT_ROWCOUNT, int *OUT_COLCOUNT) +{ + free(*$1); + free($1); + free($2); + free($3); +} + + +// out (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (int*) malloc(sizeof(int)); + $3 = (int**) malloc(sizeof(int*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromIntArrayAndSize") (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT) +{ + if (SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *OUT_ROWCOUNT, int *OUT_COLCOUNT, int **OUT) +{ + free($1); + free($2); + free(*$3); + free($3); +} + + +// out (int **OUT, int *OUT_SIZE) + +%typemap(in, noblock=1, numinputs=0) (int **OUT, int *OUT_SIZE) +{ +} + +%typemap(arginit) (int **OUT, int *OUT_SIZE) +{ + $1 = (int**) malloc(sizeof(int*)); + $2 = (int*) malloc(sizeof(int)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromIntArrayAndSize") (int **OUT, int *OUT_SIZE) +{ + if (SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int **OUT, int *OUT_SIZE) +{ + free(*$1); + free($1); + free($2); +} + + +// out (int *OUT_SIZE, int **OUT) + +%typemap(in, noblock=1, numinputs=0) (int *OUT_SIZE, int **OUT) +{ +} + +%typemap(arginit, noblock=1) (int *OUT_SIZE, int **OUT) +{ + $1 = (int*) malloc(sizeof(int)); + $2 = (int**) malloc(sizeof(int*)); +} + +%typemap(argout, noblock=1, fragment="SWIG_SciDouble_FromIntArrayAndSize") (int *OUT_SIZE, int **OUT) +{ + if (SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) == SWIG_OK) { + SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition()); + } + else { + return SWIG_ERROR; + } +} + +%typemap(freearg, noblock=1) (int *IN_SIZE, int **OUT) +{ + free($1); + free(*$2); + free($2); +} +
diff --git a/share/swig/3.0.12/scilab/scimisctypes.swg b/share/swig/3.0.12/scilab/scimisctypes.swg new file mode 100644 index 0000000..fe75e15 --- /dev/null +++ b/share/swig/3.0.12/scilab/scimisctypes.swg
@@ -0,0 +1,69 @@ +// Other primitive such as size_t and ptrdiff_t + +/* + * C-type: size_t + * Scilab type: double or int32 + */ + +%fragment(SWIG_AsVal_frag(size_t), "header", fragment="SWIG_Int_AsSize") { +%#define SWIG_AsVal_size_t(scilabValue, valuePointer) SWIG_Int_AsSize(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_AsSize", "header", fragment=SWIG_AsVal_frag(int)) +{ +SWIGINTERN int +SWIG_Int_AsSize(void *pvApiCtx, SwigSciObject iVar, size_t *piValue, char *fname) { + int iValue = 0; + if (SWIG_AsVal_dec(int)(iVar, &iValue) != SWIG_OK) + return SWIG_ERROR; + + if (piValue) + *piValue = (size_t) iValue; + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(size_t), "header", fragment="SWIG_Int_FromSize") { +%#define SWIG_From_size_t(scilabValue) SWIG_Int_FromSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_FromSize", "header", fragment=SWIG_From_frag(int)) +{ +SWIGINTERN int +SWIG_Int_FromSize(void *pvApiCtx, int iVarOut, size_t iValue, char *fname) { + return SWIG_From_dec(int)((int)iValue); +} +} + +/* + * C-type: ptrdiff_t + * Scilab type: double or int32 + */ + +%fragment(SWIG_AsVal_frag(ptrdiff_t), "header", fragment="SWIG_Int_AsPtrDiff") { +%#define SWIG_AsVal_ptrdiff_t(scilabValue, valuePointer) SWIG_Int_AsPtrDiff(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_AsPtrDiff", "header", fragment=SWIG_AsVal_frag(int)) +{ +SWIGINTERN int +SWIG_Int_AsPtrDiff(void *pvApiCtx, SwigSciObject iVar, ptrdiff_t *piValue, char *fname) { + int iValue = 0; + if (SWIG_AsVal_dec(int)(iVar, &iValue) != SWIG_OK) + return SWIG_ERROR; + + if (piValue) + *piValue = (ptrdiff_t) iValue; + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(ptrdiff_t), "header", fragment="SWIG_Int_FromPtrDiff") { +%#define SWIG_From_ptrdiff_t(scilabValue) SWIG_Int_FromPtrDiff(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_Int_FromPtrDiff", "header", fragment=SWIG_From_frag(int)) { +SWIGINTERN int +SWIG_Int_FromPtrDiff(void *pvApiCtx, int iVarOut, ptrdiff_t iValue, char *fname) { + return SWIG_From_dec(int)((int)iValue); +} +} +
diff --git a/share/swig/3.0.12/scilab/scipointer.swg b/share/swig/3.0.12/scilab/scipointer.swg new file mode 100644 index 0000000..94ca4ef --- /dev/null +++ b/share/swig/3.0.12/scilab/scipointer.swg
@@ -0,0 +1,32 @@ +/* + * POINTER + */ +%fragment("SWIG_ConvertPtr", "header") { +#define SWIG_ConvertPtr(scilabValue, voidPointer, pointerDescriptor, flags) SwigScilabPtrToObject(pvApiCtx, scilabValue, voidPointer, pointerDescriptor, flags, SWIG_Scilab_GetFuncName()) +} + +%fragment("SWIG_NewPointerObj", "header") { +#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags, NULL) +} + +/* + * FUNCTION POINTER + */ +%fragment("SWIG_ConvertFunctionPtr", "header") { +#define SWIG_ConvertFunctionPtr(scilabValue, voidPointer, pointerDescriptor) SwigScilabPtrToObject(pvApiCtx, scilabValue, voidPointer, pointerDescriptor, 0, SWIG_Scilab_GetFuncName()) +} + +%fragment("SWIG_NewFunctionPtrObj", "header") { +#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0, NULL) +} +// No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg + +/* + * C++ member pointers, ie, member methods + */ +%fragment("SWIG_NewMemberObj", "header") { +#define SWIG_NewMemberObj(ptr, sz, tp) SWIG_Scilab_NewMemberObj(pvApiCtx, $result, ptr, sz, tp) +} +%fragment("SWIG_ConvertMember", "header") { +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Scilab_ConvertPacked(pvApiCtx, obj, ptr, sz, ty, SWIG_Scilab_GetFuncName()) +}
diff --git a/share/swig/3.0.12/scilab/sciprimtypes.swg b/share/swig/3.0.12/scilab/sciprimtypes.swg new file mode 100644 index 0000000..b5e30d9 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciprimtypes.swg
@@ -0,0 +1,23 @@ +%include <scidouble.swg> +%include <scifloat.swg> + +%include <scilonglong.swg> + +%include <sciint.swg> +%include <sciunsignedint.swg> + +%include <scilong.swg> +%include <sciunsignedlong.swg> + +%include <scishort.swg> +%include <sciunsignedshort.swg> + +%include <scichar.swg> +%include <scisignedchar.swg> +%include <sciunsignedchar.swg> + +%include <scimisctypes.swg> + +%include <scipointer.swg> +%include <scibool.swg> +
diff --git a/share/swig/3.0.12/scilab/scirun.swg b/share/swig/3.0.12/scilab/scirun.swg new file mode 100644 index 0000000..29f8096 --- /dev/null +++ b/share/swig/3.0.12/scilab/scirun.swg
@@ -0,0 +1,481 @@ +/* ----------------------------------------------------------------------------- + * Scilab support runtime + * -----------------------------------------------------------------------------*/ + +/* Scilab version macro */ + +#include "version.h" +#define SWIG_SCILAB_VERSION (SCI_VERSION_MAJOR * 100) + (SCI_VERSION_MINOR * 10) + SCI_VERSION_MAINTENANCE + +/* Scilab standard headers */ + +#ifdef __cplusplus +extern "C" { +#endif +#include "api_scilab.h" +#if SWIG_SCILAB_VERSION < 540 +#define __USE_DEPRECATED_STACK_FUNCTIONS__ +#include "stack-c.h" +#endif +#if SWIG_SCILAB_VERSION < 600 +#include "MALLOC.h" +#endif +#include "Scierror.h" +#include "localization.h" +#include "freeArrayOfString.h" +#include <sci_gateway.h> +#include <mex.h> +#ifdef __cplusplus +} +#endif + +/* Gateway signature */ + +#if SWIG_SCILAB_VERSION >= 600 +#define SWIG_GatewayParameters char* fname, void *pvApiCtx +#define SWIG_GatewayArguments fname, pvApiCtx +#else +#define SWIG_GatewayParameters char* fname, unsigned long fname_len +#define SWIG_GatewayArguments fname, fname_len +#endif + +/* Function name management functions */ + +#include <stdlib.h> +static char *SwigFuncName = NULL; +static char *SWIG_Scilab_GetFuncName(void) { + return SwigFuncName; +} +static void SWIG_Scilab_SetFuncName(char *funcName) { + if (SwigFuncName != NULL) { + free(SwigFuncName); + } + SwigFuncName = strdup(funcName); +} + +/* Api context management functions */ + +#if SWIG_SCILAB_VERSION >= 600 +static void *pvApiCtx = NULL; +static void SWIG_Scilab_SetApiContext(void *apiCtx) { + pvApiCtx = apiCtx; +} +#else +#define SWIG_Scilab_SetApiContext(apiCtx) +#endif + +/* Argument management functions */ + +#if SWIG_SCILAB_VERSION >= 540 +#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) +#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) +#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) +#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx) +#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos +#else +#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument) +#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckRhs(minInputArgument, 256) +#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument) +#define SWIG_NbInputArgument(pvApiCtx) Rhs +#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) LhsVar(outputArgumentPos) = argumentPos +#endif + +typedef int SwigSciObject; + +static int SwigOutputPosition = -1; +static int SWIG_Scilab_GetOutputPosition(void) { + return SwigOutputPosition; +} +static void SWIG_Scilab_SetOutputPosition(int outputPosition) { + SwigOutputPosition = outputPosition; +} + +SWIGRUNTIME int +SWIG_Scilab_SetOutput(void *pvApiCtx, SwigSciObject output) { + int outputPosition = SWIG_Scilab_GetOutputPosition(); + if (outputPosition < 0) + return SWIG_ERROR; + SWIG_AssignOutputArgument(pvApiCtx, outputPosition, + SWIG_NbInputArgument(pvApiCtx) + outputPosition); + return SWIG_OK; +} + +/* Error functions */ + +#define SCILAB_API_ARGUMENT_ERROR 999 + +SWIGINTERN const char* +SWIG_Scilab_ErrorType(int code) { + switch(code) { + case SWIG_MemoryError: + return "MemoryError"; + case SWIG_IOError: + return "IOError"; + case SWIG_RuntimeError: + return "RuntimeError"; + case SWIG_IndexError: + return "IndexError"; + case SWIG_TypeError: + return "TypeError"; + case SWIG_DivisionByZero: + return "ZeroDivisionError"; + case SWIG_OverflowError: + return "OverflowError"; + case SWIG_SyntaxError: + return "SyntaxError"; + case SWIG_ValueError: + return "ValueError"; + case SWIG_SystemError: + return "SystemError"; + case SWIG_AttributeError: + return "AttributeError"; + default: + return "RuntimeError"; + } +} +#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) + +#ifndef SWIG_SCILAB_ERROR +#define SWIG_SCILAB_ERROR 20000 +#endif + +SWIGINTERN void +SWIG_Scilab_Error(int code, const char *msg) { + Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg); +} + +#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg) + +#define SWIG_fail return SWIG_ERROR; + +SWIGRUNTIME void +SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) { + if (type) { + if (obj) + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj); + else + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); + } +} + +SWIGRUNTIME void +SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) { + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); +} + +/* Module initialization */ + +static int swig_module_initialized = 0; + +SWIGRUNTIME int +SWIG_Module_Initialized() { + return swig_module_initialized; +} + +/* Pointer conversion functions */ + +SWIGRUNTIME swig_type_info * +SWIG_Scilab_TypeQuery(const char *name); + +SWIGINTERN int +SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + int iType = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_mlist) { + int iItemCount = 0; + void *pvTypeinfo = NULL; + + sciErr = getListItemNumber(pvApiCtx, piAddrVar, &iItemCount); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iItemCount < 3) { + return SWIG_ERROR; + } + + sciErr = getPointerInList(pvApiCtx, piAddrVar, 2, &pvTypeinfo); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (descriptor) { + swig_cast_info *cast = SWIG_TypeCheck(SWIG_TypeName((swig_type_info*)pvTypeinfo), descriptor); + return (cast != NULL); + } + else { + return SWIG_ERROR; + } + } + else { + return (iType == sci_pointer); + } +} + +SWIGINTERN int +SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *descriptor, int flags, char *fname) { + SciErr sciErr; + int *piAddrVar = NULL; + int iType = 0; + void *pvPtr = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_mlist) { + int iItemCount = 0; + void *pvTypeinfo = NULL; + + sciErr = getListItemNumber(pvApiCtx, piAddrVar, &iItemCount); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iItemCount < 3) { + return SWIG_ERROR; + } + + sciErr = getPointerInList(pvApiCtx, piAddrVar, 2, &pvTypeinfo); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getPointerInList(pvApiCtx, piAddrVar, 3, &pvPtr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (pvPtr) { + if (descriptor) { + swig_cast_info *cast = SWIG_TypeCheck(SWIG_TypeName((swig_type_info *)pvTypeinfo), descriptor); + if (cast) { + int newmemory = 0; + pvPtr = SWIG_TypeCast(cast, pvPtr, &newmemory); + // TODO newmemory + } + else { + return SWIG_ERROR; + } + } + } + } + else if (iType == sci_pointer) { + sciErr = getPointer(pvApiCtx, piAddrVar, &pvPtr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + return SWIG_ERROR; + } + + if (pvObj) { + *pvObj = pvPtr; + return SWIG_OK; + } + else { + return SWIG_ERROR; + } +} + +SWIGRUNTIMEINLINE int +SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags, const char *pstTypeName) { + SciErr sciErr; + + if (descriptor) { + int *piMListAddr = NULL; + + sciErr = createMList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piMListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (pstTypeName == NULL) { + pstTypeName = SWIG_TypeName(descriptor); + } + + sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstTypeName); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 2, descriptor); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = createPointerInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 3, pvObj); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + sciErr = createPointer(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, pvObj); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + + return SWIG_OK; +} + +/* Pointer argument conversions */ + + +SWIGRUNTIME int +SWIG_Scilab_ConvertPacked(void *pvApiCtx, int iVar, void *ptr, int sz, swig_type_info *ty, char *fname) { + swig_cast_info *tc; + int *piAddrVar = NULL; + char *pstString = NULL; + char *pstStringPtr = NULL; + SciErr sciErr; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (getAllocatedSingleString(pvApiCtx, piAddrVar, &pstString)) { + return SWIG_ERROR; + } + + /* Pointer values must start with leading underscore */ + if (*pstString != '_') { + freeAllocatedSingleString(pstString); + return SWIG_ERROR; + } + + pstStringPtr = pstString; + pstStringPtr++; + pstStringPtr = (char*)SWIG_UnpackData(pstStringPtr, ptr, sz); + + if (ty) { + if (!pstStringPtr) { + freeAllocatedSingleString(pstString); + return SWIG_ERROR; + } + tc = SWIG_TypeCheck(pstStringPtr, ty); + if (!tc) { + freeAllocatedSingleString(pstString); + return SWIG_ERROR; + } + } + + freeAllocatedSingleString(pstString); + return SWIG_OK; +} + +SWIGRUNTIME int +SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_type_info *type) { + char result[1024]; + char *r = result; + + if ((2*sz + 1 + strlen(type->name)) > 1000) { + return SWIG_ERROR; + } + *(r++) = '_'; + r = SWIG_PackData(r, ptr, sz); + strcpy(r, type->name); + + if (createSingleString(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, &result[0])) + return SWIG_ERROR; + + return SWIG_OK; +} + + + + +/* + * Pointer utility functions + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" +#endif +int SWIG_this(SWIG_GatewayParameters) { + void *ptrValue = NULL; + if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) { + SWIG_Scilab_SetOutputPosition(1); + return SWIG_Scilab_SetOutput(pvApiCtx, + createScalarDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + 1, + (double)(uintptr_t)ptrValue)); + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The value is not a pointer.\n"), fname, 1); + return SWIG_ERROR; + } +} + +#ifdef __cplusplus +extern "C" +#endif +int SWIG_ptr(SWIG_GatewayParameters) { + void *ptrValue = NULL; + double dValue = 0; + if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) { + SWIG_Scilab_SetOutputPosition(1); + return SWIG_Scilab_SetOutput(pvApiCtx, + SwigScilabPtrFromObject(pvApiCtx, 1, ptrValue, NULL, 0, NULL)); + } + else { + int *piAddr; + SciErr sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (getScalarDouble(pvApiCtx, piAddr, &dValue) == 0) { + if (dValue != (uintptr_t)dValue) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1); + return SWIG_ValueError; + } + if ((dValue < 0) || (dValue > ULONG_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a pointer.\n"), fname, 1); + return SWIG_OverflowError; + } + SWIG_Scilab_SetOutputPosition(1); + return SWIG_Scilab_SetOutput(pvApiCtx, + SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL)); + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A pointer or a double expected.\n"), "SWIG_ptr", 1); + return SWIG_TypeError; + } + } +}
diff --git a/share/swig/3.0.12/scilab/sciruntime.swg b/share/swig/3.0.12/scilab/sciruntime.swg new file mode 100644 index 0000000..9abedfe --- /dev/null +++ b/share/swig/3.0.12/scilab/sciruntime.swg
@@ -0,0 +1,45 @@ +%insert(runtime) "swigrun.swg"; +%insert(runtime) "swigerrors.swg"; + +%insert(runtime) "scirun.swg"; + +%insert(init) %{ +/* Module management functions */ + +#define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer) + +SWIGRUNTIME swig_module_info* +SWIG_Scilab_GetModule(void) { + return NULL; +} + +SWIGRUNTIME void +SWIG_Scilab_SetModule(swig_module_info *swig_module) { +} +%} + +%insert(init) "swiginit.swg" + +%insert(init) %{ +SWIGRUNTIME swig_type_info * +SWIG_Scilab_TypeQuery(const char *name) { + if (SWIG_Module_Initialized()) { + return SWIG_TypeQuery(name); + } + else { + SWIG_Error(SWIG_RuntimeError, "the module is not initialized"); + return NULL; + } +} +%} + +%insert(init) %{ +#ifdef __cplusplus +extern "C" +#endif +int <module>_Init(SWIG_GatewayParameters) { + SWIG_InitializeModule(NULL); + SWIG_CreateScilabVariables(pvApiCtx); + swig_module_initialized = 1; +%}
diff --git a/share/swig/3.0.12/scilab/scisequence.swg b/share/swig/3.0.12/scilab/scisequence.swg new file mode 100644 index 0000000..5fe0fdb --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequence.swg
@@ -0,0 +1,195 @@ +/* + * + * Scilab sequence conversions + * + */ + +#define SWIG_Traits_Sequence_frag(Type) %fragment_name(AsVal_Traits_Sequence, Type) + +#define SWIG_AsCheck_Sequence_frag(Type...) %fragment_name(AsCheck_Sequence, Type) +#define SWIG_AsCheck_Sequence_dec(Type...) %symbol_name(AsCheck_Sequence, Type) +#define SWIG_AsGet_Sequence_frag(Type...) %fragment_name(AsGet_Sequence, Type) +#define SWIG_AsGet_Sequence_dec(Type...) %symbol_name(AsGet_Sequence, Type) +#define SWIG_AsSize_Sequence_frag(Type...) %fragment_name(AsSize_Sequence, Type) +#define SWIG_AsSize_Sequence_dec(Type...) %symbol_name(AsSize_Sequence, Type) +#define SWIG_FromCreate_Sequence_frag(Type...) %fragment_name(FromCreate_Sequence, Type) +#define SWIG_FromCreate_Sequence_dec(Type...) %symbol_name(FromCreate_Sequence, Type) +#define SWIG_FromSet_Sequence_frag(Type...) %fragment_name(FromSet_Sequence, Type) +#define SWIG_FromSet_Sequence_dec(Type...) %symbol_name(FromSet_Sequence, Type) + +#define SWIG_Traits_SequenceItem_frag(Type) %fragment_name(AsVal_Traits_SequenceItem, Type) +#define SWIG_AsVal_SequenceItem_frag(Type...) %fragment_name(AsVal_SequenceItem, Type) +#define SWIG_AsVal_SequenceItem_dec(Type...) %symbol_name(AsVal_SequenceItem, Type) +#define SWIG_From_SequenceItem_frag(Type...) %fragment_name(From_SequenceItem, Type) +#define SWIG_From_SequenceItem_dec(Type...) %symbol_name(From_SequenceItem, Type) + +%include <scisequencepointer.swg> +%include <scisequenceint.swg> +%include <scisequencedouble.swg> +%include <scisequencefloat.swg> +%include <scisequencestring.swg> +%include <scisequencebool.swg> + +// +// Sequence conversion +// + +%fragment(SWIG_Traits_Sequence_frag(ptr), "header", + fragment=SWIG_AsCheck_Sequence_frag(ptr), + fragment=SWIG_AsGet_Sequence_frag(ptr), + fragment=SWIG_AsSize_Sequence_frag(ptr), + fragment=SWIG_FromCreate_Sequence_frag(ptr), + fragment=SWIG_FromSet_Sequence_frag(ptr), + fragment="StdTraits", + fragment="<stdint.h>") { + +namespace swig { + // Error returned for sequence containers of default item type + template <typename T> struct traits_as_sequence { + static int check(SwigSciObject obj) { + throw std::invalid_argument("The container data type is not supported."); + } + static int get(SwigSciObject obj, void **sequence) { + throw std::invalid_argument("The container data type is not supported."); + } + static int size(SwigSciObject obj, int *size) { + throw std::invalid_argument("The container data type is not supported."); + } + }; + template <typename T> struct traits_from_sequence { + static int create(int size, void **sequence) { + throw std::invalid_argument("The container data type is not supported."); + } + static SwigSciObject set(int size, void *sequence) { + throw std::invalid_argument("The container data type is not supported."); + } + }; + + // Support sequence containers of pointers + template <typename T> struct traits_as_sequence<T*> { + static int check(SwigSciObject obj) { + return SWIG_AsCheck_Sequence_dec(ptr)(obj); + } + static int get(SwigSciObject obj, void **sequence) { + return SWIG_AsGet_Sequence_dec(ptr)(obj, (int **)sequence); + } + static int size(SwigSciObject obj, int *size) { + return SWIG_AsSize_Sequence_dec(ptr)(obj, size); + } + }; + template <typename T> struct traits_from_sequence<T*> { + static int create(int size, void **sequence) { + return SWIG_FromCreate_Sequence_dec(ptr)(size, (uintptr_t **)sequence); + } + static SwigSciObject set(int size, void *sequence) { + return SWIG_FromSet_Sequence_dec(ptr)(size, (uintptr_t *)sequence); + } + }; +} +} + +%define %traits_sequence(CppType, ScilabType) + %fragment(SWIG_Traits_Sequence_frag(CppType), "header", + fragment=SWIG_Traits_Sequence_frag(ptr), + fragment=SWIG_AsCheck_Sequence_frag(CppType), + fragment=SWIG_AsGet_Sequence_frag(CppType), + fragment=SWIG_AsSize_Sequence_frag(CppType), + fragment=SWIG_FromCreate_Sequence_frag(CppType), + fragment=SWIG_FromSet_Sequence_frag(CppType)) { + +namespace swig { + template <> struct traits_as_sequence<CppType > { + static int check(SwigSciObject obj) { + return SWIG_AsCheck_Sequence_dec(CppType)(obj); + } + static int get(SwigSciObject obj, void **sequence) { + return SWIG_AsGet_Sequence_dec(CppType)(obj, (ScilabType **)sequence); + } + static int size(SwigSciObject obj, int *size) { + return SWIG_AsSize_Sequence_dec(CppType)(obj, size); + } + }; + template <> struct traits_from_sequence<CppType > { + static int create(int size, void **sequence) { + return SWIG_FromCreate_Sequence_dec(CppType)(size, (ScilabType **)sequence); + } + static SwigSciObject set(int size, void *sequence) { + return SWIG_FromSet_Sequence_dec(CppType)(size, (ScilabType *)sequence); + } + }; +} +} +%enddef + + +// +// Sequence item conversion +// + +%fragment(SWIG_Traits_SequenceItem_frag(ptr), "header", + fragment=SWIG_AsVal_SequenceItem_frag(ptr), + fragment=SWIG_From_SequenceItem_frag(ptr), + fragment="StdTraits", + fragment="<stdint.h>") { + +namespace swig { + // Error returned for sequence containers of default item type + template <typename T> struct traits_asval_sequenceitem { + static T asval(SwigSciObject obj, void *pSequence, int iItemIndex) { + throw std::invalid_argument("The container data type is not supported."); + } + }; + template <typename T> struct traits_from_sequenceitem { + static int from(void *pSequence, int iItemIndex, T itemValue) { + throw std::invalid_argument("The container data type is not supported."); + } + }; + + // Support sequence containers of pointers + template <typename T> struct traits_asval_sequenceitem<T*> { + static T* asval(SwigSciObject obj, void *pSequence, int iItemIndex) { + return static_cast<T*>(SWIG_AsVal_SequenceItem_dec(ptr)(obj, (int *)pSequence, iItemIndex)); + } + }; + template <typename T> struct traits_from_sequenceitem<T*> { + static int from(void *pSequence, int iItemIndex, T *itemValue) { + return SWIG_From_SequenceItem_dec(ptr)((uintptr_t *)pSequence, iItemIndex, (uintptr_t) itemValue); + } + }; +} +} + +%define %traits_sequenceitem(CppType, ScilabType) + %fragment(SWIG_Traits_SequenceItem_frag(CppType), "header", + fragment=SWIG_Traits_SequenceItem_frag(ptr), + fragment=SWIG_AsVal_SequenceItem_frag(CppType), + fragment=SWIG_From_SequenceItem_frag(CppType)) { + +namespace swig { + template <> struct traits_asval_sequenceitem<CppType > { + static CppType asval(SwigSciObject obj, void *pSequence, int iItemIndex) { + return SWIG_AsVal_SequenceItem_dec(CppType)(obj, (ScilabType *)pSequence, iItemIndex); + } + }; + template <> struct traits_from_sequenceitem<CppType > { + static int from(void *pSequence, int iItemIndex, CppType itemValue) { + return SWIG_From_SequenceItem_dec(CppType)((ScilabType *)pSequence, iItemIndex, itemValue); + } + }; +} +} +%enddef + +%define %add_traits_sequence(CppType, ScilabType) + %traits_sequence(CppType, ScilabType); + %fragment(SWIG_Traits_Sequence_frag(CppType)); + %traits_sequenceitem(CppType, ScilabType); + %fragment(SWIG_Traits_SequenceItem_frag(CppType)); +%enddef + +%add_traits_sequence(int, int); +%add_traits_sequence(double, double); +%add_traits_sequence(float, float); +%add_traits_sequence(std::string, char*); +%add_traits_sequence(bool, int); +
diff --git a/share/swig/3.0.12/scilab/scisequencebool.swg b/share/swig/3.0.12/scilab/scisequencebool.swg new file mode 100644 index 0000000..b7d0784 --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequencebool.swg
@@ -0,0 +1,98 @@ +/* + * + * Scilab matrix of bool <-> C++ bool container + * + */ + +%include <scibool.swg> + +%fragment(SWIG_AsCheck_Sequence_frag(bool), "header") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(bool)(SwigSciObject obj) { + SciErr sciErr; + int *piAddrVar; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isBooleanType(pvApiCtx, piAddrVar)) { + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A boolean is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_AsGet_Sequence_frag(bool), "header", + fragment="SWIG_SciBoolean_AsIntArrayAndSize") { + +SWIGINTERN int +SWIG_AsGet_Sequence_dec(bool)(SwigSciObject obj, int **pSequence) { + int iMatrixRowCount; + int iMatrixColCount; + return (SWIG_SciBoolean_AsIntArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, pSequence, SWIG_Scilab_GetFuncName())); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(bool), "header", + fragment="SWIG_SciBoolean_AsIntArrayAndSize") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(bool)(SwigSciObject obj, int *piSize) { + int *piMatrix; + int iMatrixRowCount; + int iMatrixColCount; + if (SWIG_SciBoolean_AsIntArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, &piMatrix, SWIG_Scilab_GetFuncName()) == SWIG_OK) { + if ((iMatrixRowCount > 1) && (iMatrixColCount > 1)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: An integer vector is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } + *piSize = iMatrixRowCount * iMatrixColCount; + return SWIG_OK; + } + return SWIG_ERROR; +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(bool), "header") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(bool)(int size, int **pSequence) { + *pSequence = new int[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(bool), "header", + fragment="SWIG_SciBoolean_FromIntArrayAndSize") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(bool)(int size, int *pSequence) { + SwigSciObject obj = SWIG_SciBoolean_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, size, pSequence); + delete (int *)pSequence; + return obj; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(bool), "header") { + +SWIGINTERN bool +SWIG_AsVal_SequenceItem_dec(bool)(SwigSciObject obj, int *pSequence, int iItemIndex) { + return (bool) pSequence[iItemIndex]; +} +} + +%fragment(SWIG_From_SequenceItem_frag(bool), "header") { + +SWIGINTERN int +SWIG_From_SequenceItem_dec(bool)(int *pSequence, int iItemIndex, bool itemValue) { + pSequence[iItemIndex] = itemValue; + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scisequencedouble.swg b/share/swig/3.0.12/scilab/scisequencedouble.swg new file mode 100644 index 0000000..29cc52d --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequencedouble.swg
@@ -0,0 +1,99 @@ +/* + * + * Scilab matrix of double <-> C++ double container + * + */ + +%include <scidouble.swg> + +%fragment(SWIG_AsCheck_Sequence_frag(double), "header") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(double)(SwigSciObject obj) { + SciErr sciErr; + int *piAddrVar; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isDoubleType(pvApiCtx, piAddrVar)) { + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A double is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_AsGet_Sequence_frag(double), "header", + fragment="SWIG_SciDouble_AsDoubleArrayAndSize") { + +SWIGINTERN int +SWIG_AsGet_Sequence_dec(double)(SwigSciObject obj, double **pSequence) { + int iMatrixRowCount; + int iMatrixColCount; + return (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, pSequence, SWIG_Scilab_GetFuncName())); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(double), "header", + fragment="SWIG_SciDouble_AsDoubleArrayAndSize") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(double)(SwigSciObject obj, int *piSize) { + double *pdblMatrix; + int iMatrixRowCount; + int iMatrixColCount; + if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, &pdblMatrix, SWIG_Scilab_GetFuncName()) == SWIG_OK) { + if ((iMatrixRowCount > 1) && (iMatrixColCount > 1)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A double vector is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } + *piSize = iMatrixRowCount * iMatrixColCount; + return SWIG_OK; + } + return SWIG_ERROR; +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(double), "header") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(double)(int size, double **pSequence) { + *pSequence = new double[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(double), "header", + fragment="SWIG_SciDouble_FromDoubleArrayAndSize") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(double)(int size, double *pSequence) { + SwigSciObject obj = SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, size, pSequence); + delete (double *)pSequence; + return obj; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(double), "header") { + +SWIGINTERN double +SWIG_AsVal_SequenceItem_dec(double)(SwigSciObject obj, double *pSequence, int iItemIndex) { + return pSequence[iItemIndex]; +} +} + +%fragment(SWIG_From_SequenceItem_frag(double), "header") { + +SWIGINTERN int +SWIG_From_SequenceItem_dec(double)(double *pSequence, int iItemIndex, double itemValue) { + pSequence[iItemIndex] = itemValue; + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/scisequencefloat.swg b/share/swig/3.0.12/scilab/scisequencefloat.swg new file mode 100644 index 0000000..41d37e5 --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequencefloat.swg
@@ -0,0 +1,98 @@ +/* + * + * Scilab matrix of float <-> C++ float container + * + */ + +%include <scifloat.swg> + +%fragment(SWIG_AsCheck_Sequence_frag(float), "header") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(float)(SwigSciObject obj) { + SciErr sciErr; + int *piAddrVar; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isDoubleType(pvApiCtx, piAddrVar)) { + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A double is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_AsGet_Sequence_frag(float), "header", + fragment="SWIG_SciDouble_AsFloatArrayAndSize") { + +SWIGINTERN int +SWIG_AsGet_Sequence_dec(float)(SwigSciObject obj, float **pSequence) { + int iMatrixRowCount; + int iMatrixColCount; + return (SWIG_SciDouble_AsFloatArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, pSequence, SWIG_Scilab_GetFuncName())); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(float), "header", + fragment="SWIG_SciDouble_AsFloatArrayAndSize") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(float)(SwigSciObject obj, int *piSize) { + float *pdblMatrix; + int iMatrixRowCount; + int iMatrixColCount; + if (SWIG_SciDouble_AsFloatArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, &pdblMatrix, SWIG_Scilab_GetFuncName()) == SWIG_OK) { + if ((iMatrixRowCount > 1) && (iMatrixColCount > 1)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A float vector is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } + *piSize = iMatrixRowCount * iMatrixColCount; + return SWIG_OK; + } + return SWIG_ERROR; +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(float), "header") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(float)(int size, float **pSequence) { + *pSequence = new float[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(float), "header", + fragment="SWIG_SciDouble_FromFloatArrayAndSize") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(float)(int size, float *pSequence) { + SwigSciObject obj = SWIG_SciDouble_FromFloatArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, size, pSequence); + delete (float *)pSequence; + return obj; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(float), "header") { + +SWIGINTERN float +SWIG_AsVal_SequenceItem_dec(float)(SwigSciObject obj, float *pSequence, int iItemIndex) { + return pSequence[iItemIndex]; +} +} + +%fragment(SWIG_From_SequenceItem_frag(float), "header") { +SWIGINTERN int +SWIG_From_SequenceItem_dec(float)(float *pSequence, int iItemIndex, float itemValue) { + pSequence[iItemIndex] = itemValue; + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/scisequenceint.swg b/share/swig/3.0.12/scilab/scisequenceint.swg new file mode 100644 index 0000000..3a9f7bf --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequenceint.swg
@@ -0,0 +1,104 @@ +/* + * + * Scilab matrix of int <-> C++ int container + * + */ + +%include <sciint.swg> + +%fragment(SWIG_AsCheck_Sequence_frag(int), "header") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(int)(SwigSciObject obj) { + SciErr sciErr; + int *piAddrVar; + int iType = 0; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if ((iType == sci_matrix) || (iType == sci_ints)) { + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: An integer is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_AsGet_Sequence_frag(int), "header", + fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") { +SWIGINTERN int +SWIG_AsGet_Sequence_dec(int)(SwigSciObject obj, int **pSequence) { + int iMatrixRowCount; + int iMatrixColCount; + return (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, pSequence, SWIG_Scilab_GetFuncName())); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(int), "header", + fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(int)(SwigSciObject obj, int *piSize) { + int *piMatrix; + int iMatrixRowCount; + int iMatrixColCount; + if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, obj, &iMatrixRowCount, &iMatrixColCount, &piMatrix, SWIG_Scilab_GetFuncName()) == SWIG_OK) { + if ((iMatrixRowCount > 1) && (iMatrixColCount > 1)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: An integer vector is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } + *piSize = iMatrixRowCount * iMatrixColCount; + return SWIG_OK; + } + return SWIG_ERROR; +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(int), "header") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(int)(int size, int **pSequence) { + *pSequence = new int[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(int), "header", + fragment="SWIG_SciDouble_FromIntArrayAndSize") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(int)(int size, int *pSequence) { + SwigSciObject obj = SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, size, pSequence); + delete (int *)pSequence; + return obj; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(int), "header") { + +SWIGINTERN int +SWIG_AsVal_SequenceItem_dec(int)(SwigSciObject obj, int *pSequence, int iItemIndex) { + return pSequence[iItemIndex]; +} +} + +%fragment(SWIG_From_SequenceItem_frag(int), "header") { + +SWIGINTERN int +SWIG_From_SequenceItem_dec(int)(int *pSequence, int iItemIndex, int itemValue) { + pSequence[iItemIndex] = itemValue; + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scisequencepointer.swg b/share/swig/3.0.12/scilab/scisequencepointer.swg new file mode 100644 index 0000000..b3618e9 --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequencepointer.swg
@@ -0,0 +1,123 @@ +/* + * + * Scilab list of pointer <-> C++ pointer container + * + */ + +%include <scilist.swg> + +%fragment("<stdint.h>", "header") { +%#include <stdint.h> +} + +%fragment(SWIG_AsCheck_Sequence_frag(ptr), "header", + fragment="SWIG_ScilabList") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(ptr)(SwigSciObject obj) { + return SWIG_CheckScilabList(obj); +} +} + +%fragment(SWIG_AsGet_Sequence_frag(ptr), "header", + fragment="SWIG_ScilabList") { + +SWIGINTERN int +SWIG_AsGet_Sequence_dec(ptr)(SwigSciObject obj, int **piSequence) { + return SWIG_GetScilabList(obj, piSequence); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(ptr), "header", + fragment="SWIG_ScilabList") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(ptr)(SwigSciObject obj, int *piSize) { + return SWIG_GetScilabListSize(obj, piSize); +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(ptr), "header", + fragment="<stdint.h>") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(ptr)(int size, uintptr_t **pSequence) { + *pSequence = new uintptr_t[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(ptr), "header", + fragment="<stdint.h>") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(ptr)(int size, uintptr_t *pSequence) { + SciErr sciErr; + int *piListAddr; + + int iVarOut = SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition(); + + sciErr = createList(pvApiCtx, iVarOut, size, &piListAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + for (int i=0; i<size; i++) { + sciErr = createPointerInList(pvApiCtx, iVarOut, piListAddr, i + 1, (void *)pSequence[i]); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + delete (int*)pSequence; + return SWIG_OK; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(ptr), "header") { + +SWIGINTERN void* +SWIG_AsVal_SequenceItem_dec(ptr)(SwigSciObject obj, int *piSequence, int itemIndex) +{ + SciErr sciErr; + int *piItemAddr; + int iType; + void* pItemValue = NULL; + + sciErr = getListItemAddress(pvApiCtx, piSequence, itemIndex + 1, &piItemAddr); + if (sciErr.iErr) { + printError(&sciErr, 0); + return NULL; + } + + sciErr = getVarType(pvApiCtx, piItemAddr, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return NULL; + } + + if (iType != sci_pointer) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A pointer is expected at list item #%d.\n"), SWIG_Scilab_GetFuncName(), obj, itemIndex + 1); + return NULL; + } + + sciErr = getPointerInList(pvApiCtx, piSequence, itemIndex + 1, &pItemValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return NULL; + } + + return pItemValue; +} +} + +%fragment(SWIG_From_SequenceItem_frag(ptr), "header", + fragment="<stdint.h>") { + +SWIGINTERN int +SWIG_From_SequenceItem_dec(ptr)(uintptr_t *pSequence, int iItemIndex, uintptr_t itemValue) { + pSequence[iItemIndex] = itemValue; + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/scisequencestring.swg b/share/swig/3.0.12/scilab/scisequencestring.swg new file mode 100644 index 0000000..d3c05e4 --- /dev/null +++ b/share/swig/3.0.12/scilab/scisequencestring.swg
@@ -0,0 +1,97 @@ +/* + * + * Scilab matrix of string <-> C++ std::string container + * + */ + +%include <scichar.swg> + +%fragment(SWIG_AsCheck_Sequence_frag(std::string), "header") { + +SWIGINTERN int +SWIG_AsCheck_Sequence_dec(std::string)(SwigSciObject obj) { + SciErr sciErr; + int *piAddrVar; + + sciErr = getVarAddressFromPosition(pvApiCtx, obj, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isStringType(pvApiCtx, piAddrVar)) { + return SWIG_OK; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A string is expected.\n"), SWIG_Scilab_GetFuncName(), obj); + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_AsGet_Sequence_frag(std::string), "header", + fragment="SWIG_SciString_AsCharPtrArrayAndSize") { + +SWIGINTERN int +SWIG_AsGet_Sequence_dec(std::string)(SwigSciObject obj, char ***pSequence) { + int iRows = 0; + int iCols = 0; + return (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, obj, &iRows, &iCols, pSequence, SWIG_Scilab_GetFuncName())); +} +} + +%fragment(SWIG_AsSize_Sequence_frag(std::string), "header", + fragment="SWIG_SciString_AsCharPtrArrayAndSize") { + +SWIGINTERN int +SWIG_AsSize_Sequence_dec(std::string)(SwigSciObject obj, int *piSize) { + char **pstMatrix; + int iCols = 0; + int iRows = 0; + if (SWIG_SciString_AsCharPtrArrayAndSize(pvApiCtx, obj, &iRows, &iCols, &pstMatrix, SWIG_Scilab_GetFuncName()) == SWIG_OK) { + *piSize = iRows * iCols; + return SWIG_OK; + } + return SWIG_ERROR; +} +} + +%fragment(SWIG_FromCreate_Sequence_frag(std::string), "header") { + +SWIGINTERN int +SWIG_FromCreate_Sequence_dec(std::string)(int size, char ***pSequence) { + *pSequence = new char*[size]; + return *pSequence != NULL ? SWIG_OK : SWIG_ERROR; +} +} + +%fragment(SWIG_FromSet_Sequence_frag(std::string), "header", + fragment="SWIG_SciString_FromCharPtrArrayAndSize") { + +SWIGINTERN SwigSciObject +SWIG_FromSet_Sequence_dec(std::string)(int size, char **pSequence) { + SwigSciObject obj = SWIG_SciString_FromCharPtrArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, size, pSequence); + delete (char **)pSequence; + return obj; +} +} + +%fragment(SWIG_AsVal_SequenceItem_frag(std::string), "header") { + +SWIGINTERN std::string +SWIG_AsVal_SequenceItem_dec(std::string)(SwigSciObject obj, char **pSequence, int iItemIndex) { + return std::string(pSequence[iItemIndex]); +} +} + +%fragment(SWIG_From_SequenceItem_frag(std::string), "header") { + +SWIGINTERN int +SWIG_From_SequenceItem_dec(std::string)(char **pSequence, int iItemIndex, std::string itemValue) { + char *pChar = new char((int) itemValue.size() + 1); + strcpy(pChar, itemValue.c_str()); + pSequence[iItemIndex] = pChar; + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/scishort.swg b/share/swig/3.0.12/scilab/scishort.swg new file mode 100644 index 0000000..3d2f0f9 --- /dev/null +++ b/share/swig/3.0.12/scilab/scishort.swg
@@ -0,0 +1,188 @@ +/* + * C-type: short + * Scilab type: double or int16 + */ + +%fragment(SWIG_AsVal_frag(short), "header", fragment="SWIG_SciDoubleOrInt16_AsShort", fragment="<limits.h>") { +#define SWIG_AsVal_short(scilabValue, valuePointer) SWIG_SciDoubleOrInt16_AsShort(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrInt16_AsShort", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt16_AsShort(void *pvApiCtx, int iVar, short *psValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + int iPrec = 0; + short *psData = NULL; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT16) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + sciErr = getMatrixOfInteger16(pvApiCtx, piAddrVar, &iRows, &iCols, &psData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 16-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + *psValue = *psData; + } + else if (iType == sci_matrix) { + double *pdData = NULL; + double dValue = 0.0f; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 16-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 16-bit signed integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < SHRT_MIN) || (dValue > SHRT_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 16-bit signed integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *psValue = (short) dValue; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(short), "header", fragment="SWIG_SciDouble_FromShort") { +#define SWIG_From_short(scilabValue) SWIG_SciDouble_FromShort(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromShort", "header") { +SWIGINTERN int +SWIG_SciDouble_FromShort(void *pvApiCtx, int iVarOut, short sValue, char *fname) { + if (createScalarDouble(pvApiCtx, + SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) sValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: short[] + * Scilab type: double or int16 matrix + */ +%fragment("SWIG_SciDoubleOrInt16_AsShortArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt16_AsShortArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, short **psValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iPrec = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *psValue = (short*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*psValue)[i] = (short) pdData[i]; + } + else if (iType == sci_ints) { + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT16) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfInteger16(pvApiCtx, piAddrVar, iRows, iCols, psValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} +%fragment("SWIG_SciDouble_FromShortArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromShortArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, short *psValue) { + SciErr sciErr; + int i; + double *pdValues = NULL; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = psValue[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/scisignedchar.swg b/share/swig/3.0.12/scilab/scisignedchar.swg new file mode 100644 index 0000000..c2350b0 --- /dev/null +++ b/share/swig/3.0.12/scilab/scisignedchar.swg
@@ -0,0 +1,185 @@ +/* + * C-type: signed char + * Scilab type: double or int8 + */ +%fragment(SWIG_AsVal_frag(signed char), "header", fragment="SWIG_SciDoubleOrInt8_AsSignedChar", fragment="<limits.h>") { +#define SWIG_AsVal_signed_SS_char(scilabValue, valuePointer) SWIG_SciDoubleOrInt8_AsSignedChar(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrInt8_AsSignedChar", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt8_AsSignedChar(void *pvApiCtx, int iVar, signed char *pscValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iPrec = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + char *pcData = NULL; + + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT8) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + sciErr = getMatrixOfInteger8(pvApiCtx, piAddrVar, &iRows, &iCols, &pcData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 8-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + *pscValue = *pcData; + } + else if (iType == sci_matrix) { + double *pdData = NULL; + double dValue = 0.0f; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 8-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 8-bit signed integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < SCHAR_MIN) || (dValue > SCHAR_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 8-bit signed integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *pscValue = (signed char) dValue; + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit signed integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(signed char), "header", fragment="SWIG_SciDouble_FromSignedChar") { +#define SWIG_From_signed_SS_char(scilabValue) SWIG_SciDouble_FromSignedChar(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue) +} +%fragment("SWIG_SciDouble_FromSignedChar", "header") { +SWIGINTERN int +SWIG_SciDouble_FromSignedChar(void *pvApiCtx, int iVarOut, signed char scValue) { + if (createScalarDouble(pvApiCtx, + SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) scValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: signed char[] + * Scilab type: double or int8 matrix + */ +%fragment("SWIG_SciDoubleOrInt8_AsSignedCharArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrInt8_AsSignedCharArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, signed char **pscValue, char *fname) { + SciErr sciErr; + int iType = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *pscValue = (signed char*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*pscValue)[i] = (signed char) pdData[i]; + } + else if (iType == sci_ints) { + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_INT8) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfInteger8(pvApiCtx, piAddrVar, iRows, iCols, (char **)pscValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit signed integer or a double matrix expected.\n"), fname, iVar); + return SWIG_ERROR; + } + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromSignedCharArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromSignedCharArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, const signed char *pscValue) { + SciErr sciErr; + int i; + double *pdValues = NULL; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = pscValue[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +}
diff --git a/share/swig/2.0.11/octave/octstdcommon.swg b/share/swig/3.0.12/scilab/scistdcommon.swg similarity index 65% copy from share/swig/2.0.11/octave/octstdcommon.swg copy to share/swig/3.0.12/scilab/scistdcommon.swg index 96923f4..63f3ca1 100644 --- a/share/swig/2.0.11/octave/octstdcommon.swg +++ b/share/swig/3.0.12/scilab/scistdcommon.swg
@@ -1,67 +1,69 @@ %fragment("StdTraits","header",fragment="StdTraitsCommon") { -namespace swig { +namespace swig { // Traits that provides the from method template <class Type> struct traits_from_ptr { - static octave_value from(Type *val, int owner = 0) { - return SWIG_NewPointerObj(val, type_info<Type>(), owner); + static SwigSciObject from(Type *val, int owner = 0) { + return SWIG_OK; //SWIG_NewPointerObj(val, type_info<Type>(), owner); } }; template <class Type> struct traits_from { - static octave_value from(const Type& val) { + static SwigSciObject from(const Type& val) { return traits_from_ptr<Type>::from(new Type(val), 1); } }; template <class Type> struct traits_from<Type *> { - static octave_value from(Type* val) { + static SwigSciObject from(Type* val) { return traits_from_ptr<Type>::from(val, 0); } }; template <class Type> struct traits_from<const Type *> { - static octave_value from(const Type* val) { + static SwigSciObject from(const Type* val) { return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0); } }; template <class Type> - inline octave_value from(const Type& val) { + inline SwigSciObject from(const Type& val) { return traits_from<Type>::from(val); } template <class Type> - inline octave_value from_ptr(Type* val, int owner) { + inline SwigSciObject from_ptr(Type* val, int owner) { return traits_from_ptr<Type>::from(val, owner); } // Traits that provides the asval/as/check method template <class Type> - struct traits_asptr { - static int asptr(const octave_value& obj, Type **val) { + struct traits_asptr { + static int asptr(const SwigSciObject& obj, Type **val) { Type *p; - int res = SWIG_ConvertPtr(obj, (void**)&p, type_info<Type>(), 0); + swig_type_info *descriptor = type_info<Type>(); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = p; } return res; } - }; + }; template <class Type> - inline int asptr(const octave_value& obj, Type **vptr) { + inline int asptr(const SwigSciObject& obj, Type **vptr) { return traits_asptr<Type>::asptr(obj, vptr); } - template <class Type> + template <class Type> struct traits_asval { - static int asval(const octave_value& obj, Type *val) { + static int asval(const SwigSciObject& obj, Type *val) { if (val) { Type *p = 0; int res = traits_asptr<Type>::asptr(obj, &p); - if (!SWIG_IsOK(res)) return res; + if (!SWIG_IsOK(res)) + return res; if (p) { typedef typename noconst_traits<Type>::noconst_type noconst_type; *(const_cast<noconst_type*>(val)) = *p; @@ -80,7 +82,7 @@ }; template <class Type> struct traits_asval<Type*> { - static int asval(const octave_value& obj, Type **val) { + static int asval(const SwigSciObject& obj, Type **val) { if (val) { typedef typename noconst_traits<Type>::noconst_type noconst_type; noconst_type *p = 0; @@ -94,31 +96,32 @@ } } }; - + template <class Type> - inline int asval(const octave_value& obj, Type *val) { + inline int asval(const SwigSciObject& obj, Type *val) { return traits_asval<Type>::asval(obj, val); } - template <class Type> + template <class Type> struct traits_as<Type, value_category> { - static Type as(const octave_value& obj, bool throw_error) { + static Type as(const SwigSciObject& obj, bool throw_error) { Type v; int res = asval(obj, &v); - if (!obj.is_defined() || !SWIG_IsOK(res)) { - if (!Octave_Error_Occurred()) { - %type_error(swig::type_name<Type>()); - } - if (throw_error) throw std::invalid_argument("bad type"); + if (SWIG_IsOK(res)) { + return v; + } else { + %type_error(swig::type_name<Type>()); + if (throw_error) + throw std::invalid_argument("bad type"); + return res; } - return v; } }; - template <class Type> + template <class Type> struct traits_as<Type, pointer_category> { - static Type as(const octave_value& obj, bool throw_error) { - Type *v = 0; + static Type as(const SwigSciObject& obj, bool throw_error) { + Type *v = 0; int res = traits_asptr<Type>::asptr(obj, &v); if (SWIG_IsOK(res) && v) { if (SWIG_IsNewObj(res)) { @@ -131,56 +134,54 @@ } else { // Uninitialized return value, no Type() constructor required. static Type *v_def = (Type*) malloc(sizeof(Type)); - if (!Octave_Error_Occurred()) { - %type_error(swig::type_name<Type>()); - } - if (throw_error) throw std::invalid_argument("bad type"); + %type_error(swig::type_name<Type>()); + if (throw_error) + throw std::invalid_argument("bad type"); memset(v_def,0,sizeof(Type)); return *v_def; } } }; - template <class Type> + template <class Type> struct traits_as<Type*, pointer_category> { - static Type* as(const octave_value& obj, bool throw_error) { - Type *v = 0; + static Type* as(const SwigSciObject& obj, bool throw_error) { + Type *v = 0; int res = traits_asptr<Type>::asptr(obj, &v); if (SWIG_IsOK(res)) { return v; } else { - if (!Octave_Error_Occurred()) { - %type_error(swig::type_name<Type>()); - } - if (throw_error) throw std::invalid_argument("bad type"); - return 0; + %type_error(swig::type_name<Type>()); + if (throw_error) + throw std::invalid_argument("bad type"); + return SWIG_OK; } } }; - + template <class Type> - inline Type as(const octave_value& obj, bool te = false) { + inline Type as(const SwigSciObject& obj, bool te = false) { return traits_as<Type, typename traits<Type>::category>::as(obj, te); } - template <class Type> + template <class Type> struct traits_check<Type, value_category> { - static bool check(const octave_value& obj) { + static bool check(const SwigSciObject& obj) { int res = asval(obj, (Type *)(0)); return SWIG_IsOK(res) ? true : false; } }; - template <class Type> + template <class Type> struct traits_check<Type, pointer_category> { - static bool check(const octave_value& obj) { + static bool check(const SwigSciObject& obj) { int res = asptr(obj, (Type **)(0)); return SWIG_IsOK(res) ? true : false; } }; template <class Type> - inline bool check(const octave_value& obj) { + inline bool check(const SwigSciObject& obj) { return traits_check<Type, typename traits<Type>::category>::check(obj); } } @@ -189,9 +190,9 @@ %define %specialize_std_container(Type,Check,As,From) %{ namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval<Type > { typedef Type value_type; - static int asval(const octave_value& obj, value_type *val) { + static int asval(const SwigSciObject& obj, value_type *val) { if (Check(obj)) { if (val) *val = As(obj); return SWIG_OK; @@ -201,14 +202,14 @@ }; template <> struct traits_from<Type > { typedef Type value_type; - static octave_value from(const value_type& val) { + static SwigSciObject from(const value_type& val) { return From(val); } }; - template <> + template <> struct traits_check<Type, value_category> { - static int check(const octave_value& obj) { + static int check(const SwigSciObject& obj) { int res = Check(obj); return obj && res ? res : 0; }
diff --git a/share/swig/3.0.12/scilab/scitypemaps.swg b/share/swig/3.0.12/scilab/scitypemaps.swg new file mode 100644 index 0000000..4cf0da3 --- /dev/null +++ b/share/swig/3.0.12/scilab/scitypemaps.swg
@@ -0,0 +1,259 @@ +// Scilab fragments for primitive types +%include <sciprimtypes.swg> + +%include <scienum.swg> + +// Scilab object type +#define SWIG_Object int + +#define %append_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR +#define %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by the the function name +#define %raise(obj, type, desc) SWIG_Scilab_Raise(obj, type, desc) +#define %set_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR +#define %set_varoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR +#define %set_argoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR + +// Include the unified typemap library +%include <typemaps/swigtypemaps.swg> + +/* ---------------------------------------------------------------------------*/ +/* Generic typmemaps */ +/* */ +/* This typemap is used when Scilab does not store this type directly */ +/* For example, a 'float' is stored in Scilab as a 'double' */ +/* So we read a 'double' in Scilab and cast it to a 'float' */ +/* ---------------------------------------------------------------------------*/ + +%define %scilab_in_typemap_withcast(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPTYPE, TEMPINIT) +%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { + TEMPTYPE tempValue = TEMPINIT; + if(FRAGMENTNAME(pvApiCtx, $input, &tempValue, SWIG_Scilab_GetFuncName()) != SWIG_OK) { + return SWIG_ERROR; + } + $1 = (CTYPE) tempValue; +} +%enddef +%define %scilab_inptr_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $input, %as_voidptrptr(&$1), SWIG_Scilab_GetFuncName()) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + +%define %scilab_out_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $result, $1) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + +%define %scilab_outptr_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $result, %as_voidptr($1)) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + +%define %scilab_varout_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $result, $value) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + +%define %scilab_varoutptr_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $result, %as_voidptr($value)) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + +%define %scilab_in_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) +%typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { + if (FRAGMENTNAME(pvApiCtx, $input, &$1, SWIG_Scilab_GetFuncName()) != SWIG_OK) { + return SWIG_ERROR; + } +} +%enddef + + +/* ---------------------------------------------------------------------------*/ +/* Array typmemaps */ +/* ---------------------------------------------------------------------------*/ + +%include <sciarray.swg> + + +/* ---------------------------------------------------------------------------*/ +/* Enum typemaps */ +/* ---------------------------------------------------------------------------*/ + +%typemap(in, noblock=1, fragment=SWIG_AsVal_frag(Enum)) enum SWIGTYPE (int val) { + if (SWIG_AsVal_dec(Enum)($input, &val) != SWIG_OK) { + return SWIG_ERROR; + } + $1 = %reinterpret_cast(val, $ltype); +} + +%typemap(out, fragment=SWIG_From_frag(Enum)) enum SWIGTYPE { + if (SWIG_From_dec(Enum)($1) != SWIG_OK) { + return SWIG_ERROR; + } +} + +/* ---------------------------------------------------------------------------*/ +/* Typecheck typemaps */ +/* ---------------------------------------------------------------------------*/ + +%define %scilab_typecheck_generic(PRECEDENCE, TYPE_CHECK_FUNCTION, TYPE) +%typecheck(PRECEDENCE) TYPE { + int *piAddrVar = NULL; + SciErr sciErr = getVarAddressFromPosition(pvApiCtx, $input, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + $1 = TYPE_CHECK_FUNCTION(pvApiCtx, piAddrVar); +} +%enddef + +%fragment("SWIG_Check_SciDoubleOrInt", "header") { +SWIGINTERN int +SWIG_Check_SciDoubleOrInt(void *pvApiCtx, SwigSciObject iVar, int iIntegerType) { + int *piAddrVar = NULL; + int ret = 0; + SciErr sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return 0; + } + ret = isIntegerType(pvApiCtx, piAddrVar); + if (ret == 1) { + int iPrec = 0; + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return 0; + } + ret = (iPrec == iIntegerType) ? 1 : 0; + } + else { + ret = isDoubleType(pvApiCtx, piAddrVar); + } + return ret; +} +} + +/* Scilab equivalent for C integers can be sci_intXX or sci_matrix */ +%define %scilab_typecheck_integer(PRECEDENCE, INTTYPE, TYPE) +%typecheck(PRECEDENCE, fragment="SWIG_Check_SciDoubleOrInt") TYPE { + $1 = SWIG_Check_SciDoubleOrInt(pvApiCtx, $input, INTTYPE); +} +%enddef + +%define %scilab_typecheck_pointer(PRECEDENCE, TYPE) +%typecheck(PRECEDENCE) TYPE { + $1 = SwigScilabCheckPtr(pvApiCtx, $input, $descriptor, SWIG_Scilab_GetFuncName()); +} +%enddef + + +// Double (and Float) have priority over before Integer type. + +// Primitive types +%scilab_typecheck_pointer(SWIG_TYPECHECK_VOIDPTR, SWIGTYPE *) +%scilab_typecheck_pointer(SWIG_TYPECHECK_POINTER, SWIGTYPE *) +%scilab_typecheck_generic(SWIG_TYPECHECK_BOOL, isBooleanType, bool) +%scilab_typecheck_generic(16, isDoubleType, double) +%scilab_typecheck_generic(17, isDoubleType, float) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT8, SCI_INT8, signed char) +%scilab_typecheck_integer(SWIG_TYPECHECK_UINT8, SCI_UINT8, unsigned char) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT16, SCI_INT16, short) +%scilab_typecheck_integer(SWIG_TYPECHECK_UINT16, SCI_UINT16, unsigned short) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, int) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, long) +%scilab_typecheck_integer(SWIG_TYPECHECK_UINT32, SCI_UINT32, unsigned int) +%scilab_typecheck_integer(SWIG_TYPECHECK_UINT32, SCI_UINT32, unsigned long) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT32, SCI_INT32, enum SWIGTYPE) +%scilab_typecheck_generic(SWIG_TYPECHECK_CHAR, isStringType, char) + +// Arrays +%scilab_typecheck_generic(SWIG_TYPECHECK_BOOL_ARRAY, isBooleanType, bool) +%scilab_typecheck_generic(1016, isDoubleType, double [ANY]) +%scilab_typecheck_generic(1017, isDoubleType, float [ANY]) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT8_ARRAY, SCI_INT8, signed char [ANY]) +%scilab_typecheck_integer(1026, SCI_UINT8, unsigned char [ANY]) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT16_ARRAY, SCI_INT16, short [ANY]) +%scilab_typecheck_integer(1036, SCI_UINT16, unsigned short [ANY]) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT32_ARRAY, SCI_INT32, int [ANY]) +%scilab_typecheck_integer(SWIG_TYPECHECK_INT32_ARRAY, SCI_INT32, long [ANY]) +%scilab_typecheck_integer(1046, SCI_UINT32, unsigned int [ANY]) +%scilab_typecheck_integer(1046, SCI_UINT32, unsigned long [ANY]) +%scilab_typecheck_generic(SWIG_TYPECHECK_CHAR_ARRAY, isStringType, char [ANY]) +%scilab_typecheck_generic(SWIG_TYPECHECK_STRING_ARRAY, isStringType, char *[ANY]) +%scilab_typecheck_generic(SWIG_TYPECHECK_STRING_ARRAY, isStringType, char **) + + +/* ---------------------------------------------------------------------------*/ +/* %scilabconstcode() feature typemaps */ +/* ---------------------------------------------------------------------------*/ + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(double)) double +%{ + if (SWIG_CreateScilabVariable_double(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(int)) int +%{ + if (SWIG_CreateScilabVariable_int(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(uint)) unsigned int +%{ + if (SWIG_CreateScilabVariable_uint(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(int)) long +%{ + if (SWIG_CreateScilabVariable_int(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(uint)) unsigned long +%{ + if (SWIG_CreateScilabVariable_uint(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(char)) char +%{ + if (SWIG_CreateScilabVariable_char(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(charptr)) char * +%{ + if (SWIG_CreateScilabVariable_charptr(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + +%typemap(scilabconstcode, fragment=SWIG_CreateScilabVariable_frag(double)) enum SWIGTYPE +%{ + if (SWIG_CreateScilabVariable_double(pvApiCtx, "$result", $value) != SWIG_OK) + return SWIG_ERROR; +%} + + +/* ---------------------------------------------------------------------------*/ +/* Exception typmemaps */ +/* ---------------------------------------------------------------------------*/ + +%include <sciexception.swg>
diff --git a/share/swig/3.0.12/scilab/sciunsignedchar.swg b/share/swig/3.0.12/scilab/sciunsignedchar.swg new file mode 100644 index 0000000..f733895 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciunsignedchar.swg
@@ -0,0 +1,190 @@ +/* + * C-type: unsigned char + * Scilab type: double or uint8 + */ +%fragment(SWIG_AsVal_frag(unsigned char), "header", fragment="SWIG_SciDoubleOrUint8_AsUnsignedChar", fragment="<limits.h>") { +#define SWIG_AsVal_unsigned_SS_char(scilabValue, valuePointer) SWIG_SciDoubleOrUint8_AsUnsignedChar(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrUint8_AsUnsignedChar", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint8_AsUnsignedChar(void *pvApiCtx, int iVar, unsigned char *pucValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iPrec = 0; + int *piAddrVar = NULL; + unsigned char *pucData = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + if (pucValue) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_UINT8) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddrVar, &iRows, &iCols, &pucData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 8-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + *pucValue = *pucData; + } + } + else if (iType == sci_matrix) { + if (pucValue) { + double *pdData = NULL; + double dValue = 0.0f; + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 8-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 8-bit unsigned integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < 0) || (dValue > UCHAR_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 8-bit unsigned integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *pucValue = (unsigned char) dValue; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(unsigned char), "header", fragment="SWIG_SciDouble_FromUnsignedChar") { +#define SWIG_From_unsigned_SS_char(value) SWIG_SciDouble_FromUnsignedChar(pvApiCtx, SWIG_Scilab_GetOutputPosition(), value) +} +%fragment("SWIG_SciDouble_FromUnsignedChar", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedChar(void *pvApiCtx, int iVarOut, unsigned char ucValue) { + if (createScalarDouble(pvApiCtx, + SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) ucValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: unsigned char[] + * Scilab type: double or uint8 matrix + */ +%fragment("SWIG_SciDoubleOrUint8_AsUnsignedCharArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint8_AsUnsignedCharArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, unsigned char **pucValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iPrec = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *pucValue = (unsigned char*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*pucValue)[i] = (unsigned char) pdData[i]; + } + else if (iType == sci_ints) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iPrec != SCI_UINT8) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddrVar, iRows, iCols, pucValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 8-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromUnsignedCharArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedCharArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, const unsigned char *pucValues) { + SciErr sciErr; + double *pdValues = NULL; + int i; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = pucValues[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/sciunsignedint.swg b/share/swig/3.0.12/scilab/sciunsignedint.swg new file mode 100644 index 0000000..021b0ea --- /dev/null +++ b/share/swig/3.0.12/scilab/sciunsignedint.swg
@@ -0,0 +1,204 @@ +/* + * C-type: unsigned int + * Scilab type: double or uint32 + */ +%fragment(SWIG_AsVal_frag(unsigned int), "header", fragment="SWIG_SciDoubleOrUint32_AsUnsignedInt", fragment="<limits.h>") { +%#define SWIG_AsVal_unsigned_SS_int(scilabValue, valuePointer) SWIG_SciDoubleOrUint32_AsUnsignedInt(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrUint32_AsUnsignedInt", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint32_AsUnsignedInt(void *pvApiCtx, int iVar, unsigned int *puiValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iPrec = 0; + int *piAddrVar = NULL; + unsigned int *puiData = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + if (puiValue) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_UINT32) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddrVar, &iRows, &iCols, &puiData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + *puiValue = *puiData; + } + } + else if (iType == sci_matrix) { + if (puiValue) { + double *pdData = NULL; + double dValue = 0.0f; + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 32-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 32-bit unsigned integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < 0) || (dValue > UINT_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 32-bit unsigned integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *puiValue = (unsigned int) dValue; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(unsigned int), "header", fragment="SWIG_SciDouble_FromUnsignedInt") { +%#define SWIG_From_unsigned_SS_int(scilabValue) SWIG_SciDouble_FromUnsignedInt(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromUnsignedInt", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedInt(void *pvApiCtx, int iVarOut, unsigned int uiValue, char *fname) { + if (createScalarDouble(pvApiCtx, + SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) uiValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: unsigned int[] + * Scilab type: uint32 vector + */ +%fragment("SWIG_SciDoubleOrUint32_AsUnsignedIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint32_AsUnsignedIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, unsigned int **puiValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iPrec = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *puiValue = (unsigned int*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*puiValue)[i] = (unsigned int) pdData[i]; + } + else if (iType == sci_ints) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iPrec != SCI_UINT32) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, piAddrVar, iRows, iCols, puiValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromUnsignedIntArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedIntArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, unsigned int *puiValues) { + SciErr sciErr; + double *pdValues = NULL; + int i; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = puiValues[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +} + +%fragment(SWIG_CreateScilabVariable_frag(uint), "wrapper") { +SWIGINTERN int +SWIG_CreateScilabVariable_dec(uint)(void *pvApiCtx, const char* psVariableName, const unsigned int uiVariableValue) { + SciErr sciErr; + sciErr = createNamedMatrixOfUnsignedInteger32(pvApiCtx, psVariableName, 1, 1, &uiVariableValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + return SWIG_OK; +} +} +
diff --git a/share/swig/3.0.12/scilab/sciunsignedlong.swg b/share/swig/3.0.12/scilab/sciunsignedlong.swg new file mode 100644 index 0000000..0e9b906 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciunsignedlong.swg
@@ -0,0 +1,53 @@ +/* + * C-type: unsigned long + * Scilab type: see unsigned int + */ + +%fragment(SWIG_AsVal_frag(unsigned long), "header", fragment="SWIG_UnsignedInt_AsUnsignedLong") { +#define SWIG_AsVal_unsigned_SS_long(scilabValue, valuePointer) SWIG_UnsignedInt_AsUnsignedLong(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_UnsignedInt_AsUnsignedLong", "header", fragment=SWIG_AsVal_frag(unsigned int)) { +SWIGINTERN int +SWIG_UnsignedInt_AsUnsignedLong(void *pvApiCtx, SwigSciObject iVar, unsigned long *pulValue, char *fname) { + unsigned int uiValue = 0; + if(SWIG_AsVal_unsigned_SS_int(iVar, &uiValue) != SWIG_OK) { + return SWIG_ERROR; + } + *pulValue = (unsigned long) uiValue; + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(unsigned long), "header", fragment="SWIG_UnsignedInt_FromUnsignedLong") { +#define SWIG_From_unsigned_SS_long(scilabValue) SWIG_UnsignedInt_FromUnsignedLong(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_UnsignedInt_FromUnsignedLong", "header", fragment=SWIG_From_frag(unsigned int)) { +SWIGINTERN int +SWIG_UnsignedInt_FromUnsignedLong(void *pvApiCtx, int iVarOut, unsigned long ulValue, char *fname) { + return SWIG_From_unsigned_SS_int((unsigned int)ulValue); +} +} + +%fragment("SWIG_SciDouble_FromUnsignedLongArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedLongArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, const unsigned long *pulValues) { + SciErr sciErr; + double *pdValues = NULL; + int i; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) { + pdValues[i] = pulValues[i]; + } + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/sciunsignedshort.swg b/share/swig/3.0.12/scilab/sciunsignedshort.swg new file mode 100644 index 0000000..110fba4 --- /dev/null +++ b/share/swig/3.0.12/scilab/sciunsignedshort.swg
@@ -0,0 +1,189 @@ +/* + * C-type: unsigned short + * Scilab type: double or uint16 + */ +%fragment(SWIG_AsVal_frag(unsigned short), "header", fragment="SWIG_SciDoubleOrUint16_AsUnsignedShort", fragment="<limits.h>") { +%#define SWIG_AsVal_unsigned_SS_short(scilabValue, valuePointer) SWIG_SciDoubleOrUint16_AsUnsignedShort(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDoubleOrUint16_AsUnsignedShort", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint16_AsUnsignedShort(void *pvApiCtx, int iVar, unsigned short *pusValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iRows = 0; + int iCols = 0; + int iPrec = 0; + int *piAddrVar = NULL; + unsigned short *pusData = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_ints) { + if (pusValue) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iPrec != SCI_UINT16) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddrVar, &iRows, &iCols, &pusData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 16-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + *pusValue = *pusData; + } + } + else if (iType == sci_matrix) { + if (pusValue) { + double *pdData = NULL; + double dValue = 0.0f; + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + if (iRows * iCols != 1) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong size for input argument #%d: A 16-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_TypeError; + } + dValue = *pdData; + if (dValue != floor(dValue)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Incorrect value for input argument #%d: The double value cannot be converted to a 16-bit unsigned integer.\n"), fname, iVar); + return SWIG_ValueError; + } + if ((dValue < 0) || (dValue > USHRT_MAX)) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Overflow error for input argument #%d: The double value cannot be converted to a 16-bit unsigned integer.\n"), fname, iVar); + return SWIG_OverflowError; + } + *pusValue = (unsigned short) dValue; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer or a double expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment(SWIG_From_frag(unsigned short), "header", fragment="SWIG_SciDouble_FromUnsignedShort") { +%#define SWIG_From_unsigned_SS_short(scilabValue) SWIG_SciDouble_FromUnsignedShort(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName()) +} +%fragment("SWIG_SciDouble_FromUnsignedShort", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedShort(void *pvApiCtx, int iVarOut, unsigned short usValue, char *fname) { + if (createScalarDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, (double) usValue)) + return SWIG_ERROR; + return SWIG_OK; +} +} + +/* + * C-type: unsigned short[] + * Scilab type: uint16 vector + */ +%fragment("SWIG_SciDoubleOrUint16_AsUnsignedShortArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDoubleOrUint16_AsUnsignedShortArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, unsigned short **pusValue, char *fname) { + SciErr sciErr; + int iType = 0; + int iPrec = 0; + int *piAddrVar = NULL; + + sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + sciErr = getVarType(pvApiCtx, piAddrVar, &iType); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iType == sci_matrix) { + double *pdData = NULL; + int size = 0; + int i; + + sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, &pdData); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + size = (*iRows) * (*iCols); + *pusValue = (unsigned short*) malloc(size * sizeof(int*)); + for (i = 0; i < size; i++) + (*pusValue)[i] = (unsigned short) pdData[i]; + } + else if (iType == sci_ints) { + sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrVar, &iPrec); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (iPrec != SCI_UINT16) { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddrVar, iRows, iCols, pusValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + } + else { + Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 16-bit unsigned integer or a double vector expected.\n"), fname, iVar); + return SWIG_ERROR; + } + + return SWIG_OK; +} +} + +%fragment("SWIG_SciDouble_FromUnsignedShortArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromUnsignedShortArrayAndSize(void *pvApiCtx, int iVarOut, int iRows, int iCols, unsigned short *pusValues) { + SciErr sciErr; + double *pdValues = NULL; + int i; + + pdValues = (double*) malloc(iRows * iCols * sizeof(double)); + for (i=0; i<iRows * iCols; i++) + pdValues[i] = pusValues[i]; + + sciErr = createMatrixOfDouble(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, iRows, iCols, pdValues); + if (sciErr.iErr) { + printError(&sciErr, 0); + free(pdValues); + return SWIG_ERROR; + } + + free(pdValues); + return SWIG_OK; +} +}
diff --git a/share/swig/3.0.12/scilab/std_alloc.i b/share/swig/3.0.12/scilab/std_alloc.i new file mode 100644 index 0000000..6ea03aa --- /dev/null +++ b/share/swig/3.0.12/scilab/std_alloc.i
@@ -0,0 +1,2 @@ +%include <std/std_alloc.i> +
diff --git a/share/swig/3.0.12/scilab/std_basic_string.i b/share/swig/3.0.12/scilab/std_basic_string.i new file mode 100644 index 0000000..43b660d --- /dev/null +++ b/share/swig/3.0.12/scilab/std_basic_string.i
@@ -0,0 +1,46 @@ +/* + * C++: basic_string<char> + * Scilab: string + */ + +#define %swig_basic_string(Type...) %swig_sequence_methods_val(Type) + +%fragment(SWIG_AsPtr_frag(std::basic_string<char>), "header", fragment="SWIG_SciString_AsCharPtrAndLength") { +SWIGINTERN int +SWIG_AsPtr_dec(std::basic_string<char>)(int _iVar, std::basic_string<char> **_pstValue) { + char* buf = 0; + size_t len = 0; + int alloc = SWIG_OLDOBJ; + + if (SWIG_IsOK((SWIG_SciString_AsCharPtrAndSize(pvApiCtx, _iVar, &buf, &len, &alloc, SWIG_Scilab_GetFuncName())))) { + if (buf) { + if (_pstValue) { + *_pstValue = new std::string(buf, len - 1); + } + if (alloc == SWIG_NEWOBJ) { + delete[] buf; + } + return SWIG_NEWOBJ; + } + else { + if (_pstValue) { + *_pstValue = NULL; + } + return SWIG_OLDOBJ; + } + } else { + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_From_frag(std::basic_string<char>), "header", fragment="SWIG_SciString_FromCharPtr") { +SWIGINTERN int +SWIG_From_dec(std::basic_string<char>)(std::basic_string<char> _pstValue) { + return SWIG_SciString_FromCharPtr(pvApiCtx, SWIG_Scilab_GetOutputPosition(), _pstValue.c_str()); +} +} + +%include <std/std_basic_string.i> + +
diff --git a/share/swig/2.0.11/octave/std_char_traits.i b/share/swig/3.0.12/scilab/std_char_traits.i similarity index 100% copy from share/swig/2.0.11/octave/std_char_traits.i copy to share/swig/3.0.12/scilab/std_char_traits.i
diff --git a/share/swig/2.0.11/octave/std_common.i b/share/swig/3.0.12/scilab/std_common.i similarity index 79% copy from share/swig/2.0.11/octave/std_common.i copy to share/swig/3.0.12/scilab/std_common.i index 9aebf7f..97cfa7b 100644 --- a/share/swig/2.0.11/octave/std_common.i +++ b/share/swig/3.0.12/scilab/std_common.i
@@ -1,5 +1,5 @@ %include <std/std_except.i> -%include <octstdcommon.swg> +%include <scistdcommon.swg> // Generate the traits for a 'primitive' type, such as 'double', @@ -11,19 +11,19 @@ fragment=SWIG_From_frag(Type), fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef value_category category; static const char* type_name() { return #Type; } - }; - template <> struct traits_asval<Type > { + }; + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(octave_value obj, value_type *val) { + static int asval(SwigSciObject obj, value_type *val) { return SWIG_AsVal(Type)(obj, val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; - static octave_value from(const value_type& val) { + static SwigSciObject from(const value_type& val) { return SWIG_From(Type)(val); } }; @@ -44,15 +44,15 @@ fragment=SWIG_From_frag(int), fragment="StdTraits") { namespace swig { - template <> struct traits_asval<Type > { + template <> struct traits_asval< Type > { typedef Type value_type; - static int asval(octave_value obj, value_type *val) { + static int asval(SwigSciObject obj, value_type *val) { return SWIG_AsVal(int)(obj, (int *)val); } }; - template <> struct traits_from<Type > { + template <> struct traits_from< Type > { typedef Type value_type; - static octave_value from(const value_type& val) { + static SwigSciObject from(const value_type& val) { return SWIG_From(int)((int)val); } };
diff --git a/share/swig/3.0.12/scilab/std_container.i b/share/swig/3.0.12/scilab/std_container.i new file mode 100644 index 0000000..a1e037b --- /dev/null +++ b/share/swig/3.0.12/scilab/std_container.i
@@ -0,0 +1,3 @@ +%include <scicontainer.swg> +%include <std/std_container.i> +
diff --git a/share/swig/3.0.12/scilab/std_deque.i b/share/swig/3.0.12/scilab/std_deque.i new file mode 100644 index 0000000..d2ca597 --- /dev/null +++ b/share/swig/3.0.12/scilab/std_deque.i
@@ -0,0 +1,31 @@ +/* + * + * C++ type : STL deque + * Scilab type : matrix (for primitive types) or list (for pointer types) + * +*/ + +%fragment("StdDequeTraits", "header", fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T> + struct traits_asptr<std::deque<T> > { + static int asptr(const SwigSciObject &obj, std::deque<T> **deq) { + return traits_asptr_stdseq<std::deque<T> >::asptr(obj, deq); + } + }; + + template <class T> + struct traits_from<std::deque<T> > { + static SwigSciObject from(const std::deque<T>& deq) { + return traits_from_stdseq<std::deque<T> >::from(deq); + } + }; + } +%} + + +#define %swig_deque_methods(Type...) %swig_sequence_methods(Type) +#define %swig_deque_methods_val(Type...) %swig_sequence_methods_val(Type); + +%include <std/std_deque.i>
diff --git a/share/swig/2.0.11/octave/std_except.i b/share/swig/3.0.12/scilab/std_except.i similarity index 100% copy from share/swig/2.0.11/octave/std_except.i copy to share/swig/3.0.12/scilab/std_except.i
diff --git a/share/swig/3.0.12/scilab/std_list.i b/share/swig/3.0.12/scilab/std_list.i new file mode 100644 index 0000000..75d002d --- /dev/null +++ b/share/swig/3.0.12/scilab/std_list.i
@@ -0,0 +1,30 @@ +/* + * + * C++ type : STL list + * Scilab type : matrix (for primitive types) or list (for pointer types) + * +*/ + +%fragment("StdListTraits", "header", fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T > + struct traits_asptr<std::list<T> > { + static int asptr(SwigSciObject obj, std::list<T> **lis) { + return traits_asptr_stdseq<std::list<T> >::asptr(obj, lis); + } + }; + + template <class T> + struct traits_from<std::list<T> > { + static SwigSciObject from(const std::list<T> &lis) { + return traits_from_stdseq<std::list<T> >::from(lis); + } + }; + } +%} + +#define %swig_list_methods(Type...) %swig_sequence_methods(Type) +#define %swig_list_methods_val(Type...) %swig_sequence_methods_val(Type); + +%include <std/std_list.i>
diff --git a/share/swig/2.0.11/tcl/std_map.i b/share/swig/3.0.12/scilab/std_map.i similarity index 92% copy from share/swig/2.0.11/tcl/std_map.i copy to share/swig/3.0.12/scilab/std_map.i index 1b7e769..250d2d8 100644 --- a/share/swig/2.0.11/tcl/std_map.i +++ b/share/swig/3.0.12/scilab/std_map.i
@@ -1,7 +1,5 @@ // // SWIG typemaps for std::map -// Luigi Ballabio -// Jan. 2003 // // Common implementation @@ -24,10 +22,6 @@ template<class K, class T> class map { // add typemaps here public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef K key_type; - typedef T mapped_type; map(); map(const map<K,T> &);
diff --git a/share/swig/3.0.12/scilab/std_multiset.i b/share/swig/3.0.12/scilab/std_multiset.i new file mode 100644 index 0000000..67e1792 --- /dev/null +++ b/share/swig/3.0.12/scilab/std_multiset.i
@@ -0,0 +1,30 @@ +/* + * + * C++ type : STL multiset + * Scilab type : matrix (for primitive types) or list (for pointer types) + * +*/ + +%fragment("StdMultisetTraits", "header", fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T> + struct traits_asptr<std::multiset<T> > { + static int asptr(const SwigSciObject &obj, std::multiset<T> **multiset) { + return traits_asptr_stdseq<std::multiset<T> >::asptr(obj, multiset); + } + }; + + template <class T> + struct traits_from<std::multiset<T> > { + static SwigSciObject from(const std::multiset<T>& multiset) { + return traits_from_stdseq<std::multiset<T> >::from(multiset); + } + }; + } +%} + +#define %swig_multiset_methods(Set...) %swig_sequence_methods(Type) +#define %swig_multiset_methods_val(Type...) %swig_sequence_methods_val(Type); + +%include <std/std_multiset.i>
diff --git a/share/swig/2.0.11/tcl/std_pair.i b/share/swig/3.0.12/scilab/std_pair.i similarity index 100% copy from share/swig/2.0.11/tcl/std_pair.i copy to share/swig/3.0.12/scilab/std_pair.i
diff --git a/share/swig/3.0.12/scilab/std_set.i b/share/swig/3.0.12/scilab/std_set.i new file mode 100644 index 0000000..9070e2d --- /dev/null +++ b/share/swig/3.0.12/scilab/std_set.i
@@ -0,0 +1,32 @@ +/* + * + * C++ type : STL set + * Scilab type : matrix (for primitive types) or list (for pointer types) + * +*/ + +%fragment("StdSetTraits", "header", fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T> + struct traits_asptr<std::set<T> > { + static int asptr(const SwigSciObject &obj, std::set<T> **set) { + return traits_asptr_stdseq<std::set<T> >::asptr(obj, set); + } + }; + + template <class T> + struct traits_from<std::set<T> > { + static SwigSciObject from(const std::set<T>& set) { + return traits_from_stdseq<std::set<T> >::from(set); + } + }; + } +%} + + +#define %swig_set_methods(Type...) %swig_sequence_methods(Type) +#define %swig_set_methods_val(Type...) %swig_sequence_methods_val(Type); + +%include <std/std_set.i> +
diff --git a/share/swig/3.0.12/scilab/std_string.i b/share/swig/3.0.12/scilab/std_string.i new file mode 100644 index 0000000..71ac6d2 --- /dev/null +++ b/share/swig/3.0.12/scilab/std_string.i
@@ -0,0 +1,39 @@ +/* + * POINTER + */ +%fragment(SWIG_AsPtr_frag(std::string), "header", fragment="SWIG_SciString_AsCharPtrAndSize") { +SWIGINTERN int +SWIG_AsPtr_dec(std::string)(int iVar, std::string **pstValue) { + char* buf = 0; + size_t size = 0; + int alloc = SWIG_OLDOBJ; + + if (SWIG_IsOK((SWIG_SciString_AsCharPtrAndSize(pvApiCtx, iVar, &buf, &size, &alloc, SWIG_Scilab_GetFuncName())))) { + if (buf) { + if (pstValue) { + *pstValue = new std::string(buf, size); + } + if (alloc == SWIG_NEWOBJ) { + delete[] buf; + } + return SWIG_NEWOBJ; + } else { + if (pstValue) { + *pstValue = NULL; + } + return SWIG_OLDOBJ; + } + } else { + return SWIG_ERROR; + } +} +} + +%fragment(SWIG_From_frag(std::string), "header", fragment="SWIG_SciString_FromCharPtr") { +SWIGINTERN int +SWIG_From_dec(std::string)(std::string pstValue) { + return SWIG_SciString_FromCharPtr(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pstValue.c_str()); +} +} + +%include <typemaps/std_string.swg>
diff --git a/share/swig/3.0.12/scilab/std_vector.i b/share/swig/3.0.12/scilab/std_vector.i new file mode 100644 index 0000000..6eaeeca --- /dev/null +++ b/share/swig/3.0.12/scilab/std_vector.i
@@ -0,0 +1,31 @@ +/* + * + * C++ type : STL vector + * Scilab type : matrix (for primitive types) or list (for pointer types) + * +*/ + +%fragment("StdVectorTraits", "header", fragment="StdSequenceTraits") +%{ + namespace swig { + template <class T> + struct traits_asptr<std::vector<T> > { + static int asptr(const SwigSciObject &obj, std::vector<T> **vec) { + return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec); + } + }; + + template <class T> + struct traits_from<std::vector<T> > { + static SwigSciObject from(const std::vector<T>& vec) { + return traits_from_stdseq<std::vector<T> >::from(vec); + } + }; + } +%} + + +#define %swig_vector_methods(Type...) %swig_sequence_methods(Type) +#define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type); + +%include <std/std_vector.i>
diff --git a/share/swig/2.0.11/octave/stl.i b/share/swig/3.0.12/scilab/stl.i similarity index 100% copy from share/swig/2.0.11/octave/stl.i copy to share/swig/3.0.12/scilab/stl.i
diff --git a/share/swig/3.0.12/scilab/typemaps.i b/share/swig/3.0.12/scilab/typemaps.i new file mode 100644 index 0000000..9d71387 --- /dev/null +++ b/share/swig/3.0.12/scilab/typemaps.i
@@ -0,0 +1,62 @@ +/* ----------------------------------------------------------------------------- + * typemaps.i + * + * ----------------------------------------------------------------------------- */ + +// INPUT typemaps +%define %scilab_input_typemap(Type) +%typemap(in, noblock=1, fragment=SWIG_AsVal_frag(Type)) Type *INPUT(Type temp)(int ecode), Type &INPUT(Type temp)(int ecode) { + ecode = SWIG_AsVal_dec(Type)($input, &temp); + if (!SWIG_IsOK(ecode)) { + %argument_fail(ecode, "$type", $symname, $argnum); + } + $1 = &temp; +} + +%typemap(freearg, noblock=1) Type *INPUT, Type &INPUT { +} + +%typemap(typecheck) Type *INPUT, Type &INPUT { +} +%enddef + +// OUTPUT typemaps +%define %scilab_output_typemap(Type) +%typemap(argout, noblock=1, fragment=SWIG_From_frag(Type)) Type *OUTPUT, Type &OUTPUT { + %set_output(SWIG_From_dec(Type)(*$1)); +} +%enddef + +// INOUT typemaps +%define %scilab_inout_typemap(Type) + %typemap(in) Type *INOUT = Type *INPUT; + %typemap(in) Type &INOUT = Type &INPUT; + %typemap(argout) Type *INOUT = Type *OUTPUT; + %typemap(argout) Type &INOUT = Type &OUTPUT; +%enddef + + +%define %scilab_inout_typemaps(Type) + %scilab_input_typemap(%arg(Type)) + %scilab_output_typemap(%arg(Type)) + %scilab_inout_typemap(%arg(Type)) +%enddef + +%scilab_inout_typemaps(double); +%scilab_inout_typemaps(signed char); +%scilab_inout_typemaps(unsigned char); +%scilab_inout_typemaps(short); +%scilab_inout_typemaps(unsigned short); +%scilab_inout_typemaps(int); +%scilab_inout_typemaps(unsigned int); +%scilab_inout_typemaps(long); +%scilab_inout_typemaps(unsigned long); +%scilab_inout_typemaps(bool); +%scilab_inout_typemaps(float); + +//%apply_ctypes(%scilab_inout_typemaps); + + + + +
diff --git a/share/swig/2.0.11/shared_ptr.i b/share/swig/3.0.12/shared_ptr.i similarity index 79% rename from share/swig/2.0.11/shared_ptr.i rename to share/swig/3.0.12/shared_ptr.i index 450493d..2975b06 100644 --- a/share/swig/2.0.11/shared_ptr.i +++ b/share/swig/3.0.12/shared_ptr.i
@@ -4,6 +4,13 @@ // to use a pointer to the smart pointer of the type, rather than the usual pointer to the underlying type. // So for some type T, shared_ptr<T> * is used rather than T *. +// Another key part of the implementation is the smartptr feature: +// %feature("smartptr") T { shared_ptr<T> } +// This feature marks the class T as having a smartptr to it (the shared_ptr<T> type). This is then used to +// support smart pointers and inheritance. Say class D derives from base B, then shared_ptr<D> is marked +// with a fake inheritance from shared_ptr<B> in the type system if the "smartptr" feature is used on both +// B and D. This is to emulate the conversion of shared_ptr<D> to shared_ptr<B> in the target language. + // shared_ptr namespaces could be boost or std or std::tr1 // For example for std::tr1, use: // #define SWIG_SHARED_PTR_NAMESPACE std
diff --git a/share/swig/2.0.11/std/_std_deque.i b/share/swig/3.0.12/std/_std_deque.i similarity index 92% rename from share/swig/2.0.11/std/_std_deque.i rename to share/swig/3.0.12/std/_std_deque.i index 7dd3552..af9db27 100644 --- a/share/swig/2.0.11/std/_std_deque.i +++ b/share/swig/3.0.12/std/_std_deque.i
@@ -24,7 +24,7 @@ }; */ -%define %std_deque_methods_noempty(T) +%define %std_deque_methods_noempty(T...) typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T value_type; @@ -35,11 +35,11 @@ deque(); deque(unsigned int size, const T& value=T()); - deque(const deque<T> &); + deque(const deque< T > &); ~deque(); void assign(unsigned int n, const T& value); - void swap(deque<T> &x); + void swap(deque< T > &x); unsigned int size() const; unsigned int max_size() const; void resize(unsigned int n, T c = T()); @@ -78,17 +78,17 @@ throw std::out_of_range("deque index out of range"); } } - std::deque<T> getslice(int i, int j) { + std::deque< T > getslice(int i, int j) { int size = int(self->size()); if (i<0) i = size+i; if (j<0) j = size+j; if (i<0) i = 0; if (j>size) j = size; - std::deque<T > tmp(j-i); + std::deque< T > tmp(j-i); std::copy(self->begin()+i,self->begin()+j,tmp.begin()); return tmp; } - void setslice(int i, int j, const std::deque<T>& v) { + void setslice(int i, int j, const std::deque< T >& v) { int size = int(self->size()); if (i<0) i = size+i; if (j<0) j = size+j; @@ -116,7 +116,7 @@ %enddef #ifdef SWIGPHP -%define %std_deque_methods(T) +%define %std_deque_methods(T...) %extend { bool is_empty() const { return self->empty(); @@ -125,7 +125,7 @@ %std_deque_methods_noempty(T) %enddef #else -%define %std_deque_methods(T) +%define %std_deque_methods(T...) bool empty() const; %std_deque_methods_noempty(T) %enddef
diff --git a/share/swig/2.0.11/std/std_alloc.i b/share/swig/3.0.12/std/std_alloc.i similarity index 100% rename from share/swig/2.0.11/std/std_alloc.i rename to share/swig/3.0.12/std/std_alloc.i
diff --git a/share/swig/3.0.12/std/std_array.i b/share/swig/3.0.12/std/std_array.i new file mode 100644 index 0000000..aadc3b8 --- /dev/null +++ b/share/swig/3.0.12/std/std_array.i
@@ -0,0 +1,85 @@ +// +// std::array +// + +%include <std_container.i> + +%define %std_array_methods(array...) + %std_sequence_methods_non_resizable(array) + void fill(const value_type& u); +%enddef + + +%define %std_array_methods_val(array...) + %std_sequence_methods_non_resizable_val(array) + void fill(const value_type& u); +%enddef + +// ------------------------------------------------------------------------ +// std::array +// +// The aim of all that follows would be to integrate std::array with +// as much as possible, namely, to allow the user to pass and +// be returned tuples or lists. +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::array<T, N>), f(const std::array<T, N>&): +// the parameter being read-only, either a sequence or a +// previously wrapped std::array<T, N> can be passed. +// -- f(std::array<T, N>&), f(std::array<T, N>*): +// the parameter may be modified; therefore, only a wrapped std::array +// can be passed. +// -- std::array<T, N> f(), const std::array<T, N>& f(): +// the array is returned by copy; therefore, a sequence of T:s +// is returned which is most easily used in other functions +// -- std::array<T, N>& f(), std::array<T, N>* f(): +// the array is returned by reference; therefore, a wrapped std::array +// is returned +// -- const std::array<T, N>* f(), f(const std::array<T, N>*): +// for consistency, they expect and return a plain array pointer. +// ------------------------------------------------------------------------ + + +// exported classes + +namespace std { + + template<class _Tp, size_t _Nm > + class array { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + %traits_swigtype(_Tp); + %traits_enum(_Tp); + + %fragment(SWIG_Traits_frag(std::array< _Tp, _Nm >), "header", + fragment=SWIG_Traits_frag(_Tp), + fragment="StdArrayTraits") { + namespace swig { + template <> struct traits<std::array< _Tp, _Nm > > { + typedef pointer_category category; + static const char* type_name() { + return "std::array<" #_Tp "," #_Nm " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_STDARRAY, std::array< _Tp, _Nm >); + +#ifdef %swig_array_methods + // Add swig/language extra methods + %swig_array_methods(std::array< _Tp, _Nm >); +#endif + + %std_array_methods(array); + }; +} +
diff --git a/share/swig/2.0.11/std/std_basic_string.i b/share/swig/3.0.12/std/std_basic_string.i similarity index 91% rename from share/swig/2.0.11/std/std_basic_string.i rename to share/swig/3.0.12/std/std_basic_string.i index 7b0898a..fb7afc1 100644 --- a/share/swig/2.0.11/std/std_basic_string.i +++ b/share/swig/3.0.12/std/std_basic_string.i
@@ -3,10 +3,7 @@ %include <std_alloc.i> %include <std_char_traits.i> - -%{ -#include <string> -%} +%fragment("<string>"); namespace std { @@ -203,7 +200,7 @@ #ifdef %swig_basic_string // Add swig/language extra methods - %swig_basic_string(std::basic_string<_CharT, _Traits, _Alloc >); + %swig_basic_string(std::basic_string< _CharT, _Traits, _Alloc >); #endif #ifdef SWIG_EXPORT_ITERATOR_METHODS @@ -241,19 +238,19 @@ %newobject __radd__; %extend { - std::basic_string<_CharT,_Traits,_Alloc >* __add__(const basic_string& v) { - std::basic_string<_CharT,_Traits,_Alloc >* res = new std::basic_string<_CharT,_Traits,_Alloc >(*self); + std::basic_string< _CharT,_Traits,_Alloc >* __add__(const basic_string& v) { + std::basic_string< _CharT,_Traits,_Alloc >* res = new std::basic_string< _CharT,_Traits,_Alloc >(*self); *res += v; return res; } - std::basic_string<_CharT,_Traits,_Alloc >* __radd__(const basic_string& v) { - std::basic_string<_CharT,_Traits,_Alloc >* res = new std::basic_string<_CharT,_Traits,_Alloc >(v); + std::basic_string< _CharT,_Traits,_Alloc >* __radd__(const basic_string& v) { + std::basic_string< _CharT,_Traits,_Alloc >* res = new std::basic_string< _CharT,_Traits,_Alloc >(v); *res += *self; return res; } - std::basic_string<_CharT,_Traits,_Alloc > __str__() { + std::basic_string< _CharT,_Traits,_Alloc > __str__() { return *self; }
diff --git a/share/swig/2.0.11/std/std_carray.swg b/share/swig/3.0.12/std/std_carray.swg similarity index 100% rename from share/swig/2.0.11/std/std_carray.swg rename to share/swig/3.0.12/std/std_carray.swg
diff --git a/share/swig/2.0.11/std/std_char_traits.i b/share/swig/3.0.12/std/std_char_traits.i similarity index 100% rename from share/swig/2.0.11/std/std_char_traits.i rename to share/swig/3.0.12/std/std_char_traits.i
diff --git a/share/swig/2.0.11/std/std_common.i b/share/swig/3.0.12/std/std_common.i similarity index 84% rename from share/swig/2.0.11/std/std_common.i rename to share/swig/3.0.12/std/std_common.i index 7c52880..05bc432 100644 --- a/share/swig/2.0.11/std/std_common.i +++ b/share/swig/3.0.12/std/std_common.i
@@ -23,11 +23,9 @@ // Common code for supporting the C++ std namespace // -%{ -#include <string> -#include <stdexcept> -#include <stddef.h> -%} +%fragment("<string>"); +%fragment("<stdexcept>"); +%fragment("<stddef.h>"); %fragment("StdIteratorTraits","header",fragment="<stddef.h>") %{ @@ -73,8 +71,8 @@ #endif %} -%fragment("StdTraitsCommon","header") %{ -namespace swig { +%fragment("StdTraitsCommon","header",fragment="<string>") %{ +namespace swig { template <class Type> struct noconst_traits { typedef Type noconst_type; @@ -88,7 +86,7 @@ /* type categories */ - struct pointer_category { }; + struct pointer_category { }; struct value_category { }; /* @@ -101,12 +99,25 @@ return traits<typename noconst_traits<Type >::noconst_type >::type_name(); } - template <class Type> - struct traits_info { + template <class Type> struct traits_info { static swig_type_info *type_query(std::string name) { name += " *"; return SWIG_TypeQuery(name.c_str()); - } + } + static swig_type_info *type_info() { + static swig_type_info *info = type_query(type_name<Type>()); + return info; + } + }; + + /* + Partial specialization for pointers (traits_info) + */ + template <class Type> struct traits_info<Type *> { + static swig_type_info *type_query(std::string name) { + name += " *"; + return SWIG_TypeQuery(name.c_str()); + } static swig_type_info *type_info() { static swig_type_info *info = type_query(type_name<Type>()); return info; @@ -119,7 +130,7 @@ } /* - Partial specialization for pointers + Partial specialization for pointers (traits) */ template <class Type> struct traits <Type *> { typedef pointer_category category; @@ -127,22 +138,22 @@ std::string ptrname = name; ptrname += " *"; return ptrname; - } + } static const char* type_name() { static std::string name = make_ptr_name(swig::type_name<Type>()); return name.c_str(); } }; - template <class Type, class Category> + template <class Type, class Category> struct traits_as { }; - - template <class Type, class Category> + + template <class Type, class Category> struct traits_check { }; } %} - + /* Generate the traits for a swigtype */ @@ -150,7 +161,7 @@ %define %traits_swigtype(Type...) %fragment(SWIG_Traits_frag(Type),"header",fragment="StdTraits") { namespace swig { - template <> struct traits<Type > { + template <> struct traits< Type > { typedef pointer_category category; static const char* type_name() { return #Type; } }; @@ -166,7 +177,7 @@ %define %typemap_traits(Code,Type...) %typemaps_asvalfrom(%arg(Code), - %arg(swig::asval<Type >), + %arg(swig::asval< Type >), %arg(swig::from), %arg(SWIG_Traits_frag(Type)), %arg(SWIG_Traits_frag(Type)), @@ -196,10 +207,10 @@ bool operator == (const Type& v) { return *self == v; } - + bool operator != (const Type& v) { return *self != v; - } + } } %enddef @@ -213,7 +224,7 @@ bool operator > (const Type& v) { return *self > v; } - + bool operator < (const Type& v) { return *self < v; }
diff --git a/share/swig/3.0.12/std/std_container.i b/share/swig/3.0.12/std/std_container.i new file mode 100644 index 0000000..000163f --- /dev/null +++ b/share/swig/3.0.12/std/std_container.i
@@ -0,0 +1,169 @@ +%include <std_common.i> +%include <exception.i> +%include <std_alloc.i> + +%{ +#include <algorithm> +%} + +// Common non-resizable container methods + +%define %std_container_methods_non_resizable(container...) + + container(); + container(const container&); + + bool empty() const; + size_type size() const; + void swap(container& v); + +%enddef + +%define %std_container_methods_forward_iterators(container...) + + #ifdef SWIG_EXPORT_ITERATOR_METHODS + class iterator; + class const_iterator; + iterator begin(); + iterator end(); + #endif + +%enddef + +%define %std_container_methods_reverse_iterators(container...) + + #ifdef SWIG_EXPORT_ITERATOR_METHODS + class reverse_iterator; + class const_reverse_iterator; + reverse_iterator rbegin(); + reverse_iterator rend(); + #endif + +%enddef + +// Common container methods + +%define %std_container_methods(container...) + + %std_container_methods_non_resizable(%arg(container)) + %std_container_methods_forward_iterators(%arg(container)) + %std_container_methods_reverse_iterators(%arg(container)) + + void clear(); + allocator_type get_allocator() const; + +%enddef + +%define %std_container_methods_without_reverse_iterators(container...) + + %std_container_methods_non_resizable(%arg(container)) + %std_container_methods_forward_iterators(%arg(container)) + + void clear(); + allocator_type get_allocator() const; + +%enddef + +// Common sequence + +%define %std_sequence_methods_common(sequence) + + %std_container_methods(%arg(sequence)); + + sequence(size_type size); + void pop_back(); + + void resize(size_type new_size); + + #ifdef SWIG_EXPORT_ITERATOR_METHODS +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator erase(iterator pos) { return $self->erase(pos); } + iterator erase(iterator first, iterator last) { return $self->erase(first, last); } +} + #endif + +%enddef + +%define %std_sequence_methods_non_resizable(sequence) + + %std_container_methods_non_resizable(%arg(sequence)) + %std_container_methods_forward_iterators(%arg(container)) + %std_container_methods_reverse_iterators(%arg(container)) + + const value_type& front() const; + const value_type& back() const; + +%enddef + +%define %std_sequence_methods(sequence) + + %std_sequence_methods_common(%arg(sequence)); + + sequence(size_type size, const value_type& value); + void push_back(const value_type& x); + + const value_type& front() const; + const value_type& back() const; + + void assign(size_type n, const value_type& x); + void resize(size_type new_size, const value_type& x); + + #ifdef SWIG_EXPORT_ITERATOR_METHODS +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator insert(iterator pos, const value_type& x) { return $self->insert(pos, x); } + void insert(iterator pos, size_type n, const value_type& x) { $self->insert(pos, n, x); } +} + #endif + +%enddef + +%define %std_sequence_methods_non_resizable_val(sequence...) + + %std_container_methods_non_resizable(%arg(sequence)) + %std_container_methods_forward_iterators(%arg(container)) + %std_container_methods_reverse_iterators(%arg(container)) + + value_type front() const; + value_type back() const; + +#endif + +%enddef + +%define %std_sequence_methods_val(sequence...) + + %std_sequence_methods_common(%arg(sequence)); + + sequence(size_type size, value_type value); + void push_back(value_type x); + + value_type front() const; + value_type back() const; + + void assign(size_type n, value_type x); + void resize(size_type new_size, value_type x); + + #ifdef SWIG_EXPORT_ITERATOR_METHODS +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + iterator insert(iterator pos, value_type x) { return $self->insert(pos, x); } + void insert(iterator pos, size_type n, value_type x) { $self->insert(pos, n, x); } +} + #endif + +%enddef + + +// +// Ignore member methods for Type with no default constructor +// +%define %std_nodefconst_type(Type...) +%feature("ignore") std::vector< Type >::vector(size_type size); +%feature("ignore") std::vector< Type >::resize(size_type size); +%feature("ignore") std::deque< Type >::deque(size_type size); +%feature("ignore") std::deque< Type >::resize(size_type size); +%feature("ignore") std::list< Type >::list(size_type size); +%feature("ignore") std::list< Type >::resize(size_type size); +%enddef
diff --git a/share/swig/2.0.11/std/std_deque.i b/share/swig/3.0.12/std/std_deque.i similarity index 81% rename from share/swig/2.0.11/std/std_deque.i rename to share/swig/3.0.12/std/std_deque.i index a99763b..aa5536b 100644 --- a/share/swig/2.0.11/std/std_deque.i +++ b/share/swig/3.0.12/std/std_deque.i
@@ -49,7 +49,7 @@ namespace std { - template<class _Tp, class _Alloc = allocator<_Tp> > + template<class _Tp, class _Alloc = allocator< _Tp > > class deque { public: typedef size_t size_type; @@ -63,11 +63,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::deque<_Tp, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::deque< _Tp, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdDequeTraits") { namespace swig { - template <> struct traits<std::deque<_Tp, _Alloc > > { + template <> struct traits<std::deque< _Tp, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::deque<" #_Tp " >"; @@ -76,18 +76,18 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque<_Tp, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque< _Tp, _Alloc >); #ifdef %swig_deque_methods // Add swig/language extra methods - %swig_deque_methods(std::deque<_Tp, _Alloc >); + %swig_deque_methods(std::deque< _Tp, _Alloc >); #endif %std_deque_methods(deque); }; template<class _Tp, class _Alloc > - class deque<_Tp*, _Alloc > { + class deque< _Tp*, _Alloc > { public: typedef size_t size_type; typedef ptrdiff_t difference_type; @@ -100,11 +100,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::deque<_Tp*, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::deque< _Tp*, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdDequeTraits") { namespace swig { - template <> struct traits<std::deque<_Tp*, _Alloc > > { + template <> struct traits<std::deque< _Tp*, _Alloc > > { typedef value_category category; static const char* type_name() { return "std::deque<" #_Tp " * >"; @@ -113,14 +113,14 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque<_Tp*, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_DEQUE, std::deque< _Tp*, _Alloc >); #ifdef %swig_deque_methods_val // Add swig/language extra methods - %swig_deque_methods_val(std::deque<_Tp*, _Alloc >); + %swig_deque_methods_val(std::deque< _Tp*, _Alloc >); #endif - %std_deque_methods_val(std::deque<_Tp*, _Alloc >); + %std_deque_methods_val(deque); }; }
diff --git a/share/swig/2.0.11/std/std_except.i b/share/swig/3.0.12/std/std_except.i similarity index 94% rename from share/swig/2.0.11/std/std_except.i rename to share/swig/3.0.12/std/std_except.i index 75b8d0f..728b9c8 100644 --- a/share/swig/2.0.11/std/std_except.i +++ b/share/swig/3.0.12/std/std_except.i
@@ -3,6 +3,7 @@ #endif %{ +#include <typeinfo> #include <stdexcept> %} @@ -15,6 +16,10 @@ virtual const char* what() const throw(); }; + struct bad_cast : exception + { + }; + struct bad_exception : exception { };
diff --git a/share/swig/2.0.11/std/std_ios.i b/share/swig/3.0.12/std/std_ios.i similarity index 96% rename from share/swig/2.0.11/std/std_ios.i rename to share/swig/3.0.12/std/std_ios.i index 75484f3..db83c7a 100644 --- a/share/swig/2.0.11/std/std_ios.i +++ b/share/swig/3.0.12/std/std_ios.i
@@ -242,17 +242,19 @@ // 27.4.5.1 basic_ios constructors basic_ios(); private: - ios_base(const ios_base&); + basic_ios(const basic_ios&); - ios_base& - operator=(const ios_base&); + basic_ios& + operator=(const basic_ios&); }; } namespace std { + typedef basic_ios<char> ios; %template(ios) basic_ios<char>; #if defined(SWIG_WCHAR) + typedef basic_ios<wchar_t> wios; %template(wios) basic_ios<wchar_t>; #endif }
diff --git a/share/swig/2.0.11/std/std_iostream.i b/share/swig/3.0.12/std/std_iostream.i similarity index 100% rename from share/swig/2.0.11/std/std_iostream.i rename to share/swig/3.0.12/std/std_iostream.i
diff --git a/share/swig/2.0.11/std/std_list.i b/share/swig/3.0.12/std/std_list.i similarity index 80% rename from share/swig/2.0.11/std/std_list.i rename to share/swig/3.0.12/std/std_list.i index e089351..ebbafa2 100644 --- a/share/swig/2.0.11/std/std_list.i +++ b/share/swig/3.0.12/std/std_list.i
@@ -6,7 +6,7 @@ // List -%define %std_list_methods(list) +%define %std_list_methods(list...) %std_sequence_methods(list) void pop_front(); @@ -17,7 +17,7 @@ %enddef -%define %std_list_methods_val(list) +%define %std_list_methods_val(list...) %std_sequence_methods_val(list) void pop_front(); @@ -61,7 +61,7 @@ namespace std { - template<class _Tp, class _Alloc = allocator<_Tp> > + template<class _Tp, class _Alloc = allocator< _Tp > > class list { public: typedef size_t size_type; @@ -75,11 +75,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::list<_Tp, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::list< _Tp, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdListTraits") { namespace swig { - template <> struct traits<std::list<_Tp, _Alloc > > { + template <> struct traits<std::list< _Tp, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::list<" #_Tp ", " #_Alloc " >"; @@ -88,18 +88,18 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list<_Tp, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list< _Tp, _Alloc >); #ifdef %swig_list_methods // Add swig/language extra methods - %swig_list_methods(std::list<_Tp, _Alloc >); + %swig_list_methods(std::list< _Tp, _Alloc >); #endif %std_list_methods(list); }; template<class _Tp, class _Alloc > - class list<_Tp*, _Alloc> { + class list< _Tp*, _Alloc> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; @@ -112,11 +112,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::list<_Tp*, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::list< _Tp*, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdListTraits") { namespace swig { - template <> struct traits<std::list<_Tp*, _Alloc > > { + template <> struct traits<std::list< _Tp*, _Alloc > > { typedef value_category category; static const char* type_name() { return "std::list<" #_Tp " *," #_Alloc " >"; @@ -125,11 +125,11 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list<_Tp*, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_LIST, std::list< _Tp*, _Alloc >); #ifdef %swig_list_methods_val // Add swig/language extra methods - %swig_list_methods_val(std::list<_Tp*, _Alloc >); + %swig_list_methods_val(std::list< _Tp*, _Alloc >); #endif %std_list_methods_val(list); @@ -138,9 +138,9 @@ } %define %std_extequal_list(...) -%extend std::list<__VA_ARGS__ > { +%extend std::list< __VA_ARGS__ > { void remove(const value_type& x) { self->remove(x); } - void merge(std::list<__VA_ARGS__ >& x){ self->merge(x); } + void merge(std::list< __VA_ARGS__ >& x){ self->merge(x); } void unique() { self->unique(); } void sort() { self->sort(); } }
diff --git a/share/swig/2.0.11/std/std_map.i b/share/swig/3.0.12/std/std_map.i similarity index 79% rename from share/swig/2.0.11/std/std_map.i rename to share/swig/3.0.12/std/std_map.i index 0520841..8043f92 100644 --- a/share/swig/2.0.11/std/std_map.i +++ b/share/swig/3.0.12/std/std_map.i
@@ -12,9 +12,11 @@ size_type count(const key_type& x) const; #ifdef SWIG_EXPORT_ITERATOR_METHODS -// iterator insert(iterator position, const value_type& x); - void erase(iterator position); - void erase(iterator first, iterator last); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator position) { $self->erase(position); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} iterator find(const key_type& x); iterator lower_bound(const key_type& x); @@ -55,23 +57,23 @@ %{ #include <map> -#include <algorithm> -#include <stdexcept> %} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); // exported class namespace std { template<class _Key, class _Tp, class _Compare = std::less<_Key >, - class _Alloc = allocator<std::pair<const _Key, _Tp > > > + class _Alloc = allocator<std::pair< const _Key, _Tp > > > class map { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Key key_type; typedef _Tp mapped_type; - typedef std::pair<const _Key, _Tp> value_type; + typedef std::pair< const _Key, _Tp > value_type; typedef value_type* pointer; typedef const value_type* const_pointer; @@ -96,11 +98,11 @@ } } - %fragment(SWIG_Traits_frag(std::map<_Key, _Tp, _Compare, _Alloc >), "header", - fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >), + %fragment(SWIG_Traits_frag(std::map< _Key, _Tp, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >), fragment="StdMapTraits") { namespace swig { - template <> struct traits<std::map<_Key, _Tp, _Compare, _Alloc > > { + template <> struct traits<std::map< _Key, _Tp, _Compare, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::map<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >"; @@ -109,13 +111,13 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map<_Key, _Tp, _Compare, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::map< _Key, _Tp, _Compare, _Alloc >); map( const _Compare& ); #ifdef %swig_map_methods // Add swig/language extra methods - %swig_map_methods(std::map<_Key, _Tp, _Compare, _Alloc >); + %swig_map_methods(std::map< _Key, _Tp, _Compare, _Alloc >); #endif %std_map_methods(map);
diff --git a/share/swig/2.0.11/std/std_multimap.i b/share/swig/3.0.12/std/std_multimap.i similarity index 81% rename from share/swig/2.0.11/std/std_multimap.i rename to share/swig/3.0.12/std/std_multimap.i index 5a2cf38..7aa9499 100644 --- a/share/swig/2.0.11/std/std_multimap.i +++ b/share/swig/3.0.12/std/std_multimap.i
@@ -1,5 +1,5 @@ // -// std::map +// std::multimap // %include <std_map.i> @@ -41,15 +41,15 @@ namespace std { - template<class _Key, class _Tp, class _Compare = std::less<_Key >, - class _Alloc = allocator<std::pair<const _Key, _Tp > > > + template<class _Key, class _Tp, class _Compare = std::less< _Key >, + class _Alloc = allocator<std::pair< const _Key, _Tp > > > class multimap { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Key key_type; typedef _Tp mapped_type; - typedef std::pair<const _Key, _Tp> value_type; + typedef std::pair< const _Key, _Tp > value_type; typedef value_type* pointer; typedef const value_type* const_pointer; @@ -74,11 +74,11 @@ } } - %fragment(SWIG_Traits_frag(std::multimap<_Key, _Tp, _Compare, _Alloc >), "header", - fragment=SWIG_Traits_frag(std::pair<_Key, _Tp >), + %fragment(SWIG_Traits_frag(std::multimap< _Key, _Tp, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >), fragment="StdMultimapTraits") { namespace swig { - template <> struct traits<std::multimap<_Key, _Tp, _Compare, _Alloc > > { + template <> struct traits<std::multimap< _Key, _Tp, _Compare, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::multimap<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >"; @@ -87,13 +87,13 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap<_Key, _Tp, _Compare, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::multimap< _Key, _Tp, _Compare, _Alloc >); multimap( const _Compare& ); #ifdef %swig_multimap_methods // Add swig/language extra methods - %swig_multimap_methods(std::multimap<_Key, _Tp, _Compare, _Alloc >); + %swig_multimap_methods(std::multimap< _Key, _Tp, _Compare, _Alloc >); #endif %std_multimap_methods(multimap);
diff --git a/share/swig/2.0.11/std/std_multiset.i b/share/swig/3.0.12/std/std_multiset.i similarity index 82% rename from share/swig/2.0.11/std/std_multiset.i rename to share/swig/3.0.12/std/std_multiset.i index 98a7fb9..1aa7ccc 100644 --- a/share/swig/2.0.11/std/std_multiset.i +++ b/share/swig/3.0.12/std/std_multiset.i
@@ -1,5 +1,5 @@ // -// std::set +// std::multiset // %include <std_set.i> @@ -40,8 +40,8 @@ //multiset - template <class _Key, class _Compare = std::less<_Key>, - class _Alloc = allocator<_Key> > + template <class _Key, class _Compare = std::less< _Key >, + class _Alloc = allocator< _Key > > class multiset { public: typedef size_t size_type; @@ -56,11 +56,11 @@ %traits_swigtype(_Key); - %fragment(SWIG_Traits_frag(std::multiset<_Key, _Compare, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::multiset< _Key, _Compare, _Alloc >), "header", fragment=SWIG_Traits_frag(_Key), fragment="StdMultisetTraits") { namespace swig { - template <> struct traits<std::multiset<_Key, _Compare, _Alloc > > { + template <> struct traits<std::multiset< _Key, _Compare, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::multiset<" #_Key "," #_Compare "," #_Alloc " >"; @@ -69,13 +69,13 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::multiset<_Key, _Compare, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::multiset< _Key, _Compare, _Alloc >); multiset( const _Compare& ); #ifdef %swig_multiset_methods // Add swig/language extra methods - %swig_multiset_methods(std::multiset<_Key, _Compare, _Alloc >); + %swig_multiset_methods(std::multiset< _Key, _Compare, _Alloc >); #endif %std_multiset_methods(multiset);
diff --git a/share/swig/2.0.11/std/std_pair.i b/share/swig/3.0.12/std/std_pair.i similarity index 68% rename from share/swig/2.0.11/std/std_pair.i rename to share/swig/3.0.12/std/std_pair.i index 2743430..001cd67 100644 --- a/share/swig/2.0.11/std/std_pair.i +++ b/share/swig/3.0.12/std/std_pair.i
@@ -13,12 +13,12 @@ %traits_swigtype(T); %traits_swigtype(U); - %fragment(SWIG_Traits_frag(std::pair<T,U >), "header", + %fragment(SWIG_Traits_frag(std::pair< T, U >), "header", fragment=SWIG_Traits_frag(T), fragment=SWIG_Traits_frag(U), fragment="StdPairTraits") { namespace swig { - template <> struct traits<std::pair<T,U > > { + template <> struct traits<std::pair< T, U > > { typedef pointer_category category; static const char* type_name() { return "std::pair<" #T "," #U " >"; @@ -28,23 +28,23 @@ } #ifndef SWIG_STD_PAIR_ASVAL - %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U >); + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair< T, U >); #else - %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T,U >); + %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair< T, U >); #endif pair(); pair(T first, U second); pair(const pair& p); - template <class U1, class U2> pair(const pair<U1, U2> &p); + template <class U1, class U2> pair(const pair< U1, U2 > &p); T first; U second; #ifdef %swig_pair_methods // Add swig/language extra methods - %swig_pair_methods(std::pair<T,U >) + %swig_pair_methods(std::pair< T, U >) #endif }; @@ -52,19 +52,19 @@ // The following specializations should disappear or get // simplified when a 'const SWIGTYPE*&' can be defined // *** - template <class T, class U > struct pair<T, U*> { + template <class T, class U > struct pair< T, U* > { typedef T first_type; typedef U* second_type; %traits_swigtype(T); %traits_swigtype(U); - %fragment(SWIG_Traits_frag(std::pair<T,U* >), "header", + %fragment(SWIG_Traits_frag(std::pair< T, U* >), "header", fragment=SWIG_Traits_frag(T), fragment=SWIG_Traits_frag(U), fragment="StdPairTraits") { namespace swig { - template <> struct traits<std::pair<T,U* > > { + template <> struct traits<std::pair< T, U* > > { typedef pointer_category category; static const char* type_name() { return "std::pair<" #T "," #U " * >"; @@ -73,7 +73,7 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T,U* >); + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair< T, U* >); pair(); pair(T __a, U* __b); @@ -84,23 +84,23 @@ #ifdef %swig_pair_methods // Add swig/language extra methods - %swig_pair_methods(std::pair<T,U*>) + %swig_pair_methods(std::pair< T, U* >) #endif }; - template <class T, class U > struct pair<T*, U> { + template <class T, class U > struct pair< T*, U > { typedef T* first_type; typedef U second_type; %traits_swigtype(T); %traits_swigtype(U); - %fragment(SWIG_Traits_frag(std::pair<T*,U >), "header", + %fragment(SWIG_Traits_frag(std::pair< T*, U >), "header", fragment=SWIG_Traits_frag(T), fragment=SWIG_Traits_frag(U), fragment="StdPairTraits") { namespace swig { - template <> struct traits<std::pair<T*,U > > { + template <> struct traits<std::pair< T*, U > > { typedef pointer_category category; static const char* type_name() { return "std::pair<" #T " *," #U " >"; @@ -109,7 +109,7 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair<T*,U >); + %typemap_traits_ptr(SWIG_TYPECHECK_PAIR, std::pair< T*, U >); pair(); pair(T* __a, U __b); @@ -120,23 +120,23 @@ #ifdef %swig_pair_methods // Add swig/language extra methods - %swig_pair_methods(std::pair<T*,U >) + %swig_pair_methods(std::pair< T*, U >) #endif }; - template <class T, class U > struct pair<T*, U*> { + template <class T, class U > struct pair< T*, U* > { typedef T* first_type; typedef U* second_type; %traits_swigtype(T); %traits_swigtype(U); - %fragment(SWIG_Traits_frag(std::pair<T*,U* >), "header", + %fragment(SWIG_Traits_frag(std::pair< T*, U* >), "header", fragment=SWIG_Traits_frag(T), fragment=SWIG_Traits_frag(U), fragment="StdPairTraits") { namespace swig { - template <> struct traits<std::pair<T*,U* > > { + template <> struct traits<std::pair< T*, U* > > { typedef pointer_category category; static const char* type_name() { return "std::pair<" #T " *," #U " * >"; @@ -145,7 +145,7 @@ } } - %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair<T*,U* >); + %typemap_traits(SWIG_TYPECHECK_PAIR, std::pair< T*, U* >); pair(); pair(T* __a, U* __b); @@ -156,7 +156,7 @@ #ifdef %swig_pair_methods // Add swig/language extra methods - %swig_pair_methods(std::pair<T*,U*>) + %swig_pair_methods(std::pair< T*, U* >) #endif };
diff --git a/share/swig/2.0.11/std/std_queue.i b/share/swig/3.0.12/std/std_queue.i similarity index 81% rename from share/swig/2.0.11/std/std_queue.i rename to share/swig/3.0.12/std/std_queue.i index 42273ee..b2c8d8d 100644 --- a/share/swig/2.0.11/std/std_queue.i +++ b/share/swig/3.0.12/std/std_queue.i
@@ -57,7 +57,7 @@ namespace std { - template<class _Tp, class _Sequence = std::deque<_Tp> > + template<class _Tp, class _Sequence = std::deque< _Tp > > class queue { public: typedef size_t size_type; @@ -68,11 +68,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::queue<_Tp, _Sequence >), "header", + %fragment(SWIG_Traits_frag(std::queue< _Tp, _Sequence >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdQueueTraits") { namespace swig { - template <> struct traits<std::queue<_Tp, _Sequence > > { + template <> struct traits<std::queue< _Tp, _Sequence > > { typedef pointer_category category; static const char* type_name() { return "std::queue<" #_Tp "," #_Sequence " >"; @@ -81,18 +81,18 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp, _Sequence >); + %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue< _Tp, _Sequence >); #ifdef %swig_queue_methods // Add swig/language extra methods - %swig_queue_methods(std::queue<_Tp, _Sequence >); + %swig_queue_methods(std::queue< _Tp, _Sequence >); #endif %std_queue_methods(queue); }; template<class _Tp, class _Sequence > - class queue<_Tp*, _Sequence > { + class queue< _Tp*, _Sequence > { public: typedef size_t size_type; typedef _Tp value_type; @@ -102,11 +102,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::queue<_Tp*, _Sequence >), "header", + %fragment(SWIG_Traits_frag(std::queue< _Tp*, _Sequence >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdQueueTraits") { namespace swig { - template <> struct traits<std::queue<_Tp*, _Sequence > > { + template <> struct traits<std::queue< _Tp*, _Sequence > > { typedef value_category category; static const char* type_name() { return "std::queue<" #_Tp "," #_Sequence " * >"; @@ -115,14 +115,14 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue<_Tp*, _Sequence >); + %typemap_traits_ptr(SWIG_TYPECHECK_QUEUE, std::queue< _Tp*, _Sequence >); #ifdef %swig_queue_methods_val // Add swig/language extra methods - %swig_queue_methods_val(std::queue<_Tp*, _Sequence >); + %swig_queue_methods_val(std::queue< _Tp*, _Sequence >); #endif - %std_queue_methods_val(std::queue<_Tp*, _Sequence >); + %std_queue_methods_val(queue); }; }
diff --git a/share/swig/2.0.11/std/std_set.i b/share/swig/3.0.12/std/std_set.i similarity index 81% rename from share/swig/2.0.11/std/std_set.i rename to share/swig/3.0.12/std/std_set.i index 16f0f14..107a23c 100644 --- a/share/swig/2.0.11/std/std_set.i +++ b/share/swig/3.0.12/std/std_set.i
@@ -29,8 +29,11 @@ reverse_iterator rbegin(); reverse_iterator rend(); - void erase(iterator pos); - void erase(iterator first, iterator last); +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator pos) { $self->erase(pos); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} iterator find(const key_type& x); iterator lower_bound(const key_type& x); @@ -76,8 +79,8 @@ namespace std { - template <class _Key, class _Compare = std::less<_Key>, - class _Alloc = allocator<_Key> > + template <class _Key, class _Compare = std::less< _Key >, + class _Alloc = allocator< _Key > > class set { public: typedef size_t size_type; @@ -92,11 +95,11 @@ %traits_swigtype(_Key); - %fragment(SWIG_Traits_frag(std::set<_Key, _Compare, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::set< _Key, _Compare, _Alloc >), "header", fragment=SWIG_Traits_frag(_Key), fragment="StdSetTraits") { namespace swig { - template <> struct traits<std::set<_Key, _Compare, _Alloc > > { + template <> struct traits<std::set< _Key, _Compare, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::set<" #_Key "," #_Compare "," #_Alloc " >"; @@ -105,13 +108,13 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set<_Key, _Compare, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::set< _Key, _Compare, _Alloc >); set( const _Compare& ); #ifdef %swig_set_methods // Add swig/language extra methods - %swig_set_methods(std::set<_Key, _Compare, _Alloc >); + %swig_set_methods(std::set< _Key, _Compare, _Alloc >); #endif %std_set_methods(set);
diff --git a/share/swig/2.0.11/std/std_sstream.i b/share/swig/3.0.12/std/std_sstream.i similarity index 100% rename from share/swig/2.0.11/std/std_sstream.i rename to share/swig/3.0.12/std/std_sstream.i
diff --git a/share/swig/2.0.11/std/std_stack.i b/share/swig/3.0.12/std/std_stack.i similarity index 80% rename from share/swig/2.0.11/std/std_stack.i rename to share/swig/3.0.12/std/std_stack.i index fb900a5..5b624b5 100644 --- a/share/swig/2.0.11/std/std_stack.i +++ b/share/swig/3.0.12/std/std_stack.i
@@ -56,7 +56,7 @@ namespace std { - template<class _Tp, class _Sequence = std::deque<_Tp> > + template<class _Tp, class _Sequence = std::deque< _Tp > > class stack { public: typedef size_t size_type; @@ -67,11 +67,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::stack<_Tp, _Sequence >), "header", + %fragment(SWIG_Traits_frag(std::stack< _Tp, _Sequence >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdStackTraits") { namespace swig { - template <> struct traits<std::stack<_Tp, _Sequence > > { + template <> struct traits<std::stack< _Tp, _Sequence > > { typedef pointer_category category; static const char* type_name() { return "std::stack<" #_Tp "," #_Sequence " >"; @@ -80,18 +80,18 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp, _Sequence >); + %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack< _Tp, _Sequence >); #ifdef %swig_stack_methods // Add swig/language extra methods - %swig_stack_methods(std::stack<_Tp, _Sequence >); + %swig_stack_methods(std::stack< _Tp, _Sequence >); #endif %std_stack_methods(stack); }; template<class _Tp, class _Sequence > - class stack<_Tp*, _Sequence > { + class stack< _Tp*, _Sequence > { public: typedef size_t size_type; typedef _Sequence::value_type value_type; @@ -101,11 +101,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::stack<_Tp*, _Sequence >), "header", + %fragment(SWIG_Traits_frag(std::stack< _Tp*, _Sequence >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdStackTraits") { namespace swig { - template <> struct traits<std::stack<_Tp*, _Sequence > > { + template <> struct traits<std::stack< _Tp*, _Sequence > > { typedef value_category category; static const char* type_name() { return "std::stack<" #_Tp "," #_Sequence " * >"; @@ -114,14 +114,14 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack<_Tp*, _Sequence >); + %typemap_traits_ptr(SWIG_TYPECHECK_STACK, std::stack< _Tp*, _Sequence >); #ifdef %swig_stack_methods_val // Add swig/language extra methods - %swig_stack_methods_val(std::stack<_Tp*, _Sequence >); + %swig_stack_methods_val(std::stack< _Tp*, _Sequence >); #endif - %std_stack_methods_val(std::stack<_Tp*, _Sequence >); + %std_stack_methods_val(stack); }; }
diff --git a/share/swig/2.0.11/std/std_streambuf.i b/share/swig/3.0.12/std/std_streambuf.i similarity index 100% rename from share/swig/2.0.11/std/std_streambuf.i rename to share/swig/3.0.12/std/std_streambuf.i
diff --git a/share/swig/2.0.11/std/std_string.i b/share/swig/3.0.12/std/std_string.i similarity index 100% rename from share/swig/2.0.11/std/std_string.i rename to share/swig/3.0.12/std/std_string.i
diff --git a/share/swig/3.0.12/std/std_unordered_map.i b/share/swig/3.0.12/std/std_unordered_map.i new file mode 100644 index 0000000..1cb7148 --- /dev/null +++ b/share/swig/3.0.12/std/std_unordered_map.i
@@ -0,0 +1,129 @@ +// +// std::unordered_map +// Work in progress - the code is not compilable yet: +// operator--() and constructor(compare function) not available for unordered_ +// types +// + +%include <std_pair.i> +%include <std_container.i> + +%define %std_unordered_map_methods_common(unordered_map...) + %std_container_methods(unordered_map); + + size_type erase(const key_type& x); + size_type count(const key_type& x) const; + +#ifdef SWIG_EXPORT_ITERATOR_METHODS +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator position) { $self->erase(position); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} + + iterator find(const key_type& x); + iterator lower_bound(const key_type& x); + iterator upper_bound(const key_type& x); +#endif +%enddef + +%define %std_unordered_map_methods(unordered_map...) + %std_unordered_map_methods_common(unordered_map); + + #ifdef SWIG_EXPORT_ITERATOR_METHODS +// iterator insert(const value_type& x); + #endif +%enddef + + +// ------------------------------------------------------------------------ +// std::unordered_map +// +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::unordered_map<T>), f(const std::unordered_map<T>&): +// the parameter being read-only, either a sequence or a +// previously wrapped std::unordered_map<T> can be passed. +// -- f(std::unordered_map<T>&), f(std::unordered_map<T>*): +// the parameter may be modified; therefore, only a wrapped std::unordered_map +// can be passed. +// -- std::unordered_map<T> f(), const std::unordered_map<T>& f(): +// the unordered_map is returned by copy; therefore, a sequence of T:s +// is returned which is most easily used in other functions +// -- std::unordered_map<T>& f(), std::unordered_map<T>* f(): +// the unordered_map is returned by reference; therefore, a wrapped std::unordered_map +// is returned +// -- const std::unordered_map<T>* f(), f(const std::unordered_map<T>*): +// for consistency, they expect and return a plain unordered_map pointer. +// ------------------------------------------------------------------------ + +%{ +#include <unordered_map> +%} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); + +// exported class + +namespace std { + + template<class _Key, class _Tp, class _Compare = std::less< _Key >, + class _Alloc = allocator<std::pair< const _Key, _Tp > > > + class unordered_map { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair< const _Key, _Tp > value_type; + + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _Alloc allocator_type; + + %traits_swigtype(_Key); + %traits_swigtype(_Tp); + + %fragment(SWIG_Traits_frag(std::pair< _Key, _Tp >), "header", + fragment=SWIG_Traits_frag(_Key), + fragment=SWIG_Traits_frag(_Tp), + fragment="StdPairTraits") { + namespace swig { + template <> struct traits<std::pair< _Key, _Tp > > { + typedef pointer_category category; + static const char* type_name() { + return "std::pair<" #_Key "," #_Tp " >"; + } + }; + } + } + + %fragment(SWIG_Traits_frag(std::unordered_map< _Key, _Tp, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >), + fragment="StdMapTraits") { + namespace swig { + template <> struct traits<std::unordered_map< _Key, _Tp, _Compare, _Alloc > > { + typedef pointer_category category; + static const char* type_name() { + return "std::unordered_map<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_MAP, std::unordered_map< _Key, _Tp, _Compare, _Alloc >); + + unordered_map( const _Compare& ); + +#ifdef %swig_unordered_map_methods + // Add swig/language extra methods + %swig_unordered_map_methods(std::unordered_map< _Key, _Tp, _Compare, _Alloc >); +#endif + + %std_unordered_map_methods(unordered_map); + }; + +}
diff --git a/share/swig/3.0.12/std/std_unordered_multimap.i b/share/swig/3.0.12/std/std_unordered_multimap.i new file mode 100644 index 0000000..46b56d8 --- /dev/null +++ b/share/swig/3.0.12/std/std_unordered_multimap.i
@@ -0,0 +1,90 @@ +// +// std::unordered_multimap +// Work in progress - the code is not compilable yet: +// operator--() and constructor(compare function) not available for unordered_ +// types +// + +%include <std_unordered_map.i> + + +%define %std_unordered_multimap_methods(mmap...) + %std_map_methods_common(mmap); + +#ifdef SWIG_EXPORT_ITERATOR_METHODS + std::pair<iterator,iterator> equal_range(const key_type& x); + std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const; +#endif +%enddef + +// ------------------------------------------------------------------------ +// std::unordered_multimap +// +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::unordered_multimap<T>), f(const std::unordered_multimap<T>&): +// the parameter being read-only, either a sequence or a +// previously wrapped std::unordered_multimap<T> can be passed. +// -- f(std::unordered_multimap<T>&), f(std::unordered_multimap<T>*): +// the parameter may be modified; therefore, only a wrapped std::unordered_multimap +// can be passed. +// -- std::unordered_multimap<T> f(), const std::unordered_multimap<T>& f(): +// the map is returned by copy; therefore, a sequence of T:s +// is returned which is most easily used in other functions +// -- std::unordered_multimap<T>& f(), std::unordered_multimap<T>* f(): +// the map is returned by reference; therefore, a wrapped std::unordered_multimap +// is returned +// -- const std::unordered_multimap<T>* f(), f(const std::unordered_multimap<T>*): +// for consistency, they expect and return a plain map pointer. +// ------------------------------------------------------------------------ + + +// exported class + + +namespace std { + template<class _Key, class _Tp, class _Compare = std::less< _Key >, + class _Alloc = allocator<std::pair< const _Key, _Tp > > > + class unordered_multimap { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair< const _Key, _Tp > value_type; + + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _Alloc allocator_type; + + %traits_swigtype(_Key); + %traits_swigtype(_Tp); + + %fragment(SWIG_Traits_frag(std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(std::pair< _Key, _Tp >), + fragment="StdMultimapTraits") { + namespace swig { + template <> struct traits<std::unordered_multimap< _Key, _Tp, _Compare, _Alloc > > { + typedef pointer_category category; + static const char* type_name() { + return "std::unordered_multimap<" #_Key "," #_Tp "," #_Compare "," #_Alloc " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_MULTIMAP, std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >); + + unordered_multimap( const _Compare& ); + +#ifdef %swig_unordered_multimap_methods + // Add swig/language extra methods + %swig_unordered_multimap_methods(std::unordered_multimap< _Key, _Tp, _Compare, _Alloc >); +#endif + + %std_unordered_multimap_methods(unordered_multimap); + }; +}
diff --git a/share/swig/3.0.12/std/std_unordered_multiset.i b/share/swig/3.0.12/std/std_unordered_multiset.i new file mode 100644 index 0000000..725ca2f --- /dev/null +++ b/share/swig/3.0.12/std/std_unordered_multiset.i
@@ -0,0 +1,86 @@ +// +// std::unordered_multiset +// Work in progress - the code is not compilable yet: +// operator--() and constructor(compare function) not available for unordered_ +// types +// + +%include <std_unordered_set.i> + +// Unordered Multiset + +%define %std_unordered_multiset_methods(unordered_multiset...) + %std_unordered_set_methods_common(unordered_multiset); +%enddef + + +// ------------------------------------------------------------------------ +// std::unordered_multiset +// +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::unordered_multiset<T>), f(const std::unordered_multiset<T>&): +// the parameter being read-only, either a sequence or a +// previously wrapped std::unordered_multiset<T> can be passed. +// -- f(std::unordered_multiset<T>&), f(std::unordered_multiset<T>*): +// the parameter may be modified; therefore, only a wrapped std::unordered_multiset +// can be passed. +// -- std::unordered_multiset<T> f(), const std::unordered_multiset<T>& f(): +// the set is returned by copy; therefore, a sequence of T:s +// is returned which is most easily used in other functions +// -- std::unordered_multiset<T>& f(), std::unordered_multiset<T>* f(): +// the set is returned by reference; therefore, a wrapped std::unordered_multiset +// is returned +// -- const std::unordered_multiset<T>* f(), f(const std::unordered_multiset<T>*): +// for consistency, they expect and return a plain set pointer. +// ------------------------------------------------------------------------ + + +// exported classes + +namespace std { + + //unordered_multiset + + template <class _Key, class _Compare = std::less< _Key >, + class _Alloc = allocator< _Key > > + class unordered_multiset { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Key value_type; + typedef _Key key_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _Alloc allocator_type; + + %traits_swigtype(_Key); + + %fragment(SWIG_Traits_frag(std::unordered_multiset< _Key, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(_Key), + fragment="StdMultisetTraits") { + namespace swig { + template <> struct traits<std::unordered_multiset< _Key, _Compare, _Alloc > > { + typedef pointer_category category; + static const char* type_name() { + return "std::unordered_multiset<" #_Key "," #_Compare "," #_Alloc " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_MULTISET, std::unordered_multiset< _Key, _Compare, _Alloc >); + + unordered_multiset( const _Compare& ); + +#ifdef %swig_unordered_multiset_methods + // Add swig/language extra methods + %swig_unordered_multiset_methods(std::unordered_multiset< _Key, _Compare, _Alloc >); +#endif + + %std_unordered_multiset_methods(unordered_multiset); + }; +}
diff --git a/share/swig/3.0.12/std/std_unordered_set.i b/share/swig/3.0.12/std/std_unordered_set.i new file mode 100644 index 0000000..98e7920 --- /dev/null +++ b/share/swig/3.0.12/std/std_unordered_set.i
@@ -0,0 +1,122 @@ +// +// std::unordered_set +// Work in progress - the code is not compilable yet: +// operator--() and constructor(compare function) not available for unordered_ +// types +// + +%include <std_container.i> +%include <std_pair.i> + +// Unordered Set +%define %std_unordered_set_methods_common(unordered_set...) + unordered_set(); + unordered_set( const unordered_set& ); + + bool empty() const; + size_type size() const; + void clear(); + + void swap(unordered_set& v); + + + size_type erase(const key_type& x); + size_type count(const key_type& x) const; + +#ifdef SWIG_EXPORT_ITERATOR_METHODS + class iterator; + + iterator begin(); + iterator end(); + +%extend { + // %extend wrapper used for differing definitions of these methods introduced in C++11 + void erase(iterator pos) { $self->erase(pos); } + void erase(iterator first, iterator last) { $self->erase(first, last); } +} + + iterator find(const key_type& x); + std::pair<iterator,iterator> equal_range(const key_type& x); +#endif +%enddef + +%define %std_unordered_set_methods(unordered_set...) + %std_unordered_set_methods_common(unordered_set); +#ifdef SWIG_EXPORT_ITERATOR_METHODS + std::pair<iterator,bool> insert(const value_type& __x); +#endif +%enddef + +// ------------------------------------------------------------------------ +// std::unordered_set +// +// const declarations are used to guess the intent of the function being +// exported; therefore, the following rationale is applied: +// +// -- f(std::unordered_set<T>), f(const std::unordered_set<T>&): +// the parameter being read-only, either a sequence or a +// previously wrapped std::unordered_set<T> can be passed. +// -- f(std::unordered_set<T>&), f(std::unordered_set<T>*): +// the parameter may be modified; therefore, only a wrapped std::unordered_set +// can be passed. +// -- std::unordered_set<T> f(), const std::unordered_set<T>& f(): +// the unordered_set is returned by copy; therefore, a sequence of T:s +// is returned which is most easily used in other functions +// -- std::unordered_set<T>& f(), std::unordered_set<T>* f(): +// the unordered_set is returned by reference; therefore, a wrapped std::unordered_set +// is returned +// -- const std::unordered_set<T>* f(), f(const std::unordered_set<T>*): +// for consistency, they expect and return a plain unordered_set pointer. +// ------------------------------------------------------------------------ + +%{ +#include <unordered_set> +%} + +// exported classes + +namespace std { + + template <class _Key, class _Hash = std::hash< _Key >, + class _Compare = std::equal_to< _Key >, + class _Alloc = allocator< _Key > > + class unordered_set { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Hash hasher; + typedef _Key value_type; + typedef _Key key_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _Alloc allocator_type; + + %traits_swigtype(_Key); + + %fragment(SWIG_Traits_frag(std::unordered_set< _Key, _Hash, _Compare, _Alloc >), "header", + fragment=SWIG_Traits_frag(_Key), + fragment="StdUnorderedSetTraits") { + namespace swig { + template <> struct traits<std::unordered_set< _Key, _Hash, _Compare, _Alloc > > { + typedef pointer_category category; + static const char* type_name() { + return "std::unordered_set<" #_Key "," #_Hash "," #_Compare "," #_Alloc " >"; + } + }; + } + } + + %typemap_traits_ptr(SWIG_TYPECHECK_SET, std::unordered_set< _Key, _Hash, _Compare, _Alloc >); + + unordered_set( const _Compare& ); + +#ifdef %swig_unordered_set_methods + // Add swig/language extra methods + %swig_unordered_set_methods(std::unordered_set< _Key, _Hash, _Compare, _Alloc >); +#endif + + %std_unordered_set_methods(unordered_set); + }; +}
diff --git a/share/swig/2.0.11/std/std_vector.i b/share/swig/3.0.12/std/std_vector.i similarity index 85% rename from share/swig/2.0.11/std/std_vector.i rename to share/swig/3.0.12/std/std_vector.i index baecf85..fae759a 100644 --- a/share/swig/2.0.11/std/std_vector.i +++ b/share/swig/3.0.12/std/std_vector.i
@@ -71,11 +71,11 @@ %traits_swigtype(_Tp); %traits_enum(_Tp); - %fragment(SWIG_Traits_frag(std::vector<_Tp, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::vector< _Tp, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdVectorTraits") { namespace swig { - template <> struct traits<std::vector<_Tp, _Alloc > > { + template <> struct traits<std::vector< _Tp, _Alloc > > { typedef pointer_category category; static const char* type_name() { return "std::vector<" #_Tp "," #_Alloc " >"; @@ -84,11 +84,11 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector< _Tp, _Alloc >); #ifdef %swig_vector_methods // Add swig/language extra methods - %swig_vector_methods(std::vector<_Tp, _Alloc >); + %swig_vector_methods(std::vector< _Tp, _Alloc >); #endif %std_vector_methods(vector); @@ -99,7 +99,7 @@ // a 'const SWIGTYPE*&' can be defined // *** template<class _Tp, class _Alloc > - class vector<_Tp*, _Alloc > { + class vector< _Tp*, _Alloc > { public: typedef size_t size_type; typedef ptrdiff_t difference_type; @@ -112,11 +112,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::vector<_Tp*, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::vector< _Tp*, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdVectorTraits") { namespace swig { - template <> struct traits<std::vector<_Tp*, _Alloc > > { + template <> struct traits<std::vector< _Tp*, _Alloc > > { typedef value_category category; static const char* type_name() { return "std::vector<" #_Tp " *," #_Alloc " >"; @@ -125,11 +125,11 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp*, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector< _Tp*, _Alloc >); #ifdef %swig_vector_methods_val // Add swig/language extra methods - %swig_vector_methods_val(std::vector<_Tp*, _Alloc >); + %swig_vector_methods_val(std::vector< _Tp*, _Alloc >); #endif %std_vector_methods_val(vector); @@ -139,7 +139,7 @@ // const pointer specialization // *** template<class _Tp, class _Alloc > - class vector<_Tp const *, _Alloc > { + class vector< _Tp const *, _Alloc > { public: typedef size_t size_type; typedef ptrdiff_t difference_type; @@ -152,11 +152,11 @@ %traits_swigtype(_Tp); - %fragment(SWIG_Traits_frag(std::vector<_Tp const*, _Alloc >), "header", + %fragment(SWIG_Traits_frag(std::vector< _Tp const*, _Alloc >), "header", fragment=SWIG_Traits_frag(_Tp), fragment="StdVectorTraits") { namespace swig { - template <> struct traits<std::vector<_Tp const*, _Alloc > > { + template <> struct traits<std::vector< _Tp const*, _Alloc > > { typedef value_category category; static const char* type_name() { return "std::vector<" #_Tp " const*," #_Alloc " >"; @@ -165,11 +165,11 @@ } } - %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp const*, _Alloc >); + %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector< _Tp const*, _Alloc >); #ifdef %swig_vector_methods_val // Add swig/language extra methods - %swig_vector_methods_val(std::vector<_Tp const*, _Alloc >); + %swig_vector_methods_val(std::vector< _Tp const*, _Alloc >); #endif %std_vector_methods_val(vector);
diff --git a/share/swig/2.0.11/std/std_vectora.i b/share/swig/3.0.12/std/std_vectora.i similarity index 100% rename from share/swig/2.0.11/std/std_vectora.i rename to share/swig/3.0.12/std/std_vectora.i
diff --git a/share/swig/2.0.11/std/std_wios.i b/share/swig/3.0.12/std/std_wios.i similarity index 100% rename from share/swig/2.0.11/std/std_wios.i rename to share/swig/3.0.12/std/std_wios.i
diff --git a/share/swig/2.0.11/std/std_wiostream.i b/share/swig/3.0.12/std/std_wiostream.i similarity index 100% rename from share/swig/2.0.11/std/std_wiostream.i rename to share/swig/3.0.12/std/std_wiostream.i
diff --git a/share/swig/2.0.11/std/std_wsstream.i b/share/swig/3.0.12/std/std_wsstream.i similarity index 100% rename from share/swig/2.0.11/std/std_wsstream.i rename to share/swig/3.0.12/std/std_wsstream.i
diff --git a/share/swig/2.0.11/std/std_wstreambuf.i b/share/swig/3.0.12/std/std_wstreambuf.i similarity index 100% rename from share/swig/2.0.11/std/std_wstreambuf.i rename to share/swig/3.0.12/std/std_wstreambuf.i
diff --git a/share/swig/2.0.11/std/std_wstring.i b/share/swig/3.0.12/std/std_wstring.i similarity index 100% rename from share/swig/2.0.11/std/std_wstring.i rename to share/swig/3.0.12/std/std_wstring.i
diff --git a/share/swig/2.0.11/std_except.i b/share/swig/3.0.12/std_except.i similarity index 95% rename from share/swig/2.0.11/std_except.i rename to share/swig/3.0.12/std_except.i index a4a7a85..50b5a88 100644 --- a/share/swig/2.0.11/std_except.i +++ b/share/swig/3.0.12/std_except.i
@@ -24,6 +24,7 @@ #endif %{ +#include <typeinfo> #include <stdexcept> %} @@ -40,6 +41,7 @@ %enddef namespace std { + %std_exception_map(bad_cast, SWIG_TypeError); %std_exception_map(bad_exception, SWIG_SystemError); %std_exception_map(domain_error, SWIG_ValueError); %std_exception_map(exception, SWIG_SystemError);
diff --git a/share/swig/2.0.11/stdint.i b/share/swig/3.0.12/stdint.i similarity index 100% rename from share/swig/2.0.11/stdint.i rename to share/swig/3.0.12/stdint.i
diff --git a/share/swig/2.0.11/stl.i b/share/swig/3.0.12/stl.i similarity index 100% rename from share/swig/2.0.11/stl.i rename to share/swig/3.0.12/stl.i
diff --git a/share/swig/2.0.11/swig.swg b/share/swig/3.0.12/swig.swg similarity index 96% rename from share/swig/2.0.11/swig.swg rename to share/swig/3.0.12/swig.swg index 97e7c80..6f48f0d 100644 --- a/share/swig/2.0.11/swig.swg +++ b/share/swig/3.0.12/swig.swg
@@ -9,7 +9,7 @@ * User Directives * ----------------------------------------------------------------------------- */ -/* Deprecated SWIG directives */ +/* Deprecated SWIG-1.1 directives */ #define %disabledoc %warn "104:%disabledoc is deprecated" #define %enabledoc %warn "105:%enabledoc is deprecated" @@ -136,11 +136,16 @@ #define %nocallback %feature("callback","0") #define %clearcallback %feature("callback","") -/* the %nestedworkaround directive */ +/* the %nestedworkaround directive (deprecated) */ #define %nestedworkaround %feature("nestedworkaround") #define %nonestedworkaround %feature("nestedworkaround","0") #define %clearnestedworkaround %feature("nestedworkaround","") +/* the %flatnested directive */ +#define %flatnested %feature("flatnested") +#define %noflatnested %feature("flatnested","0") +#define %clearflatnested %feature("flatnested","") + /* the %fastdispatch directive */ #define %fastdispatch %feature("fastdispatch") #define %nofastdispatch %feature("fastdispatch","0") @@ -258,7 +263,7 @@ %rename("$ignore", %$isenumitem, %$classname="MyClass") ""; - we use the prefix '%$' to avoid clashings with other swig + we use the prefix '%$' to avoid clashes with other swig macros/directives. */ @@ -292,6 +297,7 @@ %define %$ismember "match$ismember"="1" %enddef %define %$isglobal %$not %$ismember %enddef +%define %$isextendmember "match$isextendmember"="1" %enddef %define %$innamespace "match$parentNode$nodeType"="namespace" %enddef %define %$ispublic "match$access"="public" %enddef @@ -302,7 +308,7 @@ %define %$ismemberset "match$memberset"="1" %enddef %define %$classname %$ismember,"match$parentNode$name" %enddef - +%define %$isnested "match$nested"="1" %enddef /* ----------------------------------------------------------------------------- * Include all the warnings labels and macros * ----------------------------------------------------------------------------- */ @@ -310,6 +316,89 @@ %include <swigwarnings.swg> /* ----------------------------------------------------------------------------- + * Overloading support + * ----------------------------------------------------------------------------- */ + +/* + * Function/method overloading support. This is done through typemaps, + * but also involves a precedence level. + */ + +/* Macro for overload resolution */ + +%define %typecheck(_x...) %typemap(typecheck, precedence=_x) %enddef + +/* Macros for precedence levels */ + +%define SWIG_TYPECHECK_POINTER 0 %enddef +%define SWIG_TYPECHECK_ITERATOR 5 %enddef +%define SWIG_TYPECHECK_VOIDPTR 10 %enddef +%define SWIG_TYPECHECK_BOOL 15 %enddef +%define SWIG_TYPECHECK_UINT8 20 %enddef +%define SWIG_TYPECHECK_INT8 25 %enddef +%define SWIG_TYPECHECK_UINT16 30 %enddef +%define SWIG_TYPECHECK_INT16 35 %enddef +%define SWIG_TYPECHECK_UINT32 40 %enddef +%define SWIG_TYPECHECK_INT32 45 %enddef +%define SWIG_TYPECHECK_SIZE 47 %enddef +%define SWIG_TYPECHECK_PTRDIFF 48 %enddef +%define SWIG_TYPECHECK_UINT64 50 %enddef +%define SWIG_TYPECHECK_INT64 55 %enddef +%define SWIG_TYPECHECK_UINT128 60 %enddef +%define SWIG_TYPECHECK_INT128 65 %enddef +%define SWIG_TYPECHECK_INTEGER 70 %enddef +%define SWIG_TYPECHECK_FLOAT 80 %enddef +%define SWIG_TYPECHECK_DOUBLE 90 %enddef +%define SWIG_TYPECHECK_CPLXFLT 95 %enddef +%define SWIG_TYPECHECK_CPLXDBL 100 %enddef +%define SWIG_TYPECHECK_COMPLEX 105 %enddef +%define SWIG_TYPECHECK_UNICHAR 110 %enddef +%define SWIG_TYPECHECK_STDUNISTRING 115 %enddef +%define SWIG_TYPECHECK_UNISTRING 120 %enddef +%define SWIG_TYPECHECK_CHAR 130 %enddef +%define SWIG_TYPECHECK_STDSTRING 135 %enddef +%define SWIG_TYPECHECK_STRING 140 %enddef +%define SWIG_TYPECHECK_PAIR 150 %enddef +%define SWIG_TYPECHECK_STDARRAY 155 %enddef +%define SWIG_TYPECHECK_VECTOR 160 %enddef +%define SWIG_TYPECHECK_DEQUE 170 %enddef +%define SWIG_TYPECHECK_LIST 180 %enddef +%define SWIG_TYPECHECK_SET 190 %enddef +%define SWIG_TYPECHECK_MULTISET 200 %enddef +%define SWIG_TYPECHECK_MAP 210 %enddef +%define SWIG_TYPECHECK_MULTIMAP 220 %enddef +%define SWIG_TYPECHECK_STACK 230 %enddef +%define SWIG_TYPECHECK_QUEUE 240 %enddef + +%define SWIG_TYPECHECK_BOOL_ARRAY 1015 %enddef +%define SWIG_TYPECHECK_INT8_ARRAY 1025 %enddef +%define SWIG_TYPECHECK_INT16_ARRAY 1035 %enddef +%define SWIG_TYPECHECK_INT32_ARRAY 1045 %enddef +%define SWIG_TYPECHECK_INT64_ARRAY 1055 %enddef +%define SWIG_TYPECHECK_INT128_ARRAY 1065 %enddef +%define SWIG_TYPECHECK_FLOAT_ARRAY 1080 %enddef +%define SWIG_TYPECHECK_DOUBLE_ARRAY 1090 %enddef +%define SWIG_TYPECHECK_CHAR_ARRAY 1130 %enddef +%define SWIG_TYPECHECK_STRING_ARRAY 1140 %enddef +%define SWIG_TYPECHECK_OBJECT_ARRAY 1150 %enddef + +%define SWIG_TYPECHECK_BOOL_PTR 2015 %enddef +%define SWIG_TYPECHECK_UINT8_PTR 2020 %enddef +%define SWIG_TYPECHECK_INT8_PTR 2025 %enddef +%define SWIG_TYPECHECK_UINT16_PTR 2030 %enddef +%define SWIG_TYPECHECK_INT16_PTR 2035 %enddef +%define SWIG_TYPECHECK_UINT32_PTR 2040 %enddef +%define SWIG_TYPECHECK_INT32_PTR 2045 %enddef +%define SWIG_TYPECHECK_UINT64_PTR 2050 %enddef +%define SWIG_TYPECHECK_INT64_PTR 2055 %enddef +%define SWIG_TYPECHECK_FLOAT_PTR 2080 %enddef +%define SWIG_TYPECHECK_DOUBLE_PTR 2090 %enddef +%define SWIG_TYPECHECK_CHAR_PTR 2130 %enddef + +%define SWIG_TYPECHECK_SWIGOBJECT 5000 %enddef + + +/* ----------------------------------------------------------------------------- * Default handling of certain overloaded operators * ----------------------------------------------------------------------------- */ @@ -340,6 +429,10 @@ /* Define std namespace */ namespace std { + /* Warn about std::initializer_list usage. The constructor/method where used should probably be ignored. See docs. */ + template<typename T> class initializer_list {}; + %typemap(in, warning=SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG) initializer_list<T> "" + %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) initializer_list<T> "" } #endif @@ -501,89 +594,6 @@ } /* ----------------------------------------------------------------------------- - * Overloading support - * ----------------------------------------------------------------------------- */ - -/* - * Function/method overloading support. This is done through typemaps, - * but also involve a precedence level. - */ - -/* Macro for overload resolution */ - -%define %typecheck(_x...) %typemap(typecheck, precedence=_x) %enddef - -/* Macros for precedence levels */ - -%define SWIG_TYPECHECK_POINTER 0 %enddef -%define SWIG_TYPECHECK_ITERATOR 5 %enddef -%define SWIG_TYPECHECK_VOIDPTR 10 %enddef -%define SWIG_TYPECHECK_BOOL 15 %enddef -%define SWIG_TYPECHECK_UINT8 20 %enddef -%define SWIG_TYPECHECK_INT8 25 %enddef -%define SWIG_TYPECHECK_UINT16 30 %enddef -%define SWIG_TYPECHECK_INT16 35 %enddef -%define SWIG_TYPECHECK_UINT32 40 %enddef -%define SWIG_TYPECHECK_INT32 45 %enddef -%define SWIG_TYPECHECK_SIZE 47 %enddef -%define SWIG_TYPECHECK_PTRDIFF 48 %enddef -%define SWIG_TYPECHECK_UINT64 50 %enddef -%define SWIG_TYPECHECK_INT64 55 %enddef -%define SWIG_TYPECHECK_UINT128 60 %enddef -%define SWIG_TYPECHECK_INT128 65 %enddef -%define SWIG_TYPECHECK_INTEGER 70 %enddef -%define SWIG_TYPECHECK_FLOAT 80 %enddef -%define SWIG_TYPECHECK_DOUBLE 90 %enddef -%define SWIG_TYPECHECK_CPLXFLT 95 %enddef -%define SWIG_TYPECHECK_CPLXDBL 100 %enddef -%define SWIG_TYPECHECK_COMPLEX 105 %enddef -%define SWIG_TYPECHECK_UNICHAR 110 %enddef -%define SWIG_TYPECHECK_STDUNISTRING 115 %enddef -%define SWIG_TYPECHECK_UNISTRING 120 %enddef -%define SWIG_TYPECHECK_CHAR 130 %enddef -%define SWIG_TYPECHECK_STDSTRING 135 %enddef -%define SWIG_TYPECHECK_STRING 140 %enddef -%define SWIG_TYPECHECK_PAIR 150 %enddef -%define SWIG_TYPECHECK_VECTOR 160 %enddef -%define SWIG_TYPECHECK_DEQUE 170 %enddef -%define SWIG_TYPECHECK_LIST 180 %enddef -%define SWIG_TYPECHECK_SET 190 %enddef -%define SWIG_TYPECHECK_MULTISET 200 %enddef -%define SWIG_TYPECHECK_MAP 210 %enddef -%define SWIG_TYPECHECK_MULTIMAP 220 %enddef -%define SWIG_TYPECHECK_STACK 230 %enddef -%define SWIG_TYPECHECK_QUEUE 240 %enddef - -%define SWIG_TYPECHECK_BOOL_ARRAY 1015 %enddef -%define SWIG_TYPECHECK_INT8_ARRAY 1025 %enddef -%define SWIG_TYPECHECK_INT16_ARRAY 1035 %enddef -%define SWIG_TYPECHECK_INT32_ARRAY 1045 %enddef -%define SWIG_TYPECHECK_INT64_ARRAY 1055 %enddef -%define SWIG_TYPECHECK_INT128_ARRAY 1065 %enddef -%define SWIG_TYPECHECK_FLOAT_ARRAY 1080 %enddef -%define SWIG_TYPECHECK_DOUBLE_ARRAY 1090 %enddef -%define SWIG_TYPECHECK_CHAR_ARRAY 1130 %enddef -%define SWIG_TYPECHECK_STRING_ARRAY 1140 %enddef -%define SWIG_TYPECHECK_OBJECT_ARRAY 1150 %enddef - -%define SWIG_TYPECHECK_BOOL_PTR 2015 %enddef -%define SWIG_TYPECHECK_UINT8_PTR 2020 %enddef -%define SWIG_TYPECHECK_INT8_PTR 2025 %enddef -%define SWIG_TYPECHECK_UINT16_PTR 2030 %enddef -%define SWIG_TYPECHECK_INT16_PTR 2035 %enddef -%define SWIG_TYPECHECK_UINT32_PTR 2040 %enddef -%define SWIG_TYPECHECK_INT32_PTR 2045 %enddef -%define SWIG_TYPECHECK_UINT64_PTR 2050 %enddef -%define SWIG_TYPECHECK_INT64_PTR 2055 %enddef -%define SWIG_TYPECHECK_FLOAT_PTR 2080 %enddef -%define SWIG_TYPECHECK_DOUBLE_PTR 2090 %enddef -%define SWIG_TYPECHECK_CHAR_PTR 2130 %enddef - - -%define SWIG_TYPECHECK_SWIGOBJECT 5000 %enddef - - -/* ----------------------------------------------------------------------------- * Runtime code * ----------------------------------------------------------------------------- */
diff --git a/share/swig/2.0.11/swigarch.i b/share/swig/3.0.12/swigarch.i similarity index 95% rename from share/swig/2.0.11/swigarch.i rename to share/swig/3.0.12/swigarch.i index f5aea46..bf4ee8e 100644 --- a/share/swig/2.0.11/swigarch.i +++ b/share/swig/3.0.12/swigarch.i
@@ -42,7 +42,7 @@ #include <limits.h> #endif #if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX) -# error "SWIG wrapped code invalid in 64 bit architecture, regenarete code using -DSWIGWORDSIZE64" +# error "SWIG wrapped code invalid in 64 bit architecture, regenerate code using -DSWIGWORDSIZE64" #endif %} #endif @@ -54,7 +54,7 @@ #include <limits.h> #endif #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX) -# error "SWIG wrapped code invalid in 32 bit architecture, regenarete code using -DSWIGWORDSIZE32" +# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32" #endif %} #endif
diff --git a/share/swig/2.0.11/swigerrors.swg b/share/swig/3.0.12/swigerrors.swg similarity index 100% rename from share/swig/2.0.11/swigerrors.swg rename to share/swig/3.0.12/swigerrors.swg
diff --git a/share/swig/2.0.11/swiginit.swg b/share/swig/3.0.12/swiginit.swg similarity index 95% rename from share/swig/2.0.11/swiginit.swg rename to share/swig/3.0.12/swiginit.swg index f321181..cb72c36 100644 --- a/share/swig/2.0.11/swiginit.swg +++ b/share/swig/3.0.12/swiginit.swg
@@ -11,7 +11,7 @@ * array with the correct data and linking the correct swig_cast_info * structures together. * - * The generated swig_type_info structures are assigned staticly to an initial + * The generated swig_type_info structures are assigned statically to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the @@ -55,7 +55,7 @@ SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found, init; + int init; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { @@ -74,22 +74,18 @@ /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; iter=module_head; do { if (iter==&swig_module) { - found=1; - break; + /* Our module is already in the list, so there's nothing more to do. */ + return; } iter=iter->next; } while (iter!= module_head); - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; }
diff --git a/share/swig/2.0.11/swiglabels.swg b/share/swig/3.0.12/swiglabels.swg similarity index 80% rename from share/swig/2.0.11/swiglabels.swg rename to share/swig/3.0.12/swiglabels.swg index d428ac3..b385566 100644 --- a/share/swig/2.0.11/swiglabels.swg +++ b/share/swig/3.0.12/swiglabels.swg
@@ -65,9 +65,11 @@ #endif /* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif # endif #endif @@ -106,3 +108,16 @@ # define _SCL_SECURE_NO_DEPRECATE #endif +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif
diff --git a/share/swig/2.0.11/swigrun.i b/share/swig/3.0.12/swigrun.i similarity index 100% rename from share/swig/2.0.11/swigrun.i rename to share/swig/3.0.12/swigrun.i
diff --git a/share/swig/2.0.11/swigrun.swg b/share/swig/3.0.12/swigrun.swg similarity index 96% rename from share/swig/2.0.11/swigrun.swg rename to share/swig/3.0.12/swigrun.swg index 7066e67..1ef6761 100644 --- a/share/swig/2.0.11/swigrun.swg +++ b/share/swig/3.0.12/swigrun.swg
@@ -404,14 +404,14 @@ swig_module_info *iter = start; do { if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; + size_t l = 0; + size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; + size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { - register int compare = strcmp(name, iname); + int compare = strcmp(name, iname); if (compare == 0) { return iter->types[i]; } else if (compare < 0) { @@ -455,7 +455,7 @@ of the str field (the human readable name) */ swig_module_info *iter = start; do { - register size_t i = 0; + size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; @@ -474,10 +474,10 @@ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } @@ -489,22 +489,22 @@ */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); + uu = (unsigned char)((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); + uu = (unsigned char)((d - ('a'-10)) << 4); else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); + uu |= (unsigned char)(d - '0'); else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); + uu |= (unsigned char)(d - ('a'-10)); else return (char *) 0; *u = uu;
diff --git a/share/swig/2.0.11/swigwarn.swg b/share/swig/3.0.12/swigwarn.swg similarity index 93% rename from share/swig/2.0.11/swigwarn.swg rename to share/swig/3.0.12/swigwarn.swg index 9bc8638..1262ce0 100644 --- a/share/swig/2.0.11/swigwarn.swg +++ b/share/swig/3.0.12/swigwarn.swg
@@ -30,6 +30,7 @@ %define SWIGWARN_DEPRECATED_NODEFAULT 123 %enddef %define SWIGWARN_DEPRECATED_TYPEMAP_LANG 124 %enddef %define SWIGWARN_DEPRECATED_INPUT_FILE 125 %enddef +%define SWIGWARN_DEPRECATED_NESTED_WORKAROUND 126 %enddef /* -- Preprocessor -- */ @@ -69,6 +70,11 @@ %define SWIGWARN_PARSE_NAMED_NESTED_CLASS 325 %enddef %define SWIGWARN_PARSE_EXTEND_NAME 326 %enddef +%define SWIGWARN_CPP11_LAMBDA 340 %enddef +%define SWIGWARN_CPP11_ALIAS_DECLARATION 341 %enddef /* redundant now */ +%define SWIGWARN_CPP11_ALIAS_TEMPLATE 342 %enddef /* redundant now */ +%define SWIGWARN_CPP11_VARIADIC_TEMPLATE 343 %enddef + %define SWIGWARN_IGNORE_OPERATOR_NEW 350 %enddef /* new */ %define SWIGWARN_IGNORE_OPERATOR_DELETE 351 %enddef /* delete */ %define SWIGWARN_IGNORE_OPERATOR_PLUS 352 %enddef /* + */ @@ -148,6 +154,8 @@ %define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR 473 %enddef %define SWIGWARN_TYPEMAP_OUT_OPTIMAL_IGNORED 474 %enddef %define SWIGWARN_TYPEMAP_OUT_OPTIMAL_MULTIPLE 475 %enddef +%define SWIGWARN_TYPEMAP_INITIALIZER_LIST 476 %enddef +%define SWIGWARN_TYPEMAP_DIRECTORTHROWS_UNDEF 477 %enddef /* -- Fragments -- */ %define SWIGWARN_FRAGMENT_NOT_FOUND 490 %enddef @@ -183,9 +191,9 @@ /* -- Language module specific warnings (700 - 899) -- */ -%define SWIGWARN_D_TYPEMAP_CTYPE_UNDEF 700 %enddef +%define SWIGWARN_D_TYPEMAP_CTYPE_UNDEF 700 %enddef %define SWIGWARN_D_TYPEMAP_IMTYPE_UNDEF 701 %enddef -%define SWIGWARN_D_TYPEMAP_DTYPE_UNDEF 702 %enddef +%define SWIGWARN_D_TYPEMAP_DTYPE_UNDEF 702 %enddef %define SWIGWARN_D_MULTIPLE_INHERITANCE 703 %enddef %define SWIGWARN_D_TYPEMAP_CLASSMOD_UNDEF 704 %enddef %define SWIGWARN_D_TYPEMAP_DBODY_UNDEF 705 %enddef @@ -200,6 +208,14 @@ /* please leave 700-719 free for D */ +%define SWIGWARN_SCILAB_TRUNCATED_NAME 720 %enddef + +/* please leave 720-739 free for Scilab */ + +%define SWIGWARN_PYTHON_INDENT_MISMATCH 740 %enddef + +/* please leave 740-759 free for Python */ + %define SWIGWARN_RUBY_WRONG_NAME 801 %enddef %define SWIGWARN_RUBY_MULTIPLE_INHERITANCE 802 %enddef @@ -216,6 +232,7 @@ %define SWIGWARN_JAVA_TYPEMAP_JAVAIN_UNDEF 818 %enddef %define SWIGWARN_JAVA_TYPEMAP_JAVADIRECTORIN_UNDEF 819 %enddef %define SWIGWARN_JAVA_TYPEMAP_JAVADIRECTOROUT_UNDEF 820 %enddef +%define SWIGWARN_JAVA_TYPEMAP_INTERFACECODE_UNDEF 821 %enddef %define SWIGWARN_JAVA_COVARIANT_RET 822 %enddef %define SWIGWARN_JAVA_TYPEMAP_JAVACONSTRUCT_UNDEF 823 %enddef %define SWIGWARN_JAVA_TYPEMAP_DIRECTORIN_NODESC 824 %enddef @@ -235,6 +252,7 @@ %define SWIGWARN_CSHARP_TYPEMAP_CSIN_UNDEF 838 %enddef %define SWIGWARN_CSHARP_TYPEMAP_CSDIRECTORIN_UNDEF 839 %enddef %define SWIGWARN_CSHARP_TYPEMAP_CSDIRECTOROUT_UNDEF 840 %enddef +%define SWIGWARN_CSHARP_TYPEMAP_INTERFACECODE_UNDEF 841 %enddef %define SWIGWARN_CSHARP_COVARIANT_RET 842 %enddef %define SWIGWARN_CSHARP_TYPEMAP_CSCONSTRUCT_UNDEF 843 %enddef %define SWIGWARN_CSHARP_EXCODE 844 %enddef
diff --git a/share/swig/2.0.11/swigwarnings.swg b/share/swig/3.0.12/swigwarnings.swg similarity index 98% rename from share/swig/2.0.11/swigwarnings.swg rename to share/swig/3.0.12/swigwarnings.swg index 21498eb..34c98fb 100644 --- a/share/swig/2.0.11/swigwarnings.swg +++ b/share/swig/3.0.12/swigwarnings.swg
@@ -54,6 +54,7 @@ %define SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG "454:Setting a pointer/reference variable may leak memory." %enddef %define SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG "470:Thread/reentrant unsafe wrapping, consider returning by value instead." %enddef %define SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG "473:Returning a pointer or reference in a director method is not recommended." %enddef +%define SWIGWARN_TYPEMAP_INITIALIZER_LIST_MSG "476:Initialization using std::initializer_list." %enddef /* ----------------------------------------------------------------------------- * Operator related warning messages
diff --git a/share/swig/2.0.11/tcl/attribute.i b/share/swig/3.0.12/tcl/attribute.i similarity index 100% rename from share/swig/2.0.11/tcl/attribute.i rename to share/swig/3.0.12/tcl/attribute.i
diff --git a/share/swig/2.0.11/tcl/carrays.i b/share/swig/3.0.12/tcl/carrays.i similarity index 100% rename from share/swig/2.0.11/tcl/carrays.i rename to share/swig/3.0.12/tcl/carrays.i
diff --git a/share/swig/2.0.11/tcl/cdata.i b/share/swig/3.0.12/tcl/cdata.i similarity index 100% rename from share/swig/2.0.11/tcl/cdata.i rename to share/swig/3.0.12/tcl/cdata.i
diff --git a/share/swig/2.0.11/tcl/cmalloc.i b/share/swig/3.0.12/tcl/cmalloc.i similarity index 100% rename from share/swig/2.0.11/tcl/cmalloc.i rename to share/swig/3.0.12/tcl/cmalloc.i
diff --git a/share/swig/2.0.11/tcl/cni.i b/share/swig/3.0.12/tcl/cni.i similarity index 100% rename from share/swig/2.0.11/tcl/cni.i rename to share/swig/3.0.12/tcl/cni.i
diff --git a/share/swig/2.0.11/tcl/cpointer.i b/share/swig/3.0.12/tcl/cpointer.i similarity index 100% rename from share/swig/2.0.11/tcl/cpointer.i rename to share/swig/3.0.12/tcl/cpointer.i
diff --git a/share/swig/2.0.11/tcl/cstring.i b/share/swig/3.0.12/tcl/cstring.i similarity index 100% rename from share/swig/2.0.11/tcl/cstring.i rename to share/swig/3.0.12/tcl/cstring.i
diff --git a/share/swig/2.0.11/tcl/cwstring.i b/share/swig/3.0.12/tcl/cwstring.i similarity index 100% rename from share/swig/2.0.11/tcl/cwstring.i rename to share/swig/3.0.12/tcl/cwstring.i
diff --git a/share/swig/2.0.11/tcl/exception.i b/share/swig/3.0.12/tcl/exception.i similarity index 100% rename from share/swig/2.0.11/tcl/exception.i rename to share/swig/3.0.12/tcl/exception.i
diff --git a/share/swig/2.0.11/tcl/factory.i b/share/swig/3.0.12/tcl/factory.i similarity index 100% rename from share/swig/2.0.11/tcl/factory.i rename to share/swig/3.0.12/tcl/factory.i
diff --git a/share/swig/2.0.11/tcl/jstring.i b/share/swig/3.0.12/tcl/jstring.i similarity index 100% rename from share/swig/2.0.11/tcl/jstring.i rename to share/swig/3.0.12/tcl/jstring.i
diff --git a/share/swig/2.0.11/tcl/std_common.i b/share/swig/3.0.12/tcl/std_common.i similarity index 100% rename from share/swig/2.0.11/tcl/std_common.i rename to share/swig/3.0.12/tcl/std_common.i
diff --git a/share/swig/2.0.11/tcl/std_deque.i b/share/swig/3.0.12/tcl/std_deque.i similarity index 100% rename from share/swig/2.0.11/tcl/std_deque.i rename to share/swig/3.0.12/tcl/std_deque.i
diff --git a/share/swig/2.0.11/tcl/std_except.i b/share/swig/3.0.12/tcl/std_except.i similarity index 100% rename from share/swig/2.0.11/tcl/std_except.i rename to share/swig/3.0.12/tcl/std_except.i
diff --git a/share/swig/2.0.11/tcl/std_map.i b/share/swig/3.0.12/tcl/std_map.i similarity index 96% rename from share/swig/2.0.11/tcl/std_map.i rename to share/swig/3.0.12/tcl/std_map.i index 1b7e769..ade2b0a 100644 --- a/share/swig/2.0.11/tcl/std_map.i +++ b/share/swig/3.0.12/tcl/std_map.i
@@ -1,7 +1,5 @@ // // SWIG typemaps for std::map -// Luigi Ballabio -// Jan. 2003 // // Common implementation @@ -13,9 +11,9 @@ %{ #include <map> -#include <algorithm> -#include <stdexcept> %} +%fragment("<algorithm>"); +%fragment("<stdexcept>"); // exported class
diff --git a/share/swig/2.0.11/tcl/std_pair.i b/share/swig/3.0.12/tcl/std_pair.i similarity index 100% rename from share/swig/2.0.11/tcl/std_pair.i rename to share/swig/3.0.12/tcl/std_pair.i
diff --git a/share/swig/2.0.11/tcl/std_string.i b/share/swig/3.0.12/tcl/std_string.i similarity index 100% rename from share/swig/2.0.11/tcl/std_string.i rename to share/swig/3.0.12/tcl/std_string.i
diff --git a/share/swig/2.0.11/tcl/std_vector.i b/share/swig/3.0.12/tcl/std_vector.i similarity index 99% rename from share/swig/2.0.11/tcl/std_vector.i rename to share/swig/3.0.12/tcl/std_vector.i index de99a36..3fc0fd6 100644 --- a/share/swig/2.0.11/tcl/std_vector.i +++ b/share/swig/3.0.12/tcl/std_vector.i
@@ -28,11 +28,11 @@ // is returned // ------------------------------------------------------------------------ +%fragment("<string>"); +%fragment("<stdexcept>"); +%fragment("<algorithm>"); %{ #include <vector> -#include <algorithm> -#include <stdexcept> -#include <string> Tcl_Obj* SwigString_FromString(const std::string &s) { return Tcl_NewStringObj(s.data(), (int)s.length());
diff --git a/share/swig/2.0.11/tcl/std_wstring.i b/share/swig/3.0.12/tcl/std_wstring.i similarity index 100% rename from share/swig/2.0.11/tcl/std_wstring.i rename to share/swig/3.0.12/tcl/std_wstring.i
diff --git a/share/swig/2.0.11/tcl/stl.i b/share/swig/3.0.12/tcl/stl.i similarity index 100% rename from share/swig/2.0.11/tcl/stl.i rename to share/swig/3.0.12/tcl/stl.i
diff --git a/share/swig/2.0.11/tcl/tcl8.swg b/share/swig/3.0.12/tcl/tcl8.swg similarity index 100% rename from share/swig/2.0.11/tcl/tcl8.swg rename to share/swig/3.0.12/tcl/tcl8.swg
diff --git a/share/swig/2.0.11/tcl/tclapi.swg b/share/swig/3.0.12/tcl/tclapi.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclapi.swg rename to share/swig/3.0.12/tcl/tclapi.swg
diff --git a/share/swig/2.0.11/tcl/tclerrors.swg b/share/swig/3.0.12/tcl/tclerrors.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclerrors.swg rename to share/swig/3.0.12/tcl/tclerrors.swg
diff --git a/share/swig/2.0.11/tcl/tclfragments.swg b/share/swig/3.0.12/tcl/tclfragments.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclfragments.swg rename to share/swig/3.0.12/tcl/tclfragments.swg
diff --git a/share/swig/2.0.11/tcl/tclinit.swg b/share/swig/3.0.12/tcl/tclinit.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclinit.swg rename to share/swig/3.0.12/tcl/tclinit.swg
diff --git a/share/swig/2.0.11/tcl/tclinterp.i b/share/swig/3.0.12/tcl/tclinterp.i similarity index 100% rename from share/swig/2.0.11/tcl/tclinterp.i rename to share/swig/3.0.12/tcl/tclinterp.i
diff --git a/share/swig/2.0.11/tcl/tclkw.swg b/share/swig/3.0.12/tcl/tclkw.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclkw.swg rename to share/swig/3.0.12/tcl/tclkw.swg
diff --git a/share/swig/2.0.11/tcl/tclmacros.swg b/share/swig/3.0.12/tcl/tclmacros.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclmacros.swg rename to share/swig/3.0.12/tcl/tclmacros.swg
diff --git a/share/swig/2.0.11/tcl/tclopers.swg b/share/swig/3.0.12/tcl/tclopers.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclopers.swg rename to share/swig/3.0.12/tcl/tclopers.swg
diff --git a/share/swig/2.0.11/tcl/tclprimtypes.swg b/share/swig/3.0.12/tcl/tclprimtypes.swg similarity index 94% rename from share/swig/2.0.11/tcl/tclprimtypes.swg rename to share/swig/3.0.12/tcl/tclprimtypes.swg index e781798..3b6d04f 100644 --- a/share/swig/2.0.11/tcl/tclprimtypes.swg +++ b/share/swig/3.0.12/tcl/tclprimtypes.swg
@@ -112,8 +112,9 @@ %fragment(SWIG_From_frag(long long),"header", fragment=SWIG_From_frag(long), - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdio.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE Tcl_Obj* SWIG_From_dec(long long)(long long value) { @@ -125,11 +126,13 @@ return Tcl_NewStringObj(temp,-1); } } +%#endif } %fragment(SWIG_AsVal_frag(long long),"header", - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdlib.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(long long)(Tcl_Obj *obj, long long *val) { @@ -160,14 +163,16 @@ } return SWIG_TypeError; } +%#endif } /* unsigned long long */ %fragment(SWIG_From_frag(unsigned long long),"header", fragment=SWIG_From_frag(long long), - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdio.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE Tcl_Obj* SWIG_From_dec(unsigned long long)(unsigned long long value) { @@ -179,12 +184,14 @@ return Tcl_NewStringObj(temp,-1); } } +%#endif } %fragment(SWIG_AsVal_frag(unsigned long long),"header", fragment=SWIG_AsVal_frag(unsigned long), - fragment="<limits.h>", + fragment="SWIG_LongLongAvailable", fragment="<stdlib.h>") { +%#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERN int SWIG_AsVal_dec(unsigned long long)(Tcl_Obj *obj, unsigned long long *val) { @@ -216,6 +223,7 @@ } return SWIG_TypeError; } +%#endif } /* double */
diff --git a/share/swig/2.0.11/tcl/tclresult.i b/share/swig/3.0.12/tcl/tclresult.i similarity index 100% rename from share/swig/2.0.11/tcl/tclresult.i rename to share/swig/3.0.12/tcl/tclresult.i
diff --git a/share/swig/2.0.11/tcl/tclrun.swg b/share/swig/3.0.12/tcl/tclrun.swg similarity index 97% rename from share/swig/2.0.11/tcl/tclrun.swg rename to share/swig/3.0.12/tcl/tclrun.swg index c91a7e5..f671ba2 100644 --- a/share/swig/2.0.11/tcl/tclrun.swg +++ b/share/swig/3.0.12/tcl/tclrun.swg
@@ -67,6 +67,12 @@ #define SWIG_GetConstant SWIG_GetConstantObj #define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj +#if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 5 +#define SWIG_TCL_HASHTABLE_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#else +#define SWIG_TCL_HASHTABLE_INIT {0} +#endif + #include "assert.h" #ifdef __cplusplus @@ -219,15 +225,14 @@ /* Take a pointer and convert it to a string */ SWIGRUNTIME void -SWIG_Tcl_MakePtr(char *c, void *ptr, swig_type_info *ty, int flags) { +SWIG_Tcl_MakePtr(char *c, void *ptr, swig_type_info *ty, int SWIGUNUSEDPARM(flags)) { if (ptr) { *(c++) = '_'; c = SWIG_PackData(c,&ptr,sizeof(void *)); strcpy(c,ty->name); } else { - strcpy(c,(char *)"NULL"); + strcpy(c,"NULL"); } - flags = 0; } /* Create a new pointer object */ @@ -281,14 +286,15 @@ } /* -----------------------------------------------------------------------------* - * Object auxiliars + * Object auxiliaries * -----------------------------------------------------------------------------*/ SWIGRUNTIME void SWIG_Tcl_ObjectDelete(ClientData clientData) { swig_instance *si = (swig_instance *) clientData; - if ((si) && (si->destroy) && (SWIG_Disown(si->thisvalue))) { + if (!si) return; + if (si->destroy && SWIG_Disown(si->thisvalue)) { if (si->classptr->destructor) { (si->classptr->destructor)(si->thisvalue); } @@ -338,7 +344,6 @@ } cls_stack[cls_stack_top] = inst->classptr; cls_stack_bi[cls_stack_top] = -1; - cls = inst->classptr; while (1) { Tcl_HashEntry* hashentry; bi = cls_stack_bi[cls_stack_top];
diff --git a/share/swig/2.0.11/tcl/tclruntime.swg b/share/swig/3.0.12/tcl/tclruntime.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclruntime.swg rename to share/swig/3.0.12/tcl/tclruntime.swg
diff --git a/share/swig/2.0.11/tcl/tclsh.i b/share/swig/3.0.12/tcl/tclsh.i similarity index 100% rename from share/swig/2.0.11/tcl/tclsh.i rename to share/swig/3.0.12/tcl/tclsh.i
diff --git a/share/swig/2.0.11/tcl/tclstrings.swg b/share/swig/3.0.12/tcl/tclstrings.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclstrings.swg rename to share/swig/3.0.12/tcl/tclstrings.swg
diff --git a/share/swig/2.0.11/tcl/tcltypemaps.swg b/share/swig/3.0.12/tcl/tcltypemaps.swg similarity index 96% rename from share/swig/2.0.11/tcl/tcltypemaps.swg rename to share/swig/3.0.12/tcl/tcltypemaps.swg index 2b4e06e..ad31bcf 100644 --- a/share/swig/2.0.11/tcl/tcltypemaps.swg +++ b/share/swig/3.0.12/tcl/tcltypemaps.swg
@@ -66,7 +66,7 @@ #if 1 // Old 1.3.25 typemaps needed to avoid premature object deletion -%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] { +%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE &&INSTANCE, SWIGTYPE INSTANCE[] { Tcl_SetObjResult(interp, SWIG_NewInstanceObj( %as_voidptr($1), $1_descriptor,0)); } @@ -86,5 +86,6 @@ %typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE; %typemap(out) SWIGTYPE *const = SWIGTYPE *; %typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE; +%typemap(out) SWIGTYPE && = SWIGTYPE &&INSTANCE; %typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[]; %typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;
diff --git a/share/swig/2.0.11/tcl/tcluserdir.swg b/share/swig/3.0.12/tcl/tcluserdir.swg similarity index 100% rename from share/swig/2.0.11/tcl/tcluserdir.swg rename to share/swig/3.0.12/tcl/tcluserdir.swg
diff --git a/share/swig/2.0.11/tcl/tclwstrings.swg b/share/swig/3.0.12/tcl/tclwstrings.swg similarity index 100% rename from share/swig/2.0.11/tcl/tclwstrings.swg rename to share/swig/3.0.12/tcl/tclwstrings.swg
diff --git a/share/swig/2.0.11/tcl/typemaps.i b/share/swig/3.0.12/tcl/typemaps.i similarity index 100% rename from share/swig/2.0.11/tcl/typemaps.i rename to share/swig/3.0.12/tcl/typemaps.i
diff --git a/share/swig/2.0.11/tcl/wish.i b/share/swig/3.0.12/tcl/wish.i similarity index 100% rename from share/swig/2.0.11/tcl/wish.i rename to share/swig/3.0.12/tcl/wish.i
diff --git a/share/swig/2.0.11/typemaps/attribute.swg b/share/swig/3.0.12/typemaps/attribute.swg similarity index 97% rename from share/swig/2.0.11/typemaps/attribute.swg rename to share/swig/3.0.12/typemaps/attribute.swg index 46fc80f..9881139 100644 --- a/share/swig/2.0.11/typemaps/attribute.swg +++ b/share/swig/3.0.12/typemaps/attribute.swg
@@ -130,11 +130,14 @@ }; %} + The %attributestring also works for class types that have %naturalvar turned + on and so is also useful for shared_ptr which has %naturalvar turned on in %shared_ptr. + */ // // Define SWIG_ATTRIBUTE_TEMPLATE if you want to use templates instead of macros for the C++ get and set wrapper methods -// Does not always generate compileable code, use at your peril! +// Does not always generate compilable code, use at your peril! // //#define SWIG_ATTRIBUTE_TEMPLATE @@ -275,7 +278,7 @@ %ignore Class::GetMethod(); %ignore Class::GetMethod() const; %newobject Class::AttributeName; - %typemap(newfree) const AttributeType &AttributeName "delete $1;// my newfree override" + %typemap(newfree) const AttributeType &AttributeName "delete $1;" %extend Class { AttributeType AttributeName; }
diff --git a/share/swig/2.0.11/typemaps/carrays.swg b/share/swig/3.0.12/typemaps/carrays.swg similarity index 100% rename from share/swig/2.0.11/typemaps/carrays.swg rename to share/swig/3.0.12/typemaps/carrays.swg
diff --git a/share/swig/2.0.11/typemaps/cdata.swg b/share/swig/3.0.12/typemaps/cdata.swg similarity index 100% rename from share/swig/2.0.11/typemaps/cdata.swg rename to share/swig/3.0.12/typemaps/cdata.swg
diff --git a/share/swig/2.0.11/typemaps/cmalloc.swg b/share/swig/3.0.12/typemaps/cmalloc.swg similarity index 100% rename from share/swig/2.0.11/typemaps/cmalloc.swg rename to share/swig/3.0.12/typemaps/cmalloc.swg
diff --git a/share/swig/2.0.11/typemaps/cpointer.swg b/share/swig/3.0.12/typemaps/cpointer.swg similarity index 100% rename from share/swig/2.0.11/typemaps/cpointer.swg rename to share/swig/3.0.12/typemaps/cpointer.swg
diff --git a/share/swig/2.0.11/typemaps/cstring.swg b/share/swig/3.0.12/typemaps/cstring.swg similarity index 100% rename from share/swig/2.0.11/typemaps/cstring.swg rename to share/swig/3.0.12/typemaps/cstring.swg
diff --git a/share/swig/2.0.11/typemaps/cstrings.swg b/share/swig/3.0.12/typemaps/cstrings.swg similarity index 97% rename from share/swig/2.0.11/typemaps/cstrings.swg rename to share/swig/3.0.12/typemaps/cstrings.swg index 7fe6a3f..0aca611 100644 --- a/share/swig/2.0.11/typemaps/cstrings.swg +++ b/share/swig/3.0.12/typemaps/cstrings.swg
@@ -203,7 +203,7 @@ * This macro is used to return Character data along with a size * parameter. * - * %cstring_output_maxsize(Char *outx, int *max) { + * %cstring_output_withsize(Char *outx, int *max) { * void foo(Char *outx, int *max) { * sprintf(outx,"blah blah\n"); * *max = strlen(outx); @@ -236,7 +236,7 @@ * This macro is used to return Character data that was * allocated with new or malloc. * - * %cstring_output_allocated(Char **outx, free($1)); + * %cstring_output_allocate(Char **outx, free($1)); * void foo(Char **outx) { * *outx = (Char *) malloc(512); * sprintf(outx,"blah blah\n"); @@ -263,7 +263,7 @@ * This macro is used to return Character data that was * allocated with new or malloc. * - * %cstring_output_allocated(Char **outx, int *sz, free($1)); + * %cstring_output_allocate_size(Char **outx, int *sz, free($1)); * void foo(Char **outx, int *sz) { * *outx = (Char *) malloc(512); * sprintf(outx,"blah blah\n");
diff --git a/share/swig/2.0.11/typemaps/cwstring.swg b/share/swig/3.0.12/typemaps/cwstring.swg similarity index 100% rename from share/swig/2.0.11/typemaps/cwstring.swg rename to share/swig/3.0.12/typemaps/cwstring.swg
diff --git a/share/swig/2.0.11/typemaps/enumint.swg b/share/swig/3.0.12/typemaps/enumint.swg similarity index 64% rename from share/swig/2.0.11/typemaps/enumint.swg rename to share/swig/3.0.12/typemaps/enumint.swg index 854d6f3..d048bb6 100644 --- a/share/swig/2.0.11/typemaps/enumint.swg +++ b/share/swig/3.0.12/typemaps/enumint.swg
@@ -3,9 +3,20 @@ * ------------------------------------------------------------ */ %apply int { enum SWIGTYPE }; -%apply const int& { const enum SWIGTYPE& }; +%apply const int& { const enum SWIGTYPE & }; +%apply const int& { const enum SWIGTYPE && }; -%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE& (int val, int ecode, $basetype temp) { +%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE & (int val, int ecode, $basetype temp) { + ecode = SWIG_AsVal(int)($input, &val); + if (!SWIG_IsOK(ecode)) { + %argument_fail(ecode, "$type", $symname, $argnum); + } else { + temp = %static_cast(val,$basetype); + $1 = &temp; + } +} + +%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE && (int val, int ecode, $basetype temp) { ecode = SWIG_AsVal(int)($input, &val); if (!SWIG_IsOK(ecode)) { %argument_fail(ecode, "$type", $symname, $argnum);
diff --git a/share/swig/2.0.11/typemaps/exception.swg b/share/swig/3.0.12/typemaps/exception.swg similarity index 98% rename from share/swig/2.0.11/typemaps/exception.swg rename to share/swig/3.0.12/typemaps/exception.swg index 12c4ea6..b60a329 100644 --- a/share/swig/2.0.11/typemaps/exception.swg +++ b/share/swig/3.0.12/typemaps/exception.swg
@@ -52,9 +52,9 @@ } } */ -%{ -#include <stdexcept> -%} + +%fragment("<stdexcept>"); + %define SWIG_CATCH_STDEXCEPT /* catching std::exception */ catch (std::invalid_argument& e) {
diff --git a/share/swig/2.0.11/typemaps/factory.swg b/share/swig/3.0.12/typemaps/factory.swg similarity index 100% rename from share/swig/2.0.11/typemaps/factory.swg rename to share/swig/3.0.12/typemaps/factory.swg
diff --git a/share/swig/2.0.11/typemaps/fragments.swg b/share/swig/3.0.12/typemaps/fragments.swg similarity index 90% rename from share/swig/2.0.11/typemaps/fragments.swg rename to share/swig/3.0.12/typemaps/fragments.swg index 8f887e3..3f33ca9 100644 --- a/share/swig/2.0.11/typemaps/fragments.swg +++ b/share/swig/3.0.12/typemaps/fragments.swg
@@ -149,15 +149,44 @@ #endif %} -%fragment("<stddef.h>", "header") %{ - #include <stddef.h> +%fragment("<stddef.h>", "header") %{ +#include <stddef.h> +%} + +%fragment("<string>", "header") %{ +#include <string> +%} + +%fragment("<stdexcept>", "header") %{ +#include <stdexcept> +%} + +%fragment("<algorithm>", "header") %{ +#include <algorithm> %} %fragment("SWIG_isfinite","header",fragment="<math.h>,<float.h>") %{ /* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */ #ifndef SWIG_isfinite +/* isfinite() is a macro for C99 */ # if defined(isfinite) # define SWIG_isfinite(X) (isfinite(X)) +# elif defined __cplusplus && __cplusplus >= 201103L +/* Use a template so that this works whether isfinite() is std::isfinite() or + * in the global namespace. The reality seems to vary between compiler + * versions. + * + * Make sure namespace std exists to avoid compiler warnings. + * + * extern "C++" is required as this fragment can end up inside an extern "C" { } block + */ +namespace std { } +extern "C++" template<typename T> +inline int SWIG_isfinite_func(T x) { + using namespace std; + return isfinite(x); +} +# define SWIG_isfinite(X) (SWIG_isfinite_func(X)) # elif defined(_MSC_VER) # define SWIG_isfinite(X) (_finite(X)) # elif defined(__sun) && defined(__SVR4)
diff --git a/share/swig/2.0.11/typemaps/implicit.swg b/share/swig/3.0.12/typemaps/implicit.swg similarity index 87% rename from share/swig/2.0.11/typemaps/implicit.swg rename to share/swig/3.0.12/typemaps/implicit.swg index 702fb52..2fc3108 100644 --- a/share/swig/2.0.11/typemaps/implicit.swg +++ b/share/swig/3.0.12/typemaps/implicit.swg
@@ -73,8 +73,8 @@ typedef Type value_type; static int asptr(SWIG_Object obj, value_type **val) { Type *vptr; - static swig_type_info* desc = SWIG_TypeQuery("Type *"); - int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0); + static swig_type_info* descriptor = SWIG_TypeQuery("Type *"); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = vptr; return res; @@ -109,8 +109,8 @@ typedef Type value_type; static int asptr(SWIG_Object obj, value_type **val) { Type *vptr; - static swig_type_info* desc = SWIG_TypeQuery("Type *"); - int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0); + static swig_type_info* descriptor = SWIG_TypeQuery("Type *"); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = vptr; return res; @@ -147,8 +147,8 @@ typedef Type value_type; static int asptr(SWIG_Object obj, value_type **val) { Type *vptr; - static swig_type_info* desc = SWIG_TypeQuery("Type *"); - int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0); + static swig_type_info* descriptor = SWIG_TypeQuery("Type *"); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = vptr; return SWIG_OLDOBJ; @@ -188,8 +188,8 @@ typedef Type value_type; static int asptr(SWIG_Object obj, value_type **val) { Type *vptr; - static swig_type_info* desc = SWIG_TypeQuery("Type *"); - int res = SWIG_ConvertPtr(obj, (void **)&vptr, desc, 0); + static swig_type_info* descriptor = SWIG_TypeQuery("Type *"); + int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&vptr, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res)) { if (val) *val = vptr; return res;
diff --git a/share/swig/2.0.11/typemaps/inoutlist.swg b/share/swig/3.0.12/typemaps/inoutlist.swg similarity index 100% rename from share/swig/2.0.11/typemaps/inoutlist.swg rename to share/swig/3.0.12/typemaps/inoutlist.swg
diff --git a/share/swig/2.0.11/typemaps/misctypes.swg b/share/swig/3.0.12/typemaps/misctypes.swg similarity index 100% rename from share/swig/2.0.11/typemaps/misctypes.swg rename to share/swig/3.0.12/typemaps/misctypes.swg
diff --git a/share/swig/2.0.11/typemaps/primtypes.swg b/share/swig/3.0.12/typemaps/primtypes.swg similarity index 79% rename from share/swig/2.0.11/typemaps/primtypes.swg rename to share/swig/3.0.12/typemaps/primtypes.swg index 45632c3..dd80eb7 100644 --- a/share/swig/2.0.11/typemaps/primtypes.swg +++ b/share/swig/3.0.12/typemaps/primtypes.swg
@@ -148,6 +148,12 @@ /* long long/unsigned long long */ +%fragment("SWIG_LongLongAvailable","header", fragment="<limits.h>") %{ +#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) +# define SWIG_LONG_LONG_AVAILABLE +#endif +%} + %ensure_type_fragments(long long) %ensure_type_fragments(unsigned long long) @@ -157,42 +163,82 @@ /* size_t */ -%fragment(SWIG_From_frag(size_t),"header",fragment=SWIG_From_frag(unsigned long)) { +%fragment(SWIG_From_frag(size_t),"header",fragment=SWIG_From_frag(unsigned long),fragment=SWIG_From_frag(unsigned long long)) { SWIGINTERNINLINE SWIG_Object SWIG_From_dec(size_t)(size_t value) { - return SWIG_From(unsigned long)(%numeric_cast(value, unsigned long)); +%#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +%#endif + return SWIG_From(unsigned long)(%numeric_cast(value, unsigned long)); +%#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(size_t) <= sizeof(unsigned long long) */ + return SWIG_From(unsigned long long)(%numeric_cast(value, unsigned long long)); + } +%#endif } } -%fragment(SWIG_AsVal_frag(size_t),"header",fragment=SWIG_AsVal_frag(unsigned long)) { +%fragment(SWIG_AsVal_frag(size_t),"header",fragment=SWIG_AsVal_frag(unsigned long),fragment=SWIG_AsVal_frag(unsigned long long)) { SWIGINTERNINLINE int SWIG_AsVal_dec(size_t)(SWIG_Object obj, size_t *val) { - unsigned long v; - int res = SWIG_AsVal(unsigned long)(obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, size_t); + int res = SWIG_TypeError; +%#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +%#endif + unsigned long v; + res = SWIG_AsVal(unsigned long)(obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, size_t); +%#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(size_t) <= sizeof(unsigned long long)) { + unsigned long long v; + res = SWIG_AsVal(unsigned long long)(obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, size_t); + } +%#endif return res; } } /* ptrdiff_t */ -%fragment(SWIG_From_frag(ptrdiff_t),"header",fragment=SWIG_From_frag(long)) { +%fragment(SWIG_From_frag(ptrdiff_t),"header",fragment=SWIG_From_frag(long),fragment=SWIG_From_frag(long long)) { SWIGINTERNINLINE SWIG_Object SWIG_From_dec(ptrdiff_t)(ptrdiff_t value) { - return SWIG_From(long)(%numeric_cast(value,long)); +%#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +%#endif + return SWIG_From(long)(%numeric_cast(value, long)); +%#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(ptrdiff_t) <= sizeof(long long) */ + return SWIG_From(long long)(%numeric_cast(value, long long)); + } +%#endif } } -%fragment(SWIG_AsVal_frag(ptrdiff_t),"header",fragment=SWIG_AsVal_frag(long)) { +%fragment(SWIG_AsVal_frag(ptrdiff_t),"header",fragment=SWIG_AsVal_frag(long),fragment=SWIG_AsVal_frag(long long)) { SWIGINTERNINLINE int SWIG_AsVal_dec(ptrdiff_t)(SWIG_Object obj, ptrdiff_t *val) { - long v; - int res = SWIG_AsVal(long)(obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, ptrdiff_t); + int res = SWIG_TypeError; +%#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(ptrdiff_t) <= sizeof(long)) { +%#endif + long v; + res = SWIG_AsVal(long)(obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, ptrdiff_t); +%#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(ptrdiff_t) <= sizeof(long long)) { + long long v; + res = SWIG_AsVal(long long)(obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = %numeric_cast(v, ptrdiff_t); + } +%#endif return res; } }
diff --git a/share/swig/2.0.11/typemaps/ptrtypes.swg b/share/swig/3.0.12/typemaps/ptrtypes.swg similarity index 100% rename from share/swig/2.0.11/typemaps/ptrtypes.swg rename to share/swig/3.0.12/typemaps/ptrtypes.swg
diff --git a/share/swig/2.0.11/typemaps/std_except.swg b/share/swig/3.0.12/typemaps/std_except.swg similarity index 95% rename from share/swig/2.0.11/typemaps/std_except.swg rename to share/swig/3.0.12/typemaps/std_except.swg index cb5ed30..75d0664 100644 --- a/share/swig/2.0.11/typemaps/std_except.swg +++ b/share/swig/3.0.12/typemaps/std_except.swg
@@ -20,6 +20,7 @@ %enddef namespace std { + %std_exception_map(bad_cast, SWIG_TypeError); %std_exception_map(bad_exception, SWIG_SystemError); %std_exception_map(domain_error, SWIG_ValueError); %std_exception_map(exception, SWIG_SystemError);
diff --git a/share/swig/2.0.11/typemaps/std_string.swg b/share/swig/3.0.12/typemaps/std_string.swg similarity index 92% rename from share/swig/2.0.11/typemaps/std_string.swg rename to share/swig/3.0.12/typemaps/std_string.swg index 691bf2c..5b57bea 100644 --- a/share/swig/2.0.11/typemaps/std_string.swg +++ b/share/swig/3.0.12/typemaps/std_string.swg
@@ -8,10 +8,8 @@ %include <typemaps/std_strings.swg> -%{ -#include <string> -%} - +%fragment("<string>"); + namespace std { %naturalvar string;
diff --git a/share/swig/2.0.11/typemaps/std_strings.swg b/share/swig/3.0.12/typemaps/std_strings.swg similarity index 100% rename from share/swig/2.0.11/typemaps/std_strings.swg rename to share/swig/3.0.12/typemaps/std_strings.swg
diff --git a/share/swig/2.0.11/typemaps/std_wstring.swg b/share/swig/3.0.12/typemaps/std_wstring.swg similarity index 93% rename from share/swig/2.0.11/typemaps/std_wstring.swg rename to share/swig/3.0.12/typemaps/std_wstring.swg index 670685f..4a2830b 100644 --- a/share/swig/2.0.11/typemaps/std_wstring.swg +++ b/share/swig/3.0.12/typemaps/std_wstring.swg
@@ -7,8 +7,8 @@ %{ #include <cwchar> -#include <string> %} +%fragment("<string>"); namespace std {
diff --git a/share/swig/2.0.11/typemaps/string.swg b/share/swig/3.0.12/typemaps/string.swg similarity index 61% rename from share/swig/2.0.11/typemaps/string.swg rename to share/swig/3.0.12/typemaps/string.swg index 279ee2a..4b70723 100644 --- a/share/swig/2.0.11/typemaps/string.swg +++ b/share/swig/3.0.12/typemaps/string.swg
@@ -17,8 +17,19 @@ } } +%fragment("SWIG_strnlen","header",fragment="SWIG_FromCharPtrAndSize") { +SWIGINTERN size_t +SWIG_strnlen(const char* s, size_t maxlen) +{ + const char *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} +} %include <typemaps/strings.swg> %typemaps_string(%checkcode(STRING), %checkcode(CHAR), - char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, strlen, + char, Char, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, + strlen, SWIG_strnlen, "<limits.h>", CHAR_MIN, CHAR_MAX)
diff --git a/share/swig/2.0.11/typemaps/strings.swg b/share/swig/3.0.12/typemaps/strings.swg similarity index 95% rename from share/swig/2.0.11/typemaps/strings.swg rename to share/swig/3.0.12/typemaps/strings.swg index 55e9d2b..87e97dd 100644 --- a/share/swig/2.0.11/typemaps/strings.swg +++ b/share/swig/3.0.12/typemaps/strings.swg
@@ -22,6 +22,7 @@ SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, SWIG_AsCharPtr, SWIG_FromCharPtr, SWIG_AsCharArray, @@ -276,12 +277,13 @@ } %typemap(freearg) const Char (&)[ANY] ""; -%typemap(out,fragment=#SWIG_FromCharPtrAndSize) +%typemap(out,fragment=#SWIG_FromCharPtrAndSize,fragment=#SWIG_CharBufLen) Char [ANY], const Char[ANY] { - size_t size = $1_dim0; %#ifndef SWIG_PRESERVE_CARRAY_SIZE - while (size && ($1[size - 1] == '\0')) --size; + size_t size = SWIG_CharBufLen($1, $1_dim0); +%#else + size_t size = $1_dim0; %#endif %set_output(SWIG_FromCharPtrAndSize($1, size)); } @@ -298,23 +300,25 @@ /* varout */ -%typemap(varout,noblock=1,fragment=#SWIG_FromCharPtrAndSize) +%typemap(varout,fragment=#SWIG_CharBufLen) Char [ANY], const Char [ANY] { - size_t size = $1_dim0; %#ifndef SWIG_PRESERVE_CARRAY_SIZE - while (size && ($1[size - 1] == '\0')) --size; + size_t size = SWIG_CharBufLen($1, $1_dim0); +%#else + size_t size = $1_dim0; %#endif %set_varoutput(SWIG_FromCharPtrAndSize($1, size)); } /* constant */ -%typemap(constcode,fragment=#SWIG_FromCharPtrAndSize) +%typemap(constcode,fragment=#SWIG_CharBufLen) Char [ANY], const Char [ANY] { - size_t size = $value_dim0; %#ifndef SWIG_PRESERVE_CARRAY_SIZE - while (size && ($value[size - 1] == '\0')) --size; + size_t size = SWIG_CharBufLen($1, $1_dim0); +%#else + size_t size = $value_dim0; %#endif %set_constant("$symname", SWIG_FromCharPtrAndSize($value,size)); } @@ -323,12 +327,13 @@ #if defined(SWIG_DIRECTOR_TYPEMAPS) /* directorin */ -%typemap(directorin,fragment=#SWIG_FromCharPtrAndSize) +%typemap(directorin,fragment=#SWIG_CharBufLen) Char [ANY], const Char [ANY] { - size_t size = $1_dim0; %#ifndef SWIG_PRESERVE_CARRAY_SIZE - while (size && ($1[size - 1] == '\0')) --size; + size_t size = SWIG_CharBufLen($1, $1_dim0); +%#else + size_t size = $1_dim0; %#endif $input = SWIG_FromCharPtrAndSize($1, size); } @@ -360,12 +365,13 @@ /* throws */ -%typemap(throws,fragment=#SWIG_FromCharPtrAndSize) +%typemap(throws,fragment=#SWIG_CharBufLen) Char [ANY], const Char[ANY] { - size_t size = $1_dim0; %#ifndef SWIG_PRESERVE_CARRAY_SIZE - while (size && ($1[size - 1] == '\0')) --size; + size_t size = SWIG_CharBufLen($1, $1_dim0); +%#else + size_t size = $1_dim0; %#endif %raise(SWIG_FromCharPtrAndSize($1, size), "$type", 0); } @@ -493,12 +499,13 @@ * --- String fragment methods --- * ------------------------------------------------------------ */ - +#ifndef %_typemap2_string %define %_typemap2_string(StringCode, CharCode, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, SWIG_NewCopyCharArray, SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX) @@ -530,7 +537,8 @@ Char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); if (SWIG_IsOK(res)) { - if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize; + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; if (csize <= size) { if (val) { if (csize) memcpy(val, cptr, csize*sizeof(Char)); @@ -586,6 +594,7 @@ SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, SWIG_As##CharName##Ptr, SWIG_From##CharName##Ptr, SWIG_As##CharName##Array, @@ -593,7 +602,7 @@ SWIG_DeleteCharArray) %enddef - +#endif /* ------------------------------------------------------------ * String typemaps and fragments, with default allocators @@ -604,12 +613,14 @@ SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, FragLimits, CHAR_MIN, CHAR_MAX) %_typemap2_string(StringCode, CharCode, Char, CharName, SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, %new_copy_array, %delete_array, FragLimits, CHAR_MIN, CHAR_MAX) @@ -624,6 +635,7 @@ SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, SWIG_NewCopyCharArray, SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX) @@ -632,6 +644,7 @@ SWIG_AsCharPtrAndSize, SWIG_FromCharPtrAndSize, SWIG_CharPtrLen, + SWIG_CharBufLen, SWIG_NewCopyCharArray, SWIG_DeleteCharArray, FragLimits, CHAR_MIN, CHAR_MAX)
diff --git a/share/swig/2.0.11/typemaps/swigmacros.swg b/share/swig/3.0.12/typemaps/swigmacros.swg similarity index 90% rename from share/swig/2.0.11/typemaps/swigmacros.swg rename to share/swig/3.0.12/typemaps/swigmacros.swg index c9b42fa..3a63a25 100644 --- a/share/swig/2.0.11/typemaps/swigmacros.swg +++ b/share/swig/3.0.12/typemaps/swigmacros.swg
@@ -3,16 +3,16 @@ * ----------------------------------------------------------------------------- */ /* This file implements the internal macros of the 'SWIG API', which - are useful to implement all the SWIG target languges. + are useful to implement all the SWIG target languages. Basic preprocessor macros: -------------------------- %arg(Arg) Safe argument wrap - %str(Arg) Stringtify the argument - %begin_block Begin a execution block - %end_block End a execution block - %block(Block) Execute Block as a excecution block + %str(Arg) Stringify the argument + %begin_block Begin an execution block + %end_block End an execution block + %block(Block) Execute Block as an execution block %define_as(Def, Val) Define 'Def' as 'Val', expanding Def and Val first %ifcplusplus(V1, V2) if C++ Mode; then V1; else V2; fi @@ -43,7 +43,7 @@ %new_instance(Type) Allocate a new instance of given Type %new_copy(value,Type) Allocate and initialize a new instance with 'value' - %new_array(size,Type) Allocate a new array with given size and Type + %new_array(size,Type) Allocate a new array with given size and Type and zero initialize %new_copy_array(cptr,size,Type) Allocate and initialize a new array from 'cptr' %delete(cptr) Delete an instance %delete_array(cptr) Delete an array @@ -157,17 +157,17 @@ * ----------------------------------------------------------------------------- */ #if defined(__cplusplus) -# define %new_instance(Type...) (new Type) +# define %new_instance(Type...) (new Type()) # define %new_copy(val,Type...) (new Type(%static_cast(val, const Type&))) -# define %new_array(size,Type...) (new Type[size]) -# define %new_copy_array(ptr,size,Type...) %reinterpret_cast(memcpy(%new_array(size,Type), ptr, sizeof(Type)*(size)), Type*) +# define %new_array(size,Type...) (new Type[size]()) +# define %new_copy_array(ptr,size,Type...) %reinterpret_cast(memcpy(new Type[size], ptr, sizeof(Type)*(size)), Type*) # define %delete(cptr) delete cptr # define %delete_array(cptr) delete[] cptr #else /* C case */ -# define %new_instance(Type...) (Type *)malloc(sizeof(Type)) +# define %new_instance(Type...) (Type *)calloc(1,sizeof(Type)) # define %new_copy(val,Type...) (Type *)memcpy(%new_instance(Type),&val,sizeof(Type)) -# define %new_array(size,Type...) (Type *)malloc((size)*sizeof(Type)) -# define %new_copy_array(ptr,size,Type...) (Type *)memcpy(%new_array(size,Type), ptr, sizeof(Type)*(size)) +# define %new_array(size,Type...) (Type *)calloc(size, sizeof(Type)) +# define %new_copy_array(ptr,size,Type...) (Type *)memcpy(malloc((size)*sizeof(Type)), ptr, sizeof(Type)*(size)) # define %delete(cptr) free((char*)cptr) # define %delete_array(cptr) free((char*)cptr) #endif /* __cplusplus */
diff --git a/share/swig/2.0.11/typemaps/swigobject.swg b/share/swig/3.0.12/typemaps/swigobject.swg similarity index 100% rename from share/swig/2.0.11/typemaps/swigobject.swg rename to share/swig/3.0.12/typemaps/swigobject.swg
diff --git a/share/swig/2.0.11/typemaps/swigtype.swg b/share/swig/3.0.12/typemaps/swigtype.swg similarity index 82% rename from share/swig/2.0.11/typemaps/swigtype.swg rename to share/swig/3.0.12/typemaps/swigtype.swg index 4f5e01a..d3633eb 100644 --- a/share/swig/2.0.11/typemaps/swigtype.swg +++ b/share/swig/3.0.12/typemaps/swigtype.swg
@@ -67,6 +67,41 @@ } #endif +/* Rvalue reference */ +%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "$type", $symname, $argnum); + } + if (!argp) { %argument_nullref("$type", $symname, $argnum); } + $1 = %reinterpret_cast(argp, $ltype); +} +%typemap(freearg) SWIGTYPE && ""; + +#if defined(__cplusplus) && defined(%implicitconv_flag) +%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "$type", $symname, $argnum); + } + if (!argp) { %argument_nullref("$type", $symname, $argnum); } + $1 = %reinterpret_cast(argp, $ltype); +} +%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE && +{ + if (SWIG_IsNewObj(res$argnum)) %delete($1); +} +#else +%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) { + res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "$type", $symname, $argnum); + } + if (!argp) { %argument_nullref("$type", $symname, $argnum); } + $1 = %reinterpret_cast(argp, $ltype); +} +#endif + /* By value */ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) { @@ -102,7 +137,7 @@ * ----------------------------------------------------------------------------- */ /* Pointers, references */ -%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] { +%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[] { %set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags)); } @@ -124,7 +159,7 @@ %typemap(memberin) SWIGTYPE [ANY] { if ($input) { size_t ii = 0; - for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii]; + for (; ii < (size_t)$1_dim0; ++ii) *($1_basetype *)&$1[ii] = *(($1_basetype *)$input + ii); } else { %variable_nullref("$type","$name"); } @@ -133,7 +168,7 @@ %typemap(globalin) SWIGTYPE [ANY] { if ($input) { size_t ii = 0; - for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii]; + for (; ii < (size_t)$1_dim0; ++ii) *($1_basetype *)&$1[ii] = *(($1_basetype *)$input + ii); } else { %variable_nullref("$type","$name"); } @@ -146,7 +181,7 @@ %variable_fail(res, "$type", "$name"); } else if (inp) { size_t ii = 0; - for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = inp[ii]; + for (; ii < (size_t)$1_dim0; ++ii) *($1_basetype *)&$1[ii] = *(($1_basetype *)inp + ii); } else { %variable_nullref("$type", "$name"); } @@ -235,6 +270,18 @@ $1 = *(%reinterpret_cast(argp, $ltype)); } +%typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && { + void *argp = 0; + int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); + if (!SWIG_IsOK(res)) { + %variable_fail(res, "$type", "$name"); + } + if (!argp) { + %variable_nullref("$type", "$name"); + } + $1 = *(%reinterpret_cast(argp, $ltype)); +} + #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(varin,implicitconv=1) SWIGTYPE { void *argp = 0; @@ -284,6 +331,10 @@ %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags)); } +%typemap(varout, noblock=1) SWIGTYPE && { + %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags)); +} + /* Value */ %typemap(varout, noblock=1) SWIGTYPE { %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags)); @@ -311,12 +362,23 @@ $1 = SWIG_CheckState(res); } +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); + $1 = SWIG_CheckState(res); +} + #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & { int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag); $1 = SWIG_CheckState(res); } +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && { + int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag); + $1 = SWIG_CheckState(res); +} + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE { int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag); $1 = SWIG_CheckState(res); @@ -327,6 +389,11 @@ int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); $1 = SWIG_CheckState(res); } +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && { + void *vptr = 0; + int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); + $1 = SWIG_CheckState(res); +} %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { void *vptr = 0; @@ -348,13 +415,17 @@ } %typemap(directorin,noblock=1) SWIGTYPE { - $input = SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags); + $input = SWIG_NewPointerObj(%as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags); } %typemap(directorin,noblock=1) SWIGTYPE & { $input = SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags); } +%typemap(directorin,noblock=1) SWIGTYPE && { + $input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags); +} + /* directorout */ #if defined(__cplusplus) && defined(%implicitconv_flag) %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { @@ -406,6 +477,22 @@ } } +%typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) + SWIGTYPE &&(void *swig_argp, int swig_res, swig_owntype own) { + swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own); + if (!SWIG_IsOK(swig_res)) { + %dirout_fail(swig_res,"$type"); + } + if (!swig_argp) { %dirout_nullref("$type"); } + $result = %reinterpret_cast(swig_argp, $ltype); + swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_OWN */); +} +%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE && { + if (director) { + SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input))); + } +} + #endif /* SWIG_DIRECTOR_TYPEMAPS */ @@ -413,7 +500,7 @@ * --- Constants --- * ------------------------------------------------------------ */ -%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { +%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] { %set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags)); } @@ -441,6 +528,10 @@ %raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor); } +%typemap(throws,noblock=1) SWIGTYPE && { + %raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor); +} + %typemap(throws,noblock=1) (...) { SWIG_exception_fail(SWIG_RuntimeError,"unknown exception"); } @@ -534,6 +625,7 @@ %typemap(constcode, noblock=1) SWIGTYPE ((*)(ANY)){ %set_constant("$symname", SWIG_NewFunctionPtrObj((void *)$value, $descriptor)); } +%typemap(constcode) SWIGTYPE ((* const)(ANY)) = SWIGTYPE ((*)(ANY)); #if defined(SWIG_DIRECTOR_TYPEMAPS)
diff --git a/share/swig/2.0.11/typemaps/swigtypemaps.swg b/share/swig/3.0.12/typemaps/swigtypemaps.swg similarity index 98% rename from share/swig/2.0.11/typemaps/swigtypemaps.swg rename to share/swig/3.0.12/typemaps/swigtypemaps.swg index 0e39afe..4e5bb2b 100644 --- a/share/swig/2.0.11/typemaps/swigtypemaps.swg +++ b/share/swig/3.0.12/typemaps/swigtypemaps.swg
@@ -12,7 +12,7 @@ and then include this file. Typically you will create a 'mytypemaps.swg' file in each target - languge, where you will have the following sections: + language, where you will have the following sections: === mytypemaps.swg ===
diff --git a/share/swig/2.0.11/typemaps/typemaps.swg b/share/swig/3.0.12/typemaps/typemaps.swg similarity index 100% rename from share/swig/2.0.11/typemaps/typemaps.swg rename to share/swig/3.0.12/typemaps/typemaps.swg
diff --git a/share/swig/2.0.11/typemaps/valtypes.swg b/share/swig/3.0.12/typemaps/valtypes.swg similarity index 100% rename from share/swig/2.0.11/typemaps/valtypes.swg rename to share/swig/3.0.12/typemaps/valtypes.swg
diff --git a/share/swig/2.0.11/typemaps/void.swg b/share/swig/3.0.12/typemaps/void.swg similarity index 100% rename from share/swig/2.0.11/typemaps/void.swg rename to share/swig/3.0.12/typemaps/void.swg
diff --git a/share/swig/2.0.11/typemaps/wstring.swg b/share/swig/3.0.12/typemaps/wstring.swg similarity index 68% rename from share/swig/2.0.11/typemaps/wstring.swg rename to share/swig/3.0.12/typemaps/wstring.swg index 2567dc7..cd409d1 100644 --- a/share/swig/2.0.11/typemaps/wstring.swg +++ b/share/swig/3.0.12/typemaps/wstring.swg
@@ -18,8 +18,20 @@ } } +%fragment("SWIG_wcsnlen","header",fragment="SWIG_FromWCharPtrAndSize") { +SWIGINTERN size_t +SWIG_wcsnlen(const wchar_t* s, size_t maxlen) +{ + const wchar_t *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} +} + %include <typemaps/strings.swg> %typemaps_string(%checkcode(UNISTRING), %checkcode(UNICHAR), - wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, wcslen, + wchar_t, WChar, SWIG_AsWCharPtrAndSize, SWIG_FromWCharPtrAndSize, + wcslen, SWIG_wcsnlen, "<wchar.h>", WCHAR_MIN, WCHAR_MAX)
diff --git a/share/swig/2.0.11/uffi/uffi.swg b/share/swig/3.0.12/uffi/uffi.swg similarity index 100% rename from share/swig/2.0.11/uffi/uffi.swg rename to share/swig/3.0.12/uffi/uffi.swg
diff --git a/share/swig/2.0.11/wchar.i b/share/swig/3.0.12/wchar.i similarity index 100% rename from share/swig/2.0.11/wchar.i rename to share/swig/3.0.12/wchar.i
diff --git a/share/swig/2.0.11/windows.i b/share/swig/3.0.12/windows.i similarity index 100% rename from share/swig/2.0.11/windows.i rename to share/swig/3.0.12/windows.i